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!: eslint@8 support #289

Merged
merged 4 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.11, 14, 16.8]
node-version: [12.22, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.11, 14, 16.8]
node-version: [12.22, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -87,7 +87,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.11, 14, 16.8]
node-version: [12.22, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -112,7 +112,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.11, 14, 16.8]
node-version: [12.22, 14, 16]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-config-airbnb.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
yarn add --dev eslint@7
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-config-airbnb.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-config-airbnb'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-core-ts.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-core-ts.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-core-ts'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-core.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-core.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-core'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-cypress.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-cypress.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-cypress'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-import.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-import.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-import'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-jest-dom.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-jest-dom.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-jest-dom'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-jest.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-jest.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-jest'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-jsx-a11y.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-jsx-a11y.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-jsx-a11y'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-mocha.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-mocha.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-mocha'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-next.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-next.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-next'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-node.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-node.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-node'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-react-hooks.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
yarn add --dev eslint@7
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-react-hooks.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-react-hooks'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-react-redux.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
yarn add --dev eslint@7
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-react-redux.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-react-redux'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-react.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-react.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-react'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-regexp.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-regexp.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-regexp'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-sonarjs.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-sonarjs.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-sonarjs'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-testing-library.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
yarn add --dev eslint@7
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-testing-library.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-testing-library'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-eslint-plugin-unicorn.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/eslint-plugin-unicorn.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: eslint-plugin-unicorn'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-typescript-eslint-eslint-plugin.yml
Expand Up @@ -43,10 +43,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
echo "Using ESLint v8"
yarn list | grep eslint
yarn log --config ./plugin-configs/typescript-eslint-eslint-plugin.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: typescript-eslint-eslint-plugin'
Expand Down
11 changes: 10 additions & 1 deletion ci/generate-workflows.js
Expand Up @@ -28,6 +28,14 @@ const WORKFLOW_BADGE = plugin =>
plugin
)})`;

// Plugins which do not yet support ESLint v8
const PLUGINGS_FOR_ESLINT_7 = [
'eslint-config-airbnb',
'eslint-plugin-react-hooks',
'eslint-plugin-react-redux',
'eslint-plugin-testing-library',
];

// prettier-ignore
const WORKFLOW_TEMPLATE = ({ plugin, index }) =>
`# This file is auto-generated. See ci/generate-workflows.js
Expand Down Expand Up @@ -75,10 +83,11 @@ jobs:
run: rm -rf ./node_modules
- run: |
yarn install
${PLUGINGS_FOR_ESLINT_7.includes(plugin) ? 'yarn add --dev eslint@7' : 'echo "Using ESLint v8"'}
yarn list | grep eslint
yarn log --config ./plugin-configs/${plugin}.config.js
working-directory: ./ci
- uses: AriPerkkio/eslint-remote-tester-run-action@v1
- uses: AriPerkkio/eslint-remote-tester-run-action@v2
with:
working-directory: ./ci
issue-title: 'Weekly scheduled smoke test: ${plugin}'
Expand Down
2 changes: 1 addition & 1 deletion ci/package.json
Expand Up @@ -13,7 +13,7 @@
"@next/eslint-plugin-next": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"eslint": "^7",
"eslint": "^8 || ^7",
"eslint-config-airbnb": "latest",
"eslint-plugin-cypress": "latest",
"eslint-plugin-import": "latest",
Expand Down
11 changes: 9 additions & 2 deletions lib/engine/worker-task.ts
Expand Up @@ -31,7 +31,8 @@ export type WorkerMessage =
| { type: 'DEBUG'; payload: any };

// Regex used to attempt parsing out rule which caused linter to crash
const RULE_REGEXP = /rules\/(.*?)\.js/;
const RULE_FROM_TRACE_REGEXP = /Rule: "(.*?)"/;
const RULE_FROM_PATH_REGEXP = /rules\/(.*?)\.js/;
const UNKNOWN_RULE_ID = 'unable-to-parse-rule-id';

// Regex used to attempt parsing out line which caused linter to crash
Expand Down Expand Up @@ -148,7 +149,13 @@ function parseErrorStack(error: Error, file: SourceFile): LintMessage {
const { path } = file;

const stack = error.stack || '';
const ruleMatch = stack.match(RULE_REGEXP) || [];
const ruleMatch =
// ESLint v8
stack.match(RULE_FROM_TRACE_REGEXP) ||
// Older ESLint versions
stack.match(RULE_FROM_PATH_REGEXP) ||
[];

const ruleId = ruleMatch.pop() || UNKNOWN_RULE_ID;

const lineMatch = stack.match(LINE_REGEX) || [];
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -54,15 +54,15 @@
"@types/node": "^15.0.0",
"@types/object-hash": "^2.1.0",
"@types/react": "^16.9.53",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.32.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-local-rules": "^1.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.25.2",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-remote-tester-repositories": "^0.0.2",
"husky": "^7.0.2",
Expand Down