Skip to content

Commit 2523927

Browse files
authored
feat: allow ESLint v10 as peer dependency (#2962)
1 parent 57058ce commit 2523927

File tree

6 files changed

+74
-52
lines changed

6 files changed

+74
-52
lines changed

.changeset/light-sheep-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-vue": minor
3+
---
4+
5+
Added [ESLint v10](https://eslint.org/blog/2026/02/eslint-v10.0.0-released/) as an allowed peer dependency (needs [`eslint-parser-vue` v10.3.0](https://github.com/vuejs/vue-eslint-parser/releases/tag/v10.3.0))

.github/workflows/CI.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
name: Test
5252
strategy:
5353
matrix:
54-
node: [18, 20, 21, 'lts/*']
54+
node: [18, 20, 22, 24, 'lts/*']
5555
runs-on: ubuntu-latest
5656
needs:
5757
- build
@@ -94,6 +94,31 @@ jobs:
9494
- name: Test
9595
run: npm test
9696

97+
test-with-eslint-v10:
98+
name: Test with ESLint v10
99+
runs-on: ubuntu-latest
100+
needs:
101+
- build
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v5
105+
- name: Install Node.js v18
106+
uses: actions/setup-node@v6
107+
with:
108+
node-version: 24
109+
- name: Change local ESLint version to v10
110+
run: |
111+
sed --in-place 's/"eslint": "^9.32.0"/"eslint": "^10.0.0"/' package.json
112+
sed --in-place 's/"espree": "^10.4.0"/"espree": "^11.0.0"/' package.json
113+
- name: Install Packages
114+
run: npm install --force
115+
- name: Restore dist cache
116+
uses: actions/download-artifact@v7
117+
with:
118+
name: dist
119+
- name: Test
120+
run: npm test
121+
97122
test-without-eslint-stylistic:
98123
name: Test without ESLint Stylistic
99124
runs-on: ubuntu-latest

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"peerDependencies": {
6262
"@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0",
6363
"@typescript-eslint/parser": "^7.0.0 || ^8.0.0",
64-
"eslint": "^8.57.0 || ^9.0.0",
64+
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
6565
"vue-eslint-parser": "^10.0.0"
6666
},
6767
"peerDependenciesMeta": {

tests/integrations/eslint-plugin-import.js

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,33 @@
55
*/
66
'use strict'
77

8-
const cp = require('node:child_process')
8+
const { execSync } = require('node:child_process')
99
const path = require('node:path')
1010
const semver = require('semver')
1111

1212
const PLUGIN_DIR = path.join(__dirname, 'eslint-plugin-import')
13-
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`
13+
const ESLINT = path.join(PLUGIN_DIR, 'node_modules', '.bin', 'eslint')
14+
15+
let eslintNodeVersion = ''
1416

1517
describe('Integration with eslint-plugin-import', () => {
1618
beforeAll(() => {
17-
cp.execSync('npm i', { cwd: PLUGIN_DIR, stdio: 'inherit' })
19+
execSync('npm i', { cwd: PLUGIN_DIR, stdio: 'inherit' })
20+
eslintNodeVersion = require(
21+
path.join(PLUGIN_DIR, 'node_modules/eslint/package.json')
22+
).engines.node
1823
})
1924

2025
// https://github.com/vuejs/eslint-plugin-vue/issues/21#issuecomment-308957697
2126
// eslint-plugin-vue had been breaking eslint-plugin-import if people use both at the same time.
2227
// This test is in order to prevent the regression.
23-
it('should lint without errors', () => {
24-
if (
25-
!semver.satisfies(
26-
process.version,
27-
require(
28-
path.join(
29-
__dirname,
30-
'eslint-plugin-import/node_modules/eslint/package.json'
31-
)
32-
).engines.node
33-
)
34-
) {
35-
return
28+
it.skipIf(!semver.satisfies(process.version, eslintNodeVersion))(
29+
'should lint without errors',
30+
() => {
31+
execSync(`${ESLINT} --config eslint.config.mjs a.vue`, {
32+
cwd: PLUGIN_DIR,
33+
stdio: 'inherit'
34+
})
3635
}
37-
38-
cp.execSync(`${ESLINT} --config eslint.config.mjs a.vue`, {
39-
cwd: PLUGIN_DIR,
40-
stdio: 'inherit'
41-
})
42-
})
36+
)
4337
})

tests/integrations/flat-config.js

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
'use strict'
22

33
const { strict: assert } = require('node:assert')
4-
const cp = require('node:child_process')
4+
const { execSync } = require('node:child_process')
55
const path = require('node:path')
66
const semver = require('semver')
77

88
const TARGET_DIR = path.join(__dirname, 'flat-config')
9-
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`
9+
const ESLINT = path.join(TARGET_DIR, 'node_modules', '.bin', 'eslint')
10+
11+
let eslintNodeVersion = ''
1012

1113
describe('Integration with flat config', () => {
1214
beforeAll(() => {
13-
cp.execSync('npm i -f', { cwd: TARGET_DIR, stdio: 'inherit' })
15+
execSync('npm i -f', { cwd: TARGET_DIR, stdio: 'inherit' })
16+
eslintNodeVersion = require(
17+
path.join(TARGET_DIR, 'node_modules/eslint/package.json')
18+
).engines.node
1419
})
1520

16-
it('should lint without errors', () => {
17-
if (
18-
!semver.satisfies(
19-
process.version,
20-
require(
21-
path.join(__dirname, 'flat-config/node_modules/eslint/package.json')
22-
).engines.node
21+
it.skipIf(!semver.satisfies(process.version, eslintNodeVersion))(
22+
'should lint without errors',
23+
() => {
24+
const result = JSON.parse(
25+
execSync(`${ESLINT} a.vue --format=json`, {
26+
cwd: TARGET_DIR,
27+
encoding: 'utf8'
28+
})
2329
)
24-
) {
25-
return
30+
assert.strictEqual(result.length, 1)
31+
assert.deepStrictEqual(result[0].messages, [])
2632
}
27-
28-
const result = JSON.parse(
29-
cp.execSync(`${ESLINT} a.vue --format=json`, {
30-
cwd: TARGET_DIR,
31-
encoding: 'utf8'
32-
})
33-
)
34-
assert.strictEqual(result.length, 1)
35-
assert.deepStrictEqual(result[0].messages, [])
36-
})
33+
)
3734
})

tests/lib/utils/ts-utils/index/get-component-props.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function extractComponentProps(code, tsFileCode) {
7171
}
7272

7373
describe.sequential('getComponentPropsFromTypeDefineTypes', () => {
74-
for (const { scriptCode, tsFileCode, props: expected } of [
74+
it.each([
7575
{
7676
scriptCode: `defineProps<{foo:string,bar?:number}>()`,
7777
props: [
@@ -203,16 +203,17 @@ defineProps<{foo?:A}>()`,
203203
}
204204
]
205205
}
206-
]) {
207-
const code = `<script setup lang="ts"> ${scriptCode} </script>`
208-
it(`should return expected props with :${code}`, () => {
206+
])(
207+
'should return expected props with $scriptCode',
208+
({ scriptCode, tsFileCode, props: expected }) => {
209+
const code = `<script setup lang="ts"> ${scriptCode} </script>`
209210
const props = extractComponentProps(code, tsFileCode)
210211

211212
assert.deepStrictEqual(
212213
props,
213214
expected,
214215
`\n${JSON.stringify(props)}\n === \n${JSON.stringify(expected)}`
215216
)
216-
})
217-
}
217+
}
218+
)
218219
})

0 commit comments

Comments
 (0)