Skip to content

Commit

Permalink
fix: migrate to non-experimental ts-eslint utils (#1035)
Browse files Browse the repository at this point in the history
`@typescript-eslint/experimental-utils` has been renamed to `@typescript-eslint/utils`.

BREAKING CHANGE: Drop support for `@typescript-eslint/eslint-plugin@4`
  • Loading branch information
SimenB committed Jan 24, 2022
1 parent 4449919 commit e894f51
Show file tree
Hide file tree
Showing 87 changed files with 150 additions and 229 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/nodejs.yml
Expand Up @@ -62,18 +62,13 @@ jobs:
test-node:
name:
# prettier-ignore
Test on Node.js v${{ matrix.node-version }}, eslint v${{ matrix.eslint-version }} and ts-eslint/plugin v${{ matrix.ts-eslint-plugin-version }}
Test on Node.js v${{ matrix.node-version }}, eslint v${{ matrix.eslint-version }}
needs: prepare-yarn-cache
strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x]
eslint-version: [6, 7, 8]
ts-eslint-plugin-version: [4, 5]
exclude:
# ts-eslint/plugin@4 doesn't support eslint@8
- eslint-version: 8
ts-eslint-plugin-version: 4
runs-on: ubuntu-latest

steps:
Expand All @@ -85,10 +80,10 @@ jobs:
cache: yarn
- name:
# prettier-ignore
install with eslint v${{ matrix.eslint-version }} and ts-eslint/plugin v${{ matrix.ts-eslint-plugin-version }}
install with eslint v${{ matrix.eslint-version }}
run: |
yarn
yarn add --dev eslint@${{ matrix.eslint-version }} @typescript-eslint/eslint-plugin@${{ matrix.ts-eslint-plugin-version }} @typescript-eslint/parser@${{ matrix.ts-eslint-plugin-version }}
yarn add --dev eslint@${{ matrix.eslint-version }}
- name: run tests
run: yarn test --coverage
env:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -82,7 +82,7 @@
]
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^5.0.0"
"@typescript-eslint/utils": "^5.10.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
Expand Down Expand Up @@ -127,7 +127,7 @@
"typescript": "^4.4.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.0.0 || ^5.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
@@ -1,6 +1,6 @@
import { readdirSync } from 'fs';
import { join, parse } from 'path';
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import globals from './globals.json';
import * as snapshotProcessor from './processors/snapshot-processor';

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

// v5 of `@typescript-eslint/experimental-utils` removed this
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
declare module '@typescript-eslint/utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
category: 'Best Practices' | 'Possible Errors';
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/consistent-test-it.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../consistent-test-it';
import { TestCaseName } from '../utils';
Expand Down
5 changes: 1 addition & 4 deletions src/rules/__tests__/expect-expect.test.ts
@@ -1,7 +1,4 @@
import {
AST_NODE_TYPES,
TSESLint,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../expect-expect';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/max-nested-describe.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../max-nested-describe';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-alias-methods.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-alias-methods';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-commented-out-tests.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-commented-out-tests';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-conditional-expect.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-conditional-expect';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-deprecated-functions.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import { JestVersion, detectJestVersion } from '../detectJestVersion';
import rule from '../no-deprecated-functions';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-disabled-tests.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-disabled-tests';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-done-callback.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-done-callback';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-duplicate-hooks.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-duplicate-hooks';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-export.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-export';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-focused-tests.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-focused-tests';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-hooks.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-hooks';
import { HookName } from '../utils';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-identical-title.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-identical-title';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-if.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-if';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-interpolation-in-snapshots.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-interpolation-in-snapshots';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-jasmine-globals.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-jasmine-globals';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-jest-import.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-jest-import';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-large-snapshots.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-large-snapshots';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-mocks-import.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-mocks-import';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-restricted-matchers.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-restricted-matchers';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-standalone-expect.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-standalone-expect';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-test-prefixes.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-test-prefixes';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/no-test-return-statement.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../no-test-return-statement';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-called-with.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-called-with';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-comparison-matcher.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-comparison-matcher';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-equality-matcher.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-equality-matcher';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-expect-assertions.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../prefer-expect-assertions';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-expect-resolves.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../prefer-expect-resolves';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-hooks-on-top.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../prefer-hooks-on-top';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-lowercase-title.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../prefer-lowercase-title';
import { DescribeAlias, TestCaseName } from '../utils';
Expand Down
5 changes: 1 addition & 4 deletions src/rules/__tests__/prefer-spy-on.test.ts
@@ -1,7 +1,4 @@
import {
AST_NODE_TYPES,
TSESLint,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-spy-on';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-strict-equal.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-strict-equal';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-to-be.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-to-be';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-to-contain.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-to-contain';

const ruleTester = new TSESLint.RuleTester();
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-to-have-length.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../prefer-to-have-length';
import { espreeParser } from './test-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/prefer-todo.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../prefer-todo';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/require-hook.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../require-hook';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/require-to-throw-message.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../require-to-throw-message';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/require-top-level-describe.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../require-top-level-describe';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/unbound-method.test.ts
@@ -1,5 +1,5 @@
import path from 'path';
import { ESLintUtils, TSESLint } from '@typescript-eslint/experimental-utils';
import { ESLintUtils, TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import type { MessageIds, Options } from '../unbound-method';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/utils.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import {
createRule,
getNodeName,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/valid-describe-callback.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../valid-describe-callback';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/valid-expect-in-promise.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../valid-expect-in-promise';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/valid-expect.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../valid-expect';
import { espreeParser } from './test-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/valid-title.test.ts
@@ -1,4 +1,4 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import rule from '../valid-title';
import { espreeParser } from './test-utils';
Expand Down
6 changes: 1 addition & 5 deletions src/rules/consistent-test-it.ts
@@ -1,8 +1,4 @@
import {
AST_NODE_TYPES,
TSESLint,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
TestCaseName,
createRule,
Expand Down
5 changes: 1 addition & 4 deletions src/rules/expect-expect.ts
Expand Up @@ -3,10 +3,7 @@
* MIT license, Remco Haszing.
*/

import {
AST_NODE_TYPES,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import {
createRule,
getNodeName,
Expand Down
5 changes: 1 addition & 4 deletions src/rules/max-nested-describe.ts
@@ -1,7 +1,4 @@
import {
AST_NODE_TYPES,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { createRule, isDescribeCall } from './utils';

export default createRule({
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-commented-out-tests.ts
@@ -1,4 +1,4 @@
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { TSESTree } from '@typescript-eslint/utils';
import { createRule } from './utils';

function hasTests(node: TSESTree.Comment) {
Expand Down
5 changes: 1 addition & 4 deletions src/rules/no-conditional-expect.ts
@@ -1,7 +1,4 @@
import {
AST_NODE_TYPES,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import {
KnownCallExpression,
createRule,
Expand Down

0 comments on commit e894f51

Please sign in to comment.