File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
packages/eslint-plugin-react-hooks Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,15 @@ const tests = {
561561 };
562562 ` ,
563563 } ,
564+ {
565+ code : normalizeIndent `
566+ // Valid because React supports international languages
567+ function ÄndraVärdeComponent() {
568+ useHook();
569+ return <div />;
570+ }
571+ `
572+ } ,
564573 ] ,
565574 invalid : [
566575 {
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ function isHook(node: Node): boolean {
4242 * always start with an uppercase letter.
4343 */
4444function isComponentName ( node : Node ) : boolean {
45- return node . type === 'Identifier' && / ^ [ A - Z ] / . test ( node . name ) ;
45+ return node . type === 'Identifier' &&
46+ node . name [ 0 ] === node . name [ 0 ] . toUpperCase ( ) &&
47+ node . name [ 0 ] !== '_' &&
48+ node . name [ 0 ] !== '$' ;
4649}
4750
4851function isReactFunction ( node : Node , functionName : string ) : boolean {
You can’t perform that action at this time.
0 commit comments