GeezerVison is showing github.com — Add additional messaging for RulesOfHooks lint error (#20692) · react/react@c62986c
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/eslint-plugin-react-hooks
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -915,7 +915,8 @@ function functionError(hook, fn) { |
915 | 915 | message: |
916 | 916 | `React Hook "${hook}" is called in function "${fn}" that is neither ` + |
917 | 917 | 'a React function component nor a custom React Hook function.' + |
918 | | - ' React component names must start with an uppercase letter.', |
| 918 | + ' React component names must start with an uppercase letter.' + |
| 919 | + ' React Hook names must start with the word "use".', |
919 | 920 | }; |
920 | 921 | } |
921 | 922 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: packages/eslint-plugin-react-hooks/src/RulesOfHooks.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -482,7 +482,8 @@ export default { |
482 | 482 | `function "${context.getSource(codePathFunctionName)}" ` + |
483 | 483 | 'that is neither a React function component nor a custom ' + |
484 | 484 | 'React Hook function.' + |
485 | | - ' React component names must start with an uppercase letter.'; |
| 485 | + ' React component names must start with an uppercase letter.' + |
| 486 | + ' React Hook names must start with the word "use".'; |
486 | 487 | context.report({node: hook, message}); |
487 | 488 | } else if (codePathNode.type === 'Program') { |
488 | 489 | // These are dangerous if you have inline requires enabled. |
|