Add additional messaging for RulesOfHooks lint error (#20692)
* Add additional messaging for RulesOfHooks lint error * Fix tests and spacing issue * Prettify ESLintRulesOfHooks-test
This commit is contained in:
parent
78d2f2d301
commit
c62986cfd8
|
@ -915,7 +915,8 @@ function functionError(hook, fn) {
|
|||
message:
|
||||
`React Hook "${hook}" is called in function "${fn}" that is neither ` +
|
||||
'a React function component nor a custom React Hook function.' +
|
||||
' React component names must start with an uppercase letter.',
|
||||
' React component names must start with an uppercase letter.' +
|
||||
' React Hook names must start with the word "use".',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -482,7 +482,8 @@ export default {
|
|||
`function "${context.getSource(codePathFunctionName)}" ` +
|
||||
'that is neither a React function component nor a custom ' +
|
||||
'React Hook function.' +
|
||||
' React component names must start with an uppercase letter.';
|
||||
' React component names must start with an uppercase letter.' +
|
||||
' React Hook names must start with the word "use".';
|
||||
context.report({node: hook, message});
|
||||
} else if (codePathNode.type === 'Program') {
|
||||
// These are dangerous if you have inline requires enabled.
|
||||
|
|
Loading…
Reference in New Issue