Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support ESLint 8.x #882

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn

- name: Validate cache
Expand All @@ -36,9 +36,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -50,9 +50,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -67,14 +67,14 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
eslint-version: [5, 6, 7]
node-version: [12, 14, 16]
eslint-version: [6, 7, '^8.0.0-0']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.0
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand All @@ -84,11 +84,15 @@ jobs:
yarn add --dev eslint@${{ matrix.eslint-version }}
- name: run tests
# only collect coverage on eslint versions that support the suggestions api
run: yarn test --coverage ${{ matrix.eslint-version >= 6 }}
run:
yarn test --coverage ${{ matrix.eslint-version >= 6 ||
matrix.eslint-version = '^8.0.0-0' }}
env:
CI: true
- uses: codecov/[email protected]
if: ${{ matrix.eslint-version >= 6 }}
- uses: codecov/codecov-action@v2
if:
${{ matrix.eslint-version >= 6 || matrix.eslint-version = '^8.0.0-0'
}}
test-os:
name: Test on ${{ matrix.os }} using Node.js LTS
needs: prepare-yarn-cache
Expand All @@ -100,9 +104,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -117,9 +121,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -140,9 +144,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.0.1"
"@typescript-eslint/experimental-utils": "^5.0.0-0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
Expand All @@ -95,19 +95,19 @@
"@types/jest": "^27.0.0",
"@types/node": "^14.0.0",
"@types/prettier": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
"@typescript-eslint/parser": "^5.0.0-0",
"babel-jest": "^27.0.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"dedent": "^0.7.0",
"eslint": "^5.1.0 || ^6.0.0 || ^7.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint": "^5.1.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-config": "^2.0.0",
"eslint-plugin-eslint-plugin": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-eslint-plugin": "^2.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^6.0.0",
"is-ci": "^3.0.0",
"jest": "^27.0.0",
Expand All @@ -122,16 +122,16 @@
"typescript": "^4.0.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">= 4",
"eslint": ">=5"
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
"eslint": ">=6"
},
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
"optional": true
}
},
"engines": {
"node": ">=10"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"release": {
"branches": [
Expand Down
7 changes: 0 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ type RuleModule = TSESLint.RuleModule<string, unknown[]> & {
meta: Required<Pick<TSESLint.RuleMetaData<string>, 'docs'>>;
};

// can be removed once we've on v3: https://github.com/typescript-eslint/typescript-eslint/issues/2060
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
suggestion?: boolean;
}
}

// copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
/* istanbul ignore next */
const interopRequireDefault = (obj: any): { default: any } =>
Expand Down
1 change: 0 additions & 1 deletion src/rules/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const rule = createRule({
name: __filename,
meta: {
docs: {
category: 'Possible Errors',
description: 'Fake rule for testing AST guards',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/consistent-test-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Have control over `test` and `it` usages',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/expect-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Enforce assertion to be made in a test body',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/lowercase-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default createRule<
type: 'suggestion',
docs: {
description: 'Enforce lowercase test names',
category: 'Best Practices',
recommended: false,
},
fixable: 'code',
Expand Down
1 change: 0 additions & 1 deletion src/rules/max-nested-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Enforces a maximum depth to nested describe calls',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-alias-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow alias methods',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-commented-out-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow commented out tests',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-conditional-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default createRule({
meta: {
docs: {
description: 'Prevent calling `expect` conditionally',
category: 'Best Practices',
recommended: 'error',
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-deprecated-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow use of deprecated functions',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-disabled-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow disabled tests',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Avoid using a callback in asynchronous tests and hooks',
recommended: 'error',
suggestion: true,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-duplicate-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow duplicate setup and teardown hooks',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-expect-resolves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow expect.resolves',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow using `exports` in files containing tests',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-focused-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow focused tests',
recommended: 'error',
suggestion: true,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow setup and teardown hooks',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-identical-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow identical titles',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-if.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default createRule({
meta: {
docs: {
description: 'Disallow conditional logic',
category: 'Best Practices',
recommended: false,
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-interpolation-in-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow string interpolation inside snapshots',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-jasmine-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow Jasmine globals',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-jest-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule({
type: 'problem',
docs: {
description: 'Disallow importing Jest',
category: 'Best Practices',
recommended: 'error',
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export default createRule<[RuleOptions], MessageId>({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'disallow large snapshots',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-mocks-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default createRule({
meta: {
type: 'problem',
docs: {
category: 'Best Practices',
description: 'Disallow manually importing from `__mocks__`',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-restricted-matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow specific matchers & modifiers',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-standalone-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow using `expect` outside of `it` or `test` blocks',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-test-prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Use `.only` and `.skip` over `f` and `x`',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-test-return-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow explicitly returning from tests',
recommended: false,
},
Expand Down
Loading