Skip to content

Commit e894f51

Browse files
authored
fix: migrate to non-experimental ts-eslint utils (#1035)
`@typescript-eslint/experimental-utils` has been renamed to `@typescript-eslint/utils`. BREAKING CHANGE: Drop support for `@typescript-eslint/eslint-plugin@4`
1 parent 4449919 commit e894f51

File tree

87 files changed

+150
-229
lines changed

Some content is hidden

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

87 files changed

+150
-229
lines changed

.github/workflows/nodejs.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,13 @@ jobs:
6262
test-node:
6363
name:
6464
# prettier-ignore
65-
Test on Node.js v${{ matrix.node-version }}, eslint v${{ matrix.eslint-version }} and ts-eslint/plugin v${{ matrix.ts-eslint-plugin-version }}
65+
Test on Node.js v${{ matrix.node-version }}, eslint v${{ matrix.eslint-version }}
6666
needs: prepare-yarn-cache
6767
strategy:
6868
fail-fast: false
6969
matrix:
7070
node-version: [12.x, 14.x, 16.x]
7171
eslint-version: [6, 7, 8]
72-
ts-eslint-plugin-version: [4, 5]
73-
exclude:
74-
# ts-eslint/plugin@4 doesn't support eslint@8
75-
- eslint-version: 8
76-
ts-eslint-plugin-version: 4
7772
runs-on: ubuntu-latest
7873

7974
steps:
@@ -85,10 +80,10 @@ jobs:
8580
cache: yarn
8681
- name:
8782
# prettier-ignore
88-
install with eslint v${{ matrix.eslint-version }} and ts-eslint/plugin v${{ matrix.ts-eslint-plugin-version }}
83+
install with eslint v${{ matrix.eslint-version }}
8984
run: |
9085
yarn
91-
yarn add --dev eslint@${{ matrix.eslint-version }} @typescript-eslint/eslint-plugin@${{ matrix.ts-eslint-plugin-version }} @typescript-eslint/parser@${{ matrix.ts-eslint-plugin-version }}
86+
yarn add --dev eslint@${{ matrix.eslint-version }}
9287
- name: run tests
9388
run: yarn test --coverage
9489
env:

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
]
8383
},
8484
"dependencies": {
85-
"@typescript-eslint/experimental-utils": "^5.0.0"
85+
"@typescript-eslint/utils": "^5.10.0"
8686
},
8787
"devDependencies": {
8888
"@babel/cli": "^7.4.4",
@@ -127,7 +127,7 @@
127127
"typescript": "^4.4.0"
128128
},
129129
"peerDependencies": {
130-
"@typescript-eslint/eslint-plugin": "^4.0.0 || ^5.0.0",
130+
"@typescript-eslint/eslint-plugin": "^5.0.0",
131131
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
132132
},
133133
"peerDependenciesMeta": {

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readdirSync } from 'fs';
22
import { join, parse } from 'path';
3-
import { TSESLint } from '@typescript-eslint/experimental-utils';
3+
import { TSESLint } from '@typescript-eslint/utils';
44
import globals from './globals.json';
55
import * as snapshotProcessor from './processors/snapshot-processor';
66

@@ -9,7 +9,7 @@ type RuleModule = TSESLint.RuleModule<string, unknown[]> & {
99
};
1010

1111
// v5 of `@typescript-eslint/experimental-utils` removed this
12-
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
12+
declare module '@typescript-eslint/utils/dist/ts-eslint/Rule' {
1313
export interface RuleMetaDataDocs {
1414
category: 'Best Practices' | 'Possible Errors';
1515
}

src/rules/__tests__/consistent-test-it.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../consistent-test-it';
44
import { TestCaseName } from '../utils';

src/rules/__tests__/expect-expect.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AST_NODE_TYPES,
3-
TSESLint,
4-
} from '@typescript-eslint/experimental-utils';
1+
import { AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
52
import dedent from 'dedent';
63
import rule from '../expect-expect';
74
import { espreeParser } from './test-utils';

src/rules/__tests__/max-nested-describe.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../max-nested-describe';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-alias-methods.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-alias-methods';
33

44
const ruleTester = new TSESLint.RuleTester();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-commented-out-tests';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-conditional-expect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-conditional-expect';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-deprecated-functions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import { JestVersion, detectJestVersion } from '../detectJestVersion';
33
import rule from '../no-deprecated-functions';
44

src/rules/__tests__/no-disabled-tests.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-disabled-tests';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-done-callback.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-done-callback';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-duplicate-hooks.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-duplicate-hooks';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-export.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-export';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-focused-tests.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-focused-tests';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/no-hooks.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-hooks';
33
import { HookName } from '../utils';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-identical-title.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-identical-title';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-if.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-if';
44
import { espreeParser } from './test-utils';

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-interpolation-in-snapshots';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/no-jasmine-globals.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-jasmine-globals';
33

44
const ruleTester = new TSESLint.RuleTester();

src/rules/__tests__/no-jest-import.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-jest-import';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/no-large-snapshots.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-large-snapshots';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-mocks-import.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-mocks-import';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/no-restricted-matchers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-restricted-matchers';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/no-standalone-expect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-standalone-expect';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/no-test-prefixes.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../no-test-prefixes';
33

44
const ruleTester = new TSESLint.RuleTester();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../no-test-return-statement';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/prefer-called-with.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-called-with';
33

44
const ruleTester = new TSESLint.RuleTester();

src/rules/__tests__/prefer-comparison-matcher.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-comparison-matcher';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/prefer-equality-matcher.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-equality-matcher';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/prefer-expect-assertions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../prefer-expect-assertions';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/prefer-expect-resolves.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../prefer-expect-resolves';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/prefer-hooks-on-top.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../prefer-hooks-on-top';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/prefer-lowercase-title.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../prefer-lowercase-title';
44
import { DescribeAlias, TestCaseName } from '../utils';

src/rules/__tests__/prefer-spy-on.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AST_NODE_TYPES,
3-
TSESLint,
4-
} from '@typescript-eslint/experimental-utils';
1+
import { AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
52
import rule from '../prefer-spy-on';
63
import { espreeParser } from './test-utils';
74

src/rules/__tests__/prefer-strict-equal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-strict-equal';
33

44
const ruleTester = new TSESLint.RuleTester();

src/rules/__tests__/prefer-to-be.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-to-be';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/prefer-to-contain.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-to-contain';
33

44
const ruleTester = new TSESLint.RuleTester();

src/rules/__tests__/prefer-to-have-length.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import rule from '../prefer-to-have-length';
33
import { espreeParser } from './test-utils';
44

src/rules/__tests__/prefer-todo.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../prefer-todo';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/require-hook.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../require-hook';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/require-to-throw-message.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../require-to-throw-message';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/require-top-level-describe.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../require-top-level-describe';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/unbound-method.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path';
2-
import { ESLintUtils, TSESLint } from '@typescript-eslint/experimental-utils';
2+
import { ESLintUtils, TSESLint } from '@typescript-eslint/utils';
33
import dedent from 'dedent';
44
import type { MessageIds, Options } from '../unbound-method';
55

src/rules/__tests__/utils.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import {
33
createRule,
44
getNodeName,

src/rules/__tests__/valid-describe-callback.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../valid-describe-callback';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/valid-expect-in-promise.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../valid-expect-in-promise';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/valid-expect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../valid-expect';
44
import { espreeParser } from './test-utils';

src/rules/__tests__/valid-title.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESLint } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint } from '@typescript-eslint/utils';
22
import dedent from 'dedent';
33
import rule from '../valid-title';
44
import { espreeParser } from './test-utils';

src/rules/consistent-test-it.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
AST_NODE_TYPES,
3-
TSESLint,
4-
TSESTree,
5-
} from '@typescript-eslint/experimental-utils';
1+
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
62
import {
73
TestCaseName,
84
createRule,

src/rules/expect-expect.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
* MIT license, Remco Haszing.
44
*/
55

6-
import {
7-
AST_NODE_TYPES,
8-
TSESTree,
9-
} from '@typescript-eslint/experimental-utils';
6+
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
107
import {
118
createRule,
129
getNodeName,

src/rules/max-nested-describe.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AST_NODE_TYPES,
3-
TSESTree,
4-
} from '@typescript-eslint/experimental-utils';
1+
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
52
import { createRule, isDescribeCall } from './utils';
63

74
export default createRule({

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TSESTree } from '@typescript-eslint/experimental-utils';
1+
import { TSESTree } from '@typescript-eslint/utils';
22
import { createRule } from './utils';
33

44
function hasTests(node: TSESTree.Comment) {

src/rules/no-conditional-expect.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AST_NODE_TYPES,
3-
TSESTree,
4-
} from '@typescript-eslint/experimental-utils';
1+
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
52
import {
63
KnownCallExpression,
74
createRule,

0 commit comments

Comments
 (0)