diff --git a/src/rule-must-colocate-fragment-spreads.js b/src/rule-must-colocate-fragment-spreads.js index e9c3d91..1619751 100644 --- a/src/rule-must-colocate-fragment-spreads.js +++ b/src/rule-must-colocate-fragment-spreads.js @@ -103,10 +103,6 @@ function getGraphQLFragmentSpreads(graphQLAst) { return fragmentSpreads; } -function isFirstLetterUppercase(word) { - return /^\p{Lu}/u.test(word); -} - function getGraphQLFragmentDefinitionName(graphQLAst) { let name = null; visit(graphQLAst, { @@ -171,11 +167,7 @@ function checkColocation(context) { ImportDeclaration(node) { if (node.importKind === 'value') { node.specifiers.forEach(specifier => { - if ( - allowNamedImports && - specifier.imported && - isFirstLetterUppercase(specifier.imported.name) - ) { + if (allowNamedImports && specifier.imported) { foundImportedModules.push({ type: 'namedImport', value: specifier.imported.name diff --git a/test/must-colocate-fragment-spreads.js b/test/must-colocate-fragment-spreads.js index a101eff..bcc1b6c 100644 --- a/test/must-colocate-fragment-spreads.js +++ b/test/must-colocate-fragment-spreads.js @@ -50,6 +50,16 @@ ruleTester.run( `, options: [{allowNamedImports: true}] }, + { + code: ` + import { useHook } from '@some/module'; + + graphql\`fragment foo on Page { + ...useHook + }\`; + `, + options: [{allowNamedImports: true}] + }, ` const Component = require('../shared/component.js'); graphql\`fragment foo on Page {