Added clear message for functional component starting with lowercase (#18881)

This commit is contained in:
Rohith Srivathsav 2020-05-10 06:22:11 +05:30 committed by GitHub
parent 539527b642
commit ddcc69c83b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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.',
};
}

View File

@ -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.