Skip to content

Commit

Permalink
Added clear message for functional component starting with lowercase (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
roheat authored May 10, 2020
1 parent 539527b commit ddcc69c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,8 @@ function functionError(hook, fn) {
return {
message:
`React Hook "${hook}" is called in function "${fn}" that is neither ` +
'a React function component nor a custom React Hook function.',
'a React function component nor a custom React Hook function.' +
' React component names must start with an uppercase letter.',
};
}

Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ export default {
`React Hook "${context.getSource(hook)}" is called in ` +
`function "${context.getSource(codePathFunctionName)}" ` +
'that is neither a React function component nor a custom ' +
'React Hook function.';
'React Hook function.' +
' React component names must start with an uppercase letter.';
context.report({node: hook, message});
} else if (codePathNode.type === 'Program') {
// These are dangerous if you have inline requires enabled.
Expand Down

0 comments on commit ddcc69c

Please sign in to comment.