Skip to content

Commit ebf6cb5

Browse files
chore: Use ESLint v9 in development env (#2775)
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
1 parent 24eccf4 commit ebf6cb5

25 files changed

+179
-154
lines changed

.changeset/fast-penguins-reflect.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 [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser) as an optional peer dependency

.changeset/gentle-glasses-tie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-vue": patch
3+
---
4+
5+
Fixed false negatives when using typescript-eslint v8 in [`vue/script-indent`](https://eslint.vuejs.org/rules/script-indent.html) rule

.github/workflows/CI.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
with:
4747
node-version: ${{ matrix.node }}
4848
- name: Install Packages
49-
run: npm install -f
49+
run: npm install
5050
- name: Install ESLint v${{ matrix.eslint }}
5151
run: npm install --save-dev eslint@${{ matrix.eslint }} -f
5252
- name: Test
@@ -61,8 +61,23 @@ jobs:
6161
- name: Install Node.js
6262
uses: actions/setup-node@v4
6363
- name: Install Packages
64-
run: npm install -f
64+
run: npm install
6565
- name: Uninstall @stylistic/eslint-plugin
6666
run: npm uninstall -D @stylistic/eslint-plugin
6767
- name: Test
6868
run: npm test
69+
70+
test-with-typescript-eslint-v7:
71+
name: Test with typescript-eslint v7
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v4
76+
- name: Install Node.js
77+
uses: actions/setup-node@v4
78+
- name: Install Packages
79+
run: npm install
80+
- name: Install @typescript-eslint/parser@7
81+
run: npm install -D @typescript-eslint/parser@7 -f
82+
- name: Test
83+
run: npm test

.github/workflows/Release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Node.js
2323
uses: actions/setup-node@v4
2424
- name: Install Dependencies
25-
run: npm install -f
25+
run: npm install
2626

2727
- name: Create Release Pull Request or Publish to npm
2828
id: changesets

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
yarn.lock
99
yarn-error.log
1010
/docs/.vitepress/dist
11-
/docs/.vitepress/build-system/shim/eslint.mjs
12-
/docs/.vitepress/build-system/shim/assert.mjs
11+
/docs/.vitepress/build-system/shim/vue-eslint-parser.mjs
12+
/docs/.vitepress/build-system/shim/@typescript-eslint/parser.mjs
1313
/docs/.vitepress/.temp
1414
/docs/.vitepress/cache
1515
typings/eslint/lib/rules

docs/.vitepress/build-system/build.mts

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,38 @@ import { fileURLToPath } from 'url'
99
const dirname = path.dirname(fileURLToPath(import.meta.url))
1010

1111
build(
12-
path.join(dirname, './src/eslint.mjs'),
13-
path.join(dirname, './shim/eslint.mjs'),
14-
['path', 'assert', 'util', 'esquery']
12+
path.join(
13+
dirname,
14+
'../../../node_modules/@typescript-eslint/parser/dist/index.js'
15+
),
16+
path.join(dirname, './shim/@typescript-eslint/parser.mjs'),
17+
[
18+
'util',
19+
'node:util',
20+
'path',
21+
'node:path',
22+
'fs',
23+
'node:fs',
24+
'semver',
25+
'fast-glob',
26+
'debug'
27+
]
1528
)
29+
1630
build(
17-
path.join(dirname, '../../../node_modules/assert'),
18-
path.join(dirname, './shim/assert.mjs'),
19-
['path']
31+
path.join(dirname, '../../../node_modules/vue-eslint-parser/index.js'),
32+
path.join(dirname, './shim/vue-eslint-parser.mjs'),
33+
[
34+
'path',
35+
'debug',
36+
'semver',
37+
'assert',
38+
'module',
39+
'events',
40+
'esquery',
41+
'fs',
42+
'eslint'
43+
]
2044
)
2145

2246
function build(input: string, out: string, injects: string[] = []) {
@@ -42,16 +66,22 @@ function bundle(entryPoint: string, externals: string[]) {
4266
}
4367

4468
function transform(code: string, injects: string[]) {
69+
const normalizeInjects = [
70+
...new Set(injects.map((inject) => inject.replace(/^node:/u, '')))
71+
]
4572
const newCode = code.replace(/"[a-z]+" = "[a-z]+";/u, '')
4673
return `
47-
${injects
74+
${normalizeInjects
4875
.map(
4976
(inject) =>
50-
`import $inject_${inject.replace(/-/gu, '_')}$ from '${inject}';`
77+
`import $inject_${inject.replace(/[\-:]/gu, '_')}$ from '${inject}';`
5178
)
5279
.join('\n')}
5380
const $_injects_$ = {${injects
54-
.map((inject) => `${inject.replace(/-/gu, '_')}:$inject_${inject}$`)
81+
.map(
82+
(inject) =>
83+
`"${inject}":$inject_${inject.replace(/^node:/u, '').replace(/[\-:]/gu, '_')}$`
84+
)
5585
.join(',\n')}};
5686
function require(module, ...args) {
5787
return $_injects_$[module] || {}

docs/.vitepress/build-system/shim/eslint/use-at-your-own-risk.mjs

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/.vitepress/build-system/shim/esquery.mjs

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/.vitepress/build-system/shim/path.mjs

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy