Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ddcc69c

Browse files
authored
Added clear message for functional component starting with lowercase (facebook#18881)
1 parent 539527b commit ddcc69c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,8 @@ function functionError(hook, fn) {
916916
return {
917917
message:
918918
`React Hook "${hook}" is called in function "${fn}" that is neither ` +
919-
'a React function component nor a custom React Hook function.',
919+
'a React function component nor a custom React Hook function.' +
920+
' React component names must start with an uppercase letter.',
920921
};
921922
}
922923

packages/eslint-plugin-react-hooks/src/RulesOfHooks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ export default {
481481
`React Hook "${context.getSource(hook)}" is called in ` +
482482
`function "${context.getSource(codePathFunctionName)}" ` +
483483
'that is neither a React function component nor a custom ' +
484-
'React Hook function.';
484+
'React Hook function.' +
485+
' React component names must start with an uppercase letter.';
485486
context.report({node: hook, message});
486487
} else if (codePathNode.type === 'Program') {
487488
// These are dangerous if you have inline requires enabled.

0 commit comments

Comments
 (0)