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

Drop support for old versions of ESLint and Node.js #2669

Merged
merged 11 commits into from
Jan 30, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 0 additions & 142 deletions .circleci/config.yml

This file was deleted.

49 changes: 15 additions & 34 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,58 +30,39 @@ jobs:
name: Test
strategy:
matrix:
node: [18, 20]
eslint: [8, 9]
node: [18, 20, 21, 'lts/*']
eslint: [9]
include:
# On old Node version
- node: 17
# On old ESLint version
- node: 18
eslint: 8

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
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
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
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
4 changes: 2 additions & 2 deletions .github/workflows/check-for-resources-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 2 additions & 43 deletions docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

:::

Expand Down Expand Up @@ -479,47 +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.
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:
Expand Down
8 changes: 3 additions & 5 deletions lib/configs/base.js
FloEdelmann marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
* This file has been automatically generated,
* in order to update its content execute "npm run update"
*/
const globals = require('globals')
module.exports = {
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 'latest',
sourceType: 'module'
},
env: {
browser: true,
es6: true
},
globals: globals.browser,
FloEdelmann marked this conversation as resolved.
Show resolved Hide resolved
plugins: ['vue'],
rules: {
'vue/comment-directive': 'error',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
"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": {
"@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",
Expand Down
8 changes: 3 additions & 5 deletions tools/update-lib-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ 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 = {
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 'latest',
sourceType: 'module'
},
env: {
browser: true,
es6: true
},
globals: globals.browser,
plugins: [
'vue'
],
Expand Down
Loading