Skip to content

Commit ed6644b

Browse files
author
Dimitri POSTOLOV
authored
🎱 feat: support ESLint 8 (#683)
1 parent c7a8b33 commit ed6644b

File tree

13 files changed

+207
-163
lines changed

13 files changed

+207
-163
lines changed

.changeset/small-buses-wonder.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': minor
3+
---
4+
5+
feat: support ESLint 8

.github/workflows/tests.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ jobs:
6464
path: packages/plugin/dist
6565

6666
test:
67-
name: Testing on Node ${{matrix.node_version}}
67+
name: Testing on Node ${{matrix.node_version}} with ESLint v${{matrix.eslint_version}}
6868
timeout-minutes: 60
6969
runs-on: ubuntu-latest
7070
needs: [lint, typecheck]
7171
strategy:
7272
matrix:
7373
node_version: [12, 16]
74+
eslint_version: [7.32.0, 8]
7475
steps:
7576
- name: Checkout Master
7677
uses: actions/checkout@v2
@@ -84,20 +85,22 @@ jobs:
8485
uses: actions/cache@v2
8586
with:
8687
path: '**/node_modules'
87-
key: ${{ runner.os }}-${{matrix.node_version}}-node-modules-${{ hashFiles('yarn.lock') }}
88+
key: ${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-node-modules-${{hashFiles('yarn.lock')}}
8889
restore-keys: |
89-
${{ runner.os }}-${{matrix.node_version}}-node-modules-${{ hashFiles('yarn.lock') }}
90-
${{ runner.os }}-${{matrix.node_version}}-node-modules-
90+
${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-node-modules-${{hashFiles('yarn.lock')}}
91+
${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-node-modules-
92+
- name: Use ESLint v${{matrix.eslint_version}}
93+
run: node scripts/match-eslint.mjs ${{matrix.eslint_version}}
9194
- name: Install Dependencies using Yarn
9295
run: yarn install && git checkout yarn.lock
9396
- name: Cache Jest
9497
uses: actions/cache@v2
9598
with:
9699
path: .cache/jest
97-
key: ${{ runner.os }}-${{matrix.node_version}}-jest-${{ hashFiles('yarn.lock') }}
100+
key: ${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-jest-${{hashFiles('yarn.lock')}}
98101
restore-keys: |
99-
${{ runner.os }}-${{matrix.node_version}}-jest-${{ hashFiles('yarn.lock') }}
100-
${{ runner.os }}-${{matrix.node_version}}-jest-
102+
${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-jest-${{hashFiles('yarn.lock')}}
103+
${{runner.os}}-${{matrix.node_version}}-${{matrix.eslint_version}}-jest-
101104
# We need build for examples.spec.ts test
102105
# Otherwise we'll get error - Cannot find module 'node_modules/@graphql-eslint/eslint-plugin/dist/index.js'
103106
- name: Download build artifact

examples/basic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"graphql": "15.5.3"
1313
},
1414
"devDependencies": {
15-
"eslint": "7.32.0",
16-
"@graphql-eslint/eslint-plugin": "2.2.0"
15+
"@graphql-eslint/eslint-plugin": "2.2.0",
16+
"eslint": "8.0.0"
1717
}
1818
}

examples/code-file/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"graphql": "15.5.3"
1313
},
1414
"devDependencies": {
15-
"eslint": "7.32.0",
16-
"@graphql-eslint/eslint-plugin": "2.2.0"
15+
"@graphql-eslint/eslint-plugin": "2.2.0",
16+
"eslint": "8.0.0"
1717
}
1818
}

examples/graphql-config-code-file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
},
1515
"devDependencies": {
1616
"@graphql-eslint/eslint-plugin": "2.2.0",
17-
"eslint": "7.32.0"
17+
"eslint": "8.0.0"
1818
}
1919
}

examples/graphql-config/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"graphql": "15.5.3"
1313
},
1414
"devDependencies": {
15-
"eslint": "7.32.0",
16-
"@graphql-eslint/eslint-plugin": "2.2.0"
15+
"@graphql-eslint/eslint-plugin": "2.2.0",
16+
"eslint": "8.0.0"
1717
}
1818
}

examples/prettier/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"graphql": "15.5.3"
1313
},
1414
"devDependencies": {
15-
"eslint": "7.32.0",
15+
"@graphql-eslint/eslint-plugin": "2.2.0",
16+
"eslint": "8.0.0",
1617
"eslint-config-prettier": "8.3.0",
1718
"eslint-plugin-prettier": "4.0.0",
18-
"@graphql-eslint/eslint-plugin": "2.2.0",
1919
"prettier": "2.4.1"
2020
}
2121
}

jest.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ const { compilerOptions } = require('./tsconfig.json');
33

44
module.exports = {
55
testEnvironment: 'node',
6-
modulePathIgnorePatterns: ["/dist/"],
7-
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
8-
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' })
9-
};
6+
modulePathIgnorePatterns: ['/dist/'],
7+
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
8+
moduleNameMapper: {
9+
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
10+
'@eslint/eslintrc/universal': '@eslint/eslintrc/dist/eslintrc-universal.cjs',
11+
},
12+
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
"@types/dedent": "0.7.0",
3131
"@types/jest": "27.0.2",
3232
"@types/node": "14.17.27",
33-
"@typescript-eslint/eslint-plugin": "4.33.0",
34-
"@typescript-eslint/parser": "4.33.0",
33+
"@typescript-eslint/eslint-plugin": "5.0.0",
34+
"@typescript-eslint/parser": "5.0.0",
3535
"bob-the-bundler": "1.5.1",
3636
"dedent": "0.7.0",
37-
"eslint": "7.32.0",
37+
"eslint": "8.0.0",
3838
"eslint-config-prettier": "8.3.0",
3939
"eslint-config-standard": "16.0.3",
4040
"eslint-plugin-eslint-plugin": "3.6.1",

packages/plugin/src/estree-parser/estree-ast.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type SafeGraphQLType<T extends ASTNode | ValueNode> = Omit<
66
'loc'
77
>;
88

9-
export type SingleESTreeNode<T extends any, WithTypeInfo extends boolean> = T extends ASTNode | ValueNode
9+
export type SingleESTreeNode<T, WithTypeInfo extends boolean> = T extends ASTNode | ValueNode
1010
? SafeGraphQLType<T> &
1111
Pick<BaseNode, 'leadingComments' | 'loc' | 'range'> & {
1212
type: T['kind'];
@@ -28,7 +28,7 @@ export type SingleESTreeNode<T extends any, WithTypeInfo extends boolean> = T ex
2828
: {})
2929
: T;
3030

31-
export type GraphQLESTreeNode<T extends any, WithTypeInfo extends boolean = false> = T extends ASTNode | ValueNode
31+
export type GraphQLESTreeNode<T, WithTypeInfo extends boolean = false> = T extends ASTNode | ValueNode
3232
? { rawNode: () => T } & {
3333
[K in keyof SingleESTreeNode<T, WithTypeInfo>]: SingleESTreeNode<T, WithTypeInfo>[K] extends ReadonlyArray<
3434
infer Nested

0 commit comments

Comments
 (0)