diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 437c2d814..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,142 +0,0 @@ -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 - 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 - - save_cache: - key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Lint - command: npm run lint diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 136770fd9..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,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 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 diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 69c9647cf..6b37b041e 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` ::: @@ -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: diff --git a/lib/configs/base.js b/lib/configs/base.js index 068f4850a..60b9e5cff 100644 --- a/lib/configs/base.js +++ b/lib/configs/base.js @@ -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, plugins: ['vue'], rules: { 'vue/comment-directive': 'error', diff --git a/package.json b/package.json index d45381d37..c655254c5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tools/update-lib-configs.js b/tools/update-lib-configs.js index 239430d48..00b61b9a8 100644 --- a/tools/update-lib-configs.js +++ b/tools/update-lib-configs.js @@ -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' ],