Skip to content

Commit c80aa77

Browse files
committed
feat: support ESLint 8.x
1 parent 9b73aa5 commit c80aa77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+294
-228
lines changed

.github/workflows/nodejs.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v2
2020

21-
- uses: actions/setup-node@v2.4.0
21+
- uses: actions/setup-node@v2
2222
with:
23-
node-version: 14.x
23+
node-version: 16
2424
cache: yarn
2525

2626
- name: Validate cache
@@ -36,9 +36,9 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v2
39-
- uses: actions/setup-node@v2.4.0
39+
- uses: actions/setup-node@v2
4040
with:
41-
node-version: 14.x
41+
node-version: 16
4242
cache: yarn
4343
- name: install
4444
run: yarn
@@ -50,9 +50,9 @@ jobs:
5050
runs-on: ubuntu-latest
5151
steps:
5252
- uses: actions/checkout@v2
53-
- uses: actions/setup-node@v2.4.0
53+
- uses: actions/setup-node@v2
5454
with:
55-
node-version: 14.x
55+
node-version: 16
5656
cache: yarn
5757
- name: install
5858
run: yarn
@@ -67,14 +67,14 @@ jobs:
6767
strategy:
6868
fail-fast: false
6969
matrix:
70-
node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
71-
eslint-version: [5, 6, 7]
70+
node-version: [10, 12, 14, 16]
71+
eslint-version: [5, 6, 7, '^8.0.0-0']
7272
runs-on: ubuntu-latest
7373

7474
steps:
7575
- uses: actions/checkout@v2
7676
- name: Use Node.js ${{ matrix.node-version }}
77-
uses: actions/setup-node@v2.4.0
77+
uses: actions/setup-node@v2
7878
with:
7979
node-version: ${{ matrix.node-version }}
8080
cache: yarn
@@ -84,11 +84,11 @@ jobs:
8484
yarn add --dev eslint@${{ matrix.eslint-version }}
8585
- name: run tests
8686
# only collect coverage on eslint versions that support the suggestions api
87-
run: yarn test --coverage ${{ matrix.eslint-version >= 6 }}
87+
run: yarn test --coverage ${{ matrix.eslint-version >= 6 || matrix.eslint-version = '^8.0.0-0' }}
8888
env:
8989
CI: true
90-
- uses: codecov/codecov-action@v2.0.2
91-
if: ${{ matrix.eslint-version >= 6 }}
90+
- uses: codecov/codecov-action@v2
91+
if: ${{ matrix.eslint-version >= 6 || matrix.eslint-version = '^8.0.0-0' }}
9292
test-os:
9393
name: Test on ${{ matrix.os }} using Node.js LTS
9494
needs: prepare-yarn-cache
@@ -100,9 +100,9 @@ jobs:
100100

101101
steps:
102102
- uses: actions/checkout@v2
103-
- uses: actions/setup-node@v2.4.0
103+
- uses: actions/setup-node@v2
104104
with:
105-
node-version: 14.x
105+
node-version: 16
106106
cache: yarn
107107
- name: install
108108
run: yarn
@@ -117,9 +117,9 @@ jobs:
117117
runs-on: ubuntu-latest
118118
steps:
119119
- uses: actions/checkout@v2
120-
- uses: actions/setup-node@v2.4.0
120+
- uses: actions/setup-node@v2
121121
with:
122-
node-version: 14.x
122+
node-version: 16
123123
cache: yarn
124124
- name: install
125125
run: yarn
@@ -140,9 +140,9 @@ jobs:
140140
runs-on: ubuntu-latest
141141
steps:
142142
- uses: actions/checkout@v2
143-
- uses: actions/setup-node@v2.4.0
143+
- uses: actions/setup-node@v2
144144
with:
145-
node-version: 14.x
145+
node-version: 16
146146
cache: yarn
147147
- name: install
148148
run: yarn

package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
]
8080
},
8181
"dependencies": {
82-
"@typescript-eslint/experimental-utils": "^4.0.1"
82+
"@typescript-eslint/experimental-utils": "^5.0.0-0"
8383
},
8484
"devDependencies": {
8585
"@babel/cli": "^7.4.4",
@@ -95,19 +95,19 @@
9595
"@types/jest": "^27.0.0",
9696
"@types/node": "^14.0.0",
9797
"@types/prettier": "^2.0.0",
98-
"@typescript-eslint/eslint-plugin": "^4.0.1",
99-
"@typescript-eslint/parser": "^4.0.1",
98+
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
99+
"@typescript-eslint/parser": "^5.0.0-0",
100100
"babel-jest": "^27.0.0",
101101
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
102102
"dedent": "^0.7.0",
103-
"eslint": "^5.1.0 || ^6.0.0 || ^7.0.0",
104-
"eslint-config-prettier": "^6.5.0",
105-
"eslint-plugin-eslint-comments": "^3.1.2",
103+
"eslint": "^5.1.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0",
104+
"eslint-config-prettier": "^6.15.0",
105+
"eslint-plugin-eslint-comments": "^3.2.0",
106106
"eslint-plugin-eslint-config": "^2.0.0",
107-
"eslint-plugin-eslint-plugin": "^2.0.0",
108-
"eslint-plugin-import": "^2.20.2",
109-
"eslint-plugin-node": "^11.0.0",
110-
"eslint-plugin-prettier": "^3.0.0",
107+
"eslint-plugin-eslint-plugin": "^2.3.0",
108+
"eslint-plugin-import": "^2.24.2",
109+
"eslint-plugin-node": "^11.1.0",
110+
"eslint-plugin-prettier": "^3.4.1",
111111
"husky": "^6.0.0",
112112
"is-ci": "^3.0.0",
113113
"jest": "^27.0.0",
@@ -122,7 +122,7 @@
122122
"typescript": "^4.0.0"
123123
},
124124
"peerDependencies": {
125-
"@typescript-eslint/eslint-plugin": ">= 4",
125+
"@typescript-eslint/eslint-plugin": ">=4",
126126
"eslint": ">=5"
127127
},
128128
"peerDependenciesMeta": {

src/index.ts

-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ type RuleModule = TSESLint.RuleModule<string, unknown[]> & {
88
meta: Required<Pick<TSESLint.RuleMetaData<string>, 'docs'>>;
99
};
1010

11-
// can be removed once we've on v3: https://github.com/typescript-eslint/typescript-eslint/issues/2060
12-
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
13-
export interface RuleMetaDataDocs {
14-
suggestion?: boolean;
15-
}
16-
}
17-
1811
// copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
1912
/* istanbul ignore next */
2013
const interopRequireDefault = (obj: any): { default: any } =>

src/rules/__tests__/utils.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const rule = createRule({
1818
name: __filename,
1919
meta: {
2020
docs: {
21-
category: 'Possible Errors',
2221
description: 'Fake rule for testing AST guards',
2322
recommended: false,
2423
},

src/rules/consistent-test-it.ts

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default createRule<
3939
name: __filename,
4040
meta: {
4141
docs: {
42-
category: 'Best Practices',
4342
description: 'Have control over `test` and `it` usages',
4443
recommended: false,
4544
},

src/rules/expect-expect.ts

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export default createRule<
4747
name: __filename,
4848
meta: {
4949
docs: {
50-
category: 'Best Practices',
5150
description: 'Enforce assertion to be made in a test body',
5251
recommended: 'warn',
5352
},

src/rules/lowercase-name.ts

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export default createRule<
5151
type: 'suggestion',
5252
docs: {
5353
description: 'Enforce lowercase test names',
54-
category: 'Best Practices',
5554
recommended: false,
5655
},
5756
fixable: 'code',

src/rules/max-nested-describe.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export default createRule({
88
name: __filename,
99
meta: {
1010
docs: {
11-
category: 'Best Practices',
1211
description: 'Enforces a maximum depth to nested describe calls',
1312
recommended: false,
1413
},

src/rules/no-alias-methods.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default createRule({
44
name: __filename,
55
meta: {
66
docs: {
7-
category: 'Best Practices',
87
description: 'Disallow alias methods',
98
recommended: false,
109
},

src/rules/no-commented-out-tests.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default createRule({
1111
name: __filename,
1212
meta: {
1313
docs: {
14-
category: 'Best Practices',
1514
description: 'Disallow commented out tests',
1615
recommended: 'warn',
1716
},

src/rules/no-conditional-expect.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default createRule({
2222
meta: {
2323
docs: {
2424
description: 'Prevent calling `expect` conditionally',
25-
category: 'Best Practices',
2625
recommended: 'error',
2726
},
2827
messages: {

src/rules/no-deprecated-functions.ts

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export default createRule({
6565
name: __filename,
6666
meta: {
6767
docs: {
68-
category: 'Best Practices',
6968
description: 'Disallow use of deprecated functions',
7069
recommended: 'error',
7170
},

src/rules/no-disabled-tests.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default createRule({
44
name: __filename,
55
meta: {
66
docs: {
7-
category: 'Best Practices',
87
description: 'Disallow disabled tests',
98
recommended: 'warn',
109
},

src/rules/no-done-callback.ts

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default createRule({
3333
name: __filename,
3434
meta: {
3535
docs: {
36-
category: 'Best Practices',
3736
description: 'Avoid using a callback in asynchronous tests and hooks',
3837
recommended: 'error',
3938
suggestion: true,

src/rules/no-duplicate-hooks.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default createRule({
1111
name: __filename,
1212
meta: {
1313
docs: {
14-
category: 'Best Practices',
1514
description: 'Disallow duplicate setup and teardown hooks',
1615
recommended: false,
1716
},

src/rules/no-expect-resolves.ts

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default createRule({
99
name: __filename,
1010
meta: {
1111
docs: {
12-
category: 'Best Practices',
1312
description: 'Disallow expect.resolves',
1413
recommended: false,
1514
},

src/rules/no-export.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export default createRule({
88
name: __filename,
99
meta: {
1010
docs: {
11-
category: 'Best Practices',
1211
description: 'Disallow using `exports` in files containing tests',
1312
recommended: 'error',
1413
},

src/rules/no-focused-tests.ts

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export default createRule({
3838
name: __filename,
3939
meta: {
4040
docs: {
41-
category: 'Best Practices',
4241
description: 'Disallow focused tests',
4342
recommended: 'error',
4443
suggestion: true,

src/rules/no-hooks.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export default createRule<
77
name: __filename,
88
meta: {
99
docs: {
10-
category: 'Best Practices',
1110
description: 'Disallow setup and teardown hooks',
1211
recommended: false,
1312
},

src/rules/no-identical-title.ts

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default createRule({
2121
name: __filename,
2222
meta: {
2323
docs: {
24-
category: 'Best Practices',
2524
description: 'Disallow identical titles',
2625
recommended: 'error',
2726
},

src/rules/no-if.ts

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export default createRule({
4141
meta: {
4242
docs: {
4343
description: 'Disallow conditional logic',
44-
category: 'Best Practices',
4544
recommended: false,
4645
},
4746
messages: {

src/rules/no-interpolation-in-snapshots.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default createRule({
55
name: __filename,
66
meta: {
77
docs: {
8-
category: 'Best Practices',
98
description: 'Disallow string interpolation inside snapshots',
109
recommended: 'error',
1110
},

src/rules/no-jasmine-globals.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default createRule({
1010
name: __filename,
1111
meta: {
1212
docs: {
13-
category: 'Best Practices',
1413
description: 'Disallow Jasmine globals',
1514
recommended: 'error',
1615
},

src/rules/no-jest-import.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export default createRule({
77
type: 'problem',
88
docs: {
99
description: 'Disallow importing Jest',
10-
category: 'Best Practices',
1110
recommended: 'error',
1211
},
1312
messages: {

src/rules/no-large-snapshots.ts

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export default createRule<[RuleOptions], MessageId>({
7575
name: __filename,
7676
meta: {
7777
docs: {
78-
category: 'Best Practices',
7978
description: 'disallow large snapshots',
8079
recommended: false,
8180
},

src/rules/no-mocks-import.ts

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default createRule({
1717
meta: {
1818
type: 'problem',
1919
docs: {
20-
category: 'Best Practices',
2120
description: 'Disallow manually importing from `__mocks__`',
2221
recommended: 'error',
2322
},

src/rules/no-restricted-matchers.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export default createRule<
77
name: __filename,
88
meta: {
99
docs: {
10-
category: 'Best Practices',
1110
description: 'Disallow specific matchers & modifiers',
1211
recommended: false,
1312
},

src/rules/no-standalone-expect.ts

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export default createRule<
5555
name: __filename,
5656
meta: {
5757
docs: {
58-
category: 'Best Practices',
5958
description: 'Disallow using `expect` outside of `it` or `test` blocks',
6059
recommended: 'error',
6160
},

src/rules/no-test-prefixes.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default createRule({
1010
name: __filename,
1111
meta: {
1212
docs: {
13-
category: 'Best Practices',
1413
description: 'Use `.only` and `.skip` over `f` and `x`',
1514
recommended: 'error',
1615
},

src/rules/no-test-return-statement.ts

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export default createRule({
2727
name: __filename,
2828
meta: {
2929
docs: {
30-
category: 'Best Practices',
3130
description: 'Disallow explicitly returning from tests',
3231
recommended: false,
3332
},

src/rules/no-truthy-falsy.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default createRule({
55
name: __filename,
66
meta: {
77
docs: {
8-
category: 'Best Practices',
98
description: 'Disallow using `toBeTruthy()` & `toBeFalsy()`',
109
recommended: false,
1110
},

src/rules/no-try-expect.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default createRule({
1111
meta: {
1212
docs: {
1313
description: 'Prefer using toThrow for exception tests',
14-
category: 'Best Practices',
1514
recommended: 'error',
1615
},
1716
deprecated: true,

0 commit comments

Comments
 (0)