- 
                Notifications
    You must be signed in to change notification settings 
- Fork 109
Fix Issue #2276 #2277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue #2276 #2277
Changes from 14 commits
d336f33
              fabf3c3
              1a53e78
              d1b9afc
              a7f8a27
              dbffdaf
              5ef576b
              9588849
              a566032
              8610bfb
              7bc64cb
              8536899
              d9f5b4e
              1e5a9a8
              cacb48f
              98a8290
              1dc3773
              f54e692
              88cc91d
              d91fc7b
              a2a3a5a
              ce8b610
              25a6ecb
              59d7783
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@graphql-eslint/eslint-plugin': patch | ||
| --- | ||
|  | ||
| fix issue #2276 | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| fragment BazFields on Bar { | ||
| id | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Imports could have extra whitespace and double/single quotes | ||
|  | ||
| # import BazFields from ".\other-path\baz-fragment.gql" | ||
|  | ||
| query { | ||
| baz { | ||
| ...BazFields | ||
| } | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -90,13 +90,16 @@ export const rule: GraphQLESLintRule = { | |
| const extractedImportPath = comment.value.match(/(["'])((?:\1|.)*?)\1/)?.[2]; | ||
| if (!extractedImportPath) continue; | ||
|  | ||
| const importPath = path.join(path.dirname(filePath), extractedImportPath); | ||
| const importPath = path.join( | ||
| path.dirname(filePath), | ||
| extractedImportPath.replaceAll(/[/\\]/g, path.sep), | ||
| ); | ||
|  | ||
| const hasInSiblings = fragmentsFromSiblings.some( | ||
| source => source.filePath === importPath, | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. previously you added  
 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought so too, but when I printed out the filePath in  I saw this syntax. On Windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange because I added console log on ci and get backslash on windows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here I commented d9f5b4e and got There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder maybe it happens when you specify glob syntax for  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| ); | ||
| if (hasInSiblings) return; | ||
| } | ||
|  | ||
| const fragmentInSameFile = fragmentsFromSiblings.some( | ||
| source => source.filePath === filePath, | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same,  | ||
| ); | ||
|  | ||


Uh oh!
There was an error while loading. Please reload this page.