From 03182a311e57a16e16a58f51a65b9b0b1d57682b Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 08:34:03 +0900 Subject: [PATCH 01/11] Drop support old eslint and node --- .circleci/config.yml | 117 +-------------------------------------- .github/workflows/CI.yml | 37 +++---------- docs/user-guide/index.md | 4 +- package.json | 4 +- 4 files changed, 15 insertions(+), 147 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 437c2d814..f53391abf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,126 +2,13 @@ workflows: version: 2 node-multi-build: jobs: - - eslint-v6 - - eslint-v7 - - ts-eslint-v4 - - node-v14 - - node-v16 - lint version: 2 jobs: - node-base: &node-base - docker: - - image: node - steps: - - run: - name: Versions - command: npm version - - checkout - # - restore_cache: - # keys: - # - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - - run: - name: Install dependencies - command: npm install --legacy-peer-deps - - run: - name: Test - command: npm test - # - save_cache: - # key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - # paths: - # - node_modules - - eslint-v6: - docker: - - image: node:14 - steps: - - run: - name: Versions - command: npm version - - checkout - - run: - name: Uninstall @stylistic/eslint-plugin - command: npm uninstall -D @stylistic/eslint-plugin - - run: - name: Install eslint@6 - command: | - npm install --save-exact eslint@6.8.0 @typescript-eslint/parser@5 - - run: - name: Install dependencies - command: npm install - - run: - name: Test - command: npm test - eslint-v7: - docker: - - image: node:14 - steps: - - run: - name: Versions - command: npm version - - checkout - - run: - name: Uninstall @stylistic/eslint-plugin - command: npm uninstall -D @stylistic/eslint-plugin - - run: - name: Install eslint@7 - command: | - npm install eslint@7 @typescript-eslint/parser@5 - - run: - name: Install dependencies - command: npm install - - run: - name: Test - command: npm test - ts-eslint-v4: - docker: - - image: node:14 - steps: - - run: - name: Versions - command: npm version - - checkout - - run: - name: Uninstall @stylistic/eslint-plugin - command: npm uninstall -D @stylistic/eslint-plugin - - run: - name: Install @typescript-eslint/parser@4 eslint@7 typescript@4.7 - command: | - npm install @typescript-eslint/parser@4 eslint@7 typescript@4.7 --save-exact - - run: - name: Install dependencies - command: npm install - - run: - name: Test - command: npm test - node-v14: - docker: - - image: node:14 - steps: - - run: - name: Versions - command: npm version - - checkout - - run: - name: Install @typescript-eslint/parser@5 - command: | - npm install @typescript-eslint/parser@5 --save-exact - - run: - name: Install dependencies - command: npm install - - run: - name: Test - command: npm test - node-v16: - <<: *node-base - docker: - - image: node:16 - lint: docker: - - image: node:16 + - image: node:latest steps: - run: name: Versions @@ -132,7 +19,7 @@ jobs: - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - run: name: Install dependencies - command: npm install + command: npm install -f - save_cache: key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} paths: diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 136770fd9..2703ffed3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,11 +30,11 @@ jobs: name: Test strategy: matrix: - node: [18, 20] - eslint: [8, 9] + node: [18, 20, 21] + eslint: [9] include: - # On old Node version - - node: 17 + # On old ESLint version + - node: 18 eslint: 8 runs-on: ubuntu-latest @@ -46,31 +46,14 @@ jobs: with: node-version: ${{ matrix.node }} - name: Install Packages - run: npm install --legacy-peer-deps + run: npm install -f - name: Install ESLint v${{ matrix.eslint }} - run: npm install --save-dev eslint@${{ matrix.eslint }} --legacy-peer-deps - - name: Test - run: npm test - - test-for-ts-eslint-v5: - name: Test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Packages - run: npm install --legacy-peer-deps - - name: Install typescript-eslint v5 - run: npm install -D @typescript-eslint/parser + run: npm install --save-dev eslint@${{ matrix.eslint }} -f - name: Test run: npm test - test-for-eslint-v8-without-eslint-stylistic: - name: Test + test-without-eslint-stylistic: + name: Test without ESLint Stylistic runs-on: ubuntu-latest steps: - name: Checkout @@ -78,10 +61,8 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 - name: Install Packages - run: npm install --legacy-peer-deps + run: npm install -f - name: Uninstall @stylistic/eslint-plugin run: npm uninstall -D @stylistic/eslint-plugin - - name: Install eslint v8 - run: npm install -D eslint@8 - name: Test run: npm test diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 69c9647cf..a148be20c 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -16,8 +16,8 @@ yarn add -D eslint eslint-plugin-vue ::: tip Requirements -- ESLint v6.2.0 and above -- Node.js v14.17.x, v16.x and above +- ESLint: `^8.57.0 || ^9.0.0` +- Node.js: `^18.18.0 || ^20.9.0 || >=21.1.0` ::: diff --git a/package.json b/package.json index d45381d37..eebe85fbb 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,10 @@ "url": "https://github.com/vuejs/eslint-plugin-vue/issues" }, "engines": { - "node": "^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "peerDependencies": { - "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "eslint": "^8.57.0 || ^9.0.0", "vue-eslint-parser": "^9.4.3" }, "dependencies": { From ee14952fe0f40f0c21e4f10bdcf0410815cafd8c Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 08:39:20 +0900 Subject: [PATCH 02/11] use node:lts --- .circleci/config.yml | 2 +- .github/workflows/CI.yml | 14 +++++++------- .github/workflows/check-for-resources-update.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f53391abf..83a3ea78a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ version: 2 jobs: lint: docker: - - image: node:latest + - image: node:lts steps: - run: name: Versions diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2703ffed3..57aa5876d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,9 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 - name: Install Packages run: npm install --legacy-peer-deps - name: Lint @@ -30,7 +30,7 @@ jobs: name: Test strategy: matrix: - node: [18, 20, 21] + node: [18, 20, 21, 'lts/*'] eslint: [9] include: # On old ESLint version @@ -40,9 +40,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js v${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Install Packages @@ -57,9 +57,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 - name: Install Packages run: npm install -f - name: Uninstall @stylistic/eslint-plugin diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml index a9b2460e8..613125fc3 100644 --- a/.github/workflows/check-for-resources-update.yml +++ b/.github/workflows/check-for-resources-update.yml @@ -13,9 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install Packages From 26ce3aa4d8c6a2b1ec95324d974359fad01e2fc2 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 08:43:16 +0900 Subject: [PATCH 03/11] use ecmaVersion: 'latest' --- lib/configs/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/configs/base.js b/lib/configs/base.js index 068f4850a..b9d2a7b09 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -5,7 +5,7 @@ */ module.exports = { parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 'latest', sourceType: 'module' }, env: { From 81dc30de6c67f90e601cb43ed52c3398f2dbdda2 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 08:44:00 +0900 Subject: [PATCH 04/11] update doc --- docs/user-guide/index.md | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index a148be20c..413cc10cf 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -479,40 +479,6 @@ You need to use [vue-eslint-parser] v9.0.0 or later. Previously you had to use the `vue/setup-compiler-macros` environment, this is no longer needed. -#### Parsing error with Top Level `await` - -##### Using ESLint <= v7.x - -The parser `espree` that comes with `ESLint` v7.x doesn't understand the syntax of ES2022, so it can't parse the Top Level `await` either. -However, `espree` >= v8 can understand the syntax of ES2022 and parse the Top Level `await`. -You install `espree` >= v8 and specify `"espree"` and ES2022 in your configuration, the parser will be able to parse it. - -```js -module.exports = { - parser: 'vue-eslint-parser', - parserOptions: { - parser: 'espree', // <- - ecmaVersion: 2022, // <- - sourceType: 'module' - }, -} -``` - -However, note that the AST generated by `espree` v8+ may not work well with some rules of `ESLint` v7.x. - -##### Using ESLint >= v8.x - -You need to specify `2022` or `"latest"` for `parserOptions.ecmaVersion`. - -```js -module.exports = { - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module' - }, -} -``` - #### Other Problems Try searching for existing issues. From 973181ff06c334ea0c4d2fe2060317ced4669fce Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 08:44:21 +0900 Subject: [PATCH 05/11] update doc --- docs/user-guide/index.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 413cc10cf..6b37b041e 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -479,13 +479,6 @@ You need to use [vue-eslint-parser] v9.0.0 or later. Previously you had to use the `vue/setup-compiler-macros` environment, this is no longer needed. -#### Other Problems - -Try searching for existing issues. -If it does not exist, you should open a new issue and share your repository to reproduce the issue. - -[vue-eslint-parser]: https://github.com/vuejs/vue-eslint-parser - ### Auto Imports Support In [Nuxt 3](https://nuxt.com/) or with [`unplugin-auto-import`](https://github.com/unplugin/unplugin-auto-import), Vue APIs can be auto imported. To make rules like [`vue/no-ref-as-operand`](/rules/no-ref-as-operand.html) or [`vue/no-watch-after-await`](/rules/no-watch-after-await.html) work correctly with them, you can specify them in ESLint's [`globals`](https://eslint.org/docs/latest/use/configure/configuration-files-new#configuring-global-variables) options: From 21da65eb08431a38f0bd0e6f1bab2dead4a1c416 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 19:48:56 +0900 Subject: [PATCH 06/11] remove circleci config --- .circleci/config.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 83a3ea78a..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,29 +0,0 @@ -workflows: - version: 2 - node-multi-build: - jobs: - - lint - -version: 2 -jobs: - lint: - docker: - - image: node:lts - steps: - - run: - name: Versions - command: npm version - - checkout - - restore_cache: - keys: - - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - - run: - name: Install dependencies - command: npm install -f - - save_cache: - key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Lint - command: npm run lint From 243d65a2497c73ad69dbd0a3b1a2af60c6a0f94a Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 19:50:04 +0900 Subject: [PATCH 07/11] revert update script --- lib/configs/base.js | 11 +++-------- tools/update-lib-configs.js | 9 ++------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/configs/base.js b/lib/configs/base.js index b9d2a7b09..3724461e2 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -4,8 +4,9 @@ * in order to update its content execute "npm run update" */ module.exports = { + parser: require.resolve('vue-eslint-parser'), parserOptions: { - ecmaVersion: 'latest', + ecmaVersion: 2020, sourceType: 'module' }, env: { @@ -16,11 +17,5 @@ module.exports = { rules: { 'vue/comment-directive': 'error', 'vue/jsx-uses-vars': 'error' - }, - overrides: [ - { - files: '*.vue', - parser: require.resolve('vue-eslint-parser') - } - ] + } } diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index 239430d48..e3f7f963a 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -56,6 +56,7 @@ function formatCategory(category) { * in order to update its content execute "npm run update" */ module.exports = { + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 2020, sourceType: 'module' @@ -67,13 +68,7 @@ module.exports = { plugins: [ 'vue' ], - rules: ${formatRules(category.rules, category.categoryId)}, - overrides: [ - { - files: '*.vue', - parser: require.resolve('vue-eslint-parser') - } - ] + rules: ${formatRules(category.rules, category.categoryId)} } ` } From e9e1133510737e91d9a58ba9541afb7eb2a9602d Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 19:56:48 +0900 Subject: [PATCH 08/11] fix config --- lib/configs/base.js | 2 +- tools/update-lib-configs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/configs/base.js b/lib/configs/base.js index 3724461e2..cafdbbfb8 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -6,7 +6,7 @@ module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 'latest', sourceType: 'module' }, env: { diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index e3f7f963a..d30a4a211 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -58,7 +58,7 @@ function formatCategory(category) { module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { - ecmaVersion: 2020, + ecmaVersion: "latest", sourceType: 'module' }, env: { From ee386c684f3c966e5df2098672767ff6f1a9886e Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 29 Jan 2025 20:42:10 +0900 Subject: [PATCH 09/11] Update tools/update-lib-configs.js Co-authored-by: Flo Edelmann --- tools/update-lib-configs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index d30a4a211..473baf877 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -58,7 +58,7 @@ function formatCategory(category) { module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { - ecmaVersion: "latest", + ecmaVersion: 'latest', sourceType: 'module' }, env: { From 4496000e62a6febf8134885bc5caf15f0392d629 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 21:06:13 +0900 Subject: [PATCH 10/11] update config --- lib/configs/base.js | 6 ++---- package.json | 2 +- tools/update-lib-configs.js | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/configs/base.js b/lib/configs/base.js index cafdbbfb8..522d46495 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -3,16 +3,14 @@ * This file has been automatically generated, * in order to update its content execute "npm run update" */ +const globals = require('globals') module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, - env: { - browser: true, - es6: true - }, + globals: globals.browser, plugins: ['vue'], rules: { 'vue/comment-directive': 'error', diff --git a/package.json b/package.json index eebe85fbb..c655254c5 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ }, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "globals": "^13.24.0", + "globals": "^15.14.0", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", "postcss-selector-parser": "^6.0.15", diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index 473baf877..1843b6f01 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -55,16 +55,14 @@ function formatCategory(category) { * This file has been automatically generated, * in order to update its content execute "npm run update" */ +const globals = require('globals') module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, - env: { - browser: true, - es6: true - }, + globals: globals.browser, plugins: [ 'vue' ], From ea4c6733763c20de4192dd9be4f6feb9e4af69a4 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 30 Jan 2025 13:35:04 +0900 Subject: [PATCH 11/11] revert config --- lib/configs/base.js | 9 +++++++-- tools/update-lib-configs.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/configs/base.js b/lib/configs/base.js index 522d46495..60b9e5cff 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -5,7 +5,6 @@ */ const globals = require('globals') module.exports = { - parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 'latest', sourceType: 'module' @@ -15,5 +14,11 @@ module.exports = { rules: { 'vue/comment-directive': 'error', 'vue/jsx-uses-vars': 'error' - } + }, + overrides: [ + { + files: '*.vue', + parser: require.resolve('vue-eslint-parser') + } + ] } diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index 1843b6f01..00b61b9a8 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -57,7 +57,6 @@ function formatCategory(category) { */ const globals = require('globals') module.exports = { - parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 'latest', sourceType: 'module' @@ -66,7 +65,13 @@ module.exports = { plugins: [ 'vue' ], - rules: ${formatRules(category.rules, category.categoryId)} + rules: ${formatRules(category.rules, category.categoryId)}, + overrides: [ + { + files: '*.vue', + parser: require.resolve('vue-eslint-parser') + } + ] } ` }