From b9021c9d521ff359e8e030f205c0c890e3ac6d42 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 31 Jul 2025 09:58:36 +0200 Subject: [PATCH 1/8] Split ESLint v8 into separate test job --- .github/workflows/CI.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90bd33ad5..2326fcc44 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,12 +31,6 @@ jobs: strategy: matrix: node: [18, 20, 21, 'lts/*'] - eslint: [9] - include: - # On old ESLint version - - node: 18 - eslint: 8 - runs-on: ubuntu-latest steps: - name: Checkout @@ -47,8 +41,23 @@ jobs: node-version: ${{ matrix.node }} - name: Install Packages run: npm install - - name: Install ESLint v${{ matrix.eslint }} - run: npm install --save-dev eslint@${{ matrix.eslint }} -f + - name: Test + run: npm test + + test-with-eslint-v8: + name: Test with ESLint v8 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node.js v18 + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Packages + run: npm install + - name: Install ESLint v8 + run: npm install --save-dev eslint@8 --force - name: Test run: npm test From 2324ad2a6ab7a85cfaf5c95cbb3daeb12982e0e4 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 31 Jul 2025 09:59:31 +0200 Subject: [PATCH 2/8] Add test job for old ESLint Stylistic versions --- .github/workflows/CI.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2326fcc44..fede1a47a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -72,7 +72,25 @@ jobs: - name: Install Packages run: npm install - name: Uninstall @stylistic/eslint-plugin - run: npm uninstall -D @stylistic/eslint-plugin + run: npm uninstall @stylistic/eslint-plugin + - name: Test + run: npm test + + test-with-old-eslint-stylistic: + name: Test with old ESLint Stylistic + strategy: + matrix: + stylistic: [2, 3, 4] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node.js + uses: actions/setup-node@v4 + - name: Install Packages + run: npm install + - name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }} + run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force - name: Test run: npm test @@ -86,7 +104,7 @@ jobs: uses: actions/setup-node@v4 - name: Install Packages run: npm install - - name: Install @typescript-eslint/parser@7 - run: npm install -D @typescript-eslint/parser@7 -f + - name: Install @typescript-eslint/parser v7 + run: npm install -D @typescript-eslint/parser@7 --force - name: Test run: npm test From f6a788818e7e2a2713d48b0686a74ff474929785 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 31 Jul 2025 09:59:59 +0200 Subject: [PATCH 3/8] Add ESLint Stylistic as optional peer dependency --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 404e07f32..a1584a94e 100644 --- a/package.json +++ b/package.json @@ -58,11 +58,15 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "peerDependencies": { + "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", + "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0", - "vue-eslint-parser": "^10.0.0", - "@typescript-eslint/parser": "^7.0.0 || ^8.0.0" + "vue-eslint-parser": "^10.0.0" }, "peerDependenciesMeta": { + "@stylistic/eslint-plugin": { + "optional": true + }, "@typescript-eslint/parser": { "optional": true } From d45891b4af0c32035005d1a4a178b29d729d6106 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 31 Jul 2025 10:00:14 +0200 Subject: [PATCH 4/8] Update dev version of ESLint Stylistic --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1584a94e..5266cc3b6 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "devDependencies": { "@changesets/cli": "^2.29.2", "@ota-meshi/site-kit-eslint-editor-vue": "^0.2.4", - "@stylistic/eslint-plugin": "^2.12.1", + "@stylistic/eslint-plugin": "^5.2.2", "@svitejs/changesets-changelog-github-compact": "^1.2.0", "@types/eslint": "^8.56.2", "@types/natural-compare": "^1.4.3", From e26ce850b58dbbeb56e86c75cce951ccd9881d83 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 31 Jul 2025 11:06:31 +0200 Subject: [PATCH 5/8] Fix `vue/comma-style` tests with newer ESLint Stylistic versions --- tests/lib/rules/comma-style.js | 44 ++++++++++++++++++++++++++-- tests/test-utils/eslint-stylistic.js | 16 ++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/test-utils/eslint-stylistic.js diff --git a/tests/lib/rules/comma-style.js b/tests/lib/rules/comma-style.js index 82c8e4044..2f58891d0 100644 --- a/tests/lib/rules/comma-style.js +++ b/tests/lib/rules/comma-style.js @@ -3,13 +3,20 @@ */ 'use strict' +const semver = require('semver') const { RuleTester } = require('../../eslint-compat') const rule = require('../../../lib/rules/comma-style') +const { eslintStylisticVersion } = require('../../test-utils/eslint-stylistic') const tester = new RuleTester({ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 2018 } }) +const isOldStylistic = + eslintStylisticVersion === undefined || + semver.lt(eslintStylisticVersion, '3.0.0') || + semver.satisfies(process.version, '<19.0.0 || ^21.0.0') + tester.run('comma-style', rule, { valid: [ ``, options: ['first', { exceptions: { ArrowFunctionExpression: false } }] }, - ` + ...(isOldStylistic + ? [ + ` - `, + ` + ] + : []), { code: `