-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17f15ca
commit d93900b
Showing
14 changed files
with
216 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-eslint/eslint-plugin': minor | ||
--- | ||
|
||
feat: support ESLint 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,6 @@ | |
}, | ||
"devDependencies": { | ||
"@graphql-eslint/eslint-plugin": "2.2.0", | ||
"eslint": "7.32.0" | ||
"eslint": "8.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
diff --git a/node_modules/eslint/lib/rule-tester/rule-tester.js b/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
index 2b55249..08547f3 100644 | ||
index 324af7b..e771420 100644 | ||
--- a/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
+++ b/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
@@ -911,7 +911,17 @@ class RuleTester { | ||
@@ -943,8 +943,18 @@ class RuleTester { | ||
"Expected no autofixes to be suggested" | ||
); | ||
} else { | ||
- assert.strictEqual(result.output, item.output, "Output is incorrect."); | ||
+ if (item.output.includes('# normalize graphql')) { | ||
+ const graphql = require('graphql'); | ||
+ | ||
+ | ||
+ function normalize(value) { | ||
+ return graphql.print(graphql.parse(value.replace('# normalize graphql', ''))); | ||
+ } | ||
+ | ||
+ | ||
+ assert.strictEqual(normalize(result.output), normalize(item.output), 'Output is incorrect.'); | ||
+ } else { | ||
+ assert.strictEqual(result.output, item.output, 'Output is incorrect.'); | ||
+ } | ||
} | ||
} else { | ||
assert.strictEqual( | ||
result.output, |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { readFileSync, writeFileSync, readdirSync, unlinkSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
const version = process.argv[2]; | ||
|
||
if (version && !version.startsWith('8')) { | ||
if (version.startsWith('7')) { | ||
const eslint7Patch = ` | ||
diff --git a/node_modules/eslint/lib/rule-tester/rule-tester.js b/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
index 2b55249..08547f3 100644 | ||
--- a/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
+++ b/node_modules/eslint/lib/rule-tester/rule-tester.js | ||
@@ -911,7 +911,17 @@ class RuleTester { | ||
"Expected no autofixes to be suggested" | ||
); | ||
} else { | ||
- assert.strictEqual(result.output, item.output, "Output is incorrect."); | ||
+ if (item.output.includes('# normalize graphql')) { | ||
+ const graphql = require('graphql'); | ||
+ | ||
+ function normalize(value) { | ||
+ return graphql.print(graphql.parse(value.replace('# normalize graphql', ''))); | ||
+ } | ||
+ | ||
+ assert.strictEqual(normalize(result.output), normalize(item.output), 'Output is incorrect.'); | ||
+ } else { | ||
+ assert.strictEqual(result.output, item.output, 'Output is incorrect.'); | ||
+ } | ||
} | ||
} else { | ||
assert.strictEqual( | ||
`.trimStart(); | ||
writeFileSync(resolve(process.cwd(), `patches/eslint+${version}.patch`), eslint7Patch, 'utf8'); | ||
|
||
const eslint8PatchFilename = readdirSync(resolve(process.cwd(), 'patches')).find(filename => | ||
filename.startsWith('eslint+8') | ||
); | ||
unlinkSync(resolve(process.cwd(), 'patches', eslint8PatchFilename)); | ||
} | ||
|
||
const pkgPath = resolve(process.cwd(), 'package.json'); | ||
const pkg = JSON.parse(readFileSync(pkgPath)); | ||
pkg.resolutions.eslint = `^${version}`; | ||
|
||
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), 'utf8'); | ||
} |
Oops, something went wrong.