Skip to content

Commit ce20297

Browse files
9romiseFloEdelmann
andauthored
feat: introduce tsdown, support mixed js & ts in codebase (#2916)
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
1 parent 1c77cf9 commit ce20297

File tree

18 files changed

+661
-347
lines changed

18 files changed

+661
-347
lines changed

.changeset/heavy-dragons-build.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 support for eslint-plugin-vue development

.github/workflows/CI.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,35 @@ jobs:
2626
- name: Lint
2727
run: npm run lint
2828

29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v6
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: lts/*
36+
37+
- name: Install Packages
38+
run: npm install
39+
40+
- name: Build
41+
run: npm run build
42+
43+
- name: Cache dist
44+
uses: actions/upload-artifact@v6
45+
with:
46+
retention-days: 3
47+
name: dist
48+
path: dist
49+
2950
test:
3051
name: Test
3152
strategy:
3253
matrix:
3354
node: [18, 20, 21, 'lts/*']
3455
runs-on: ubuntu-latest
56+
needs:
57+
- build
3558
steps:
3659
- name: Checkout
3760
uses: actions/checkout@v5
@@ -41,12 +64,18 @@ jobs:
4164
node-version: ${{ matrix.node }}
4265
- name: Install Packages
4366
run: npm install
67+
- name: Restore dist cache
68+
uses: actions/download-artifact@v7
69+
with:
70+
name: dist
4471
- name: Test
4572
run: npm test
4673

4774
test-with-eslint-v8:
4875
name: Test with ESLint v8
4976
runs-on: ubuntu-latest
77+
needs:
78+
- build
5079
steps:
5180
- name: Checkout
5281
uses: actions/checkout@v5
@@ -58,12 +87,18 @@ jobs:
5887
run: npm install
5988
- name: Install ESLint v8
6089
run: npm install --save-dev eslint@8 --force
90+
- name: Restore dist cache
91+
uses: actions/download-artifact@v7
92+
with:
93+
name: dist
6194
- name: Test
6295
run: npm test
6396

6497
test-without-eslint-stylistic:
6598
name: Test without ESLint Stylistic
6699
runs-on: ubuntu-latest
100+
needs:
101+
- build
67102
steps:
68103
- name: Checkout
69104
uses: actions/checkout@v5
@@ -73,6 +108,10 @@ jobs:
73108
run: npm install
74109
- name: Uninstall @stylistic/eslint-plugin
75110
run: npm uninstall @stylistic/eslint-plugin
111+
- name: Restore dist cache
112+
uses: actions/download-artifact@v7
113+
with:
114+
name: dist
76115
- name: Test
77116
run: npm test
78117

@@ -82,6 +121,8 @@ jobs:
82121
matrix:
83122
stylistic: [2, 3, 4]
84123
runs-on: ubuntu-latest
124+
needs:
125+
- build
85126
steps:
86127
- name: Checkout
87128
uses: actions/checkout@v5
@@ -91,12 +132,18 @@ jobs:
91132
run: npm install
92133
- name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }}
93134
run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force
135+
- name: Restore dist cache
136+
uses: actions/download-artifact@v7
137+
with:
138+
name: dist
94139
- name: Test
95140
run: npm test
96141

97142
test-with-typescript-eslint-v7:
98143
name: Test with typescript-eslint v7
99144
runs-on: ubuntu-latest
145+
needs:
146+
- build
100147
steps:
101148
- name: Checkout
102149
uses: actions/checkout@v5
@@ -106,5 +153,9 @@ jobs:
106153
run: npm install
107154
- name: Install @typescript-eslint/parser v7
108155
run: npm install -D @typescript-eslint/parser@7 --force
156+
- name: Restore dist cache
157+
uses: actions/download-artifact@v7
158+
with:
159+
name: dist
109160
- name: Test
110161
run: npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ yarn-error.log
1414
/docs/.vitepress/cache
1515
typings/eslint/lib/rules
1616
eslint-typegen.d.ts
17+
dist

docs/.vitepress/theme/components/eslint-code-block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export default {
143143
this.height = `${Math.max(120, 20 * (1 + lines))}px`
144144
// Load linter.
145145
const [plugin, { Linter }, vueEslintParser, globals] = await Promise.all([
146-
import('../../../..'),
146+
import('../../../../lib/index'),
147147
import('eslint'),
148148
import('vue-eslint-parser'),
149149
import('globals')

lib/configs/flat/base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = [
88
name: 'vue/base/setup',
99
plugins: {
1010
get vue() {
11-
return require('../../plugin')
11+
return require('../../plugin.ts').default
1212
}
1313
},
1414
languageOptions: {
@@ -20,7 +20,7 @@ module.exports = [
2020
files: ['*.vue', '**/*.vue'],
2121
plugins: {
2222
get vue() {
23-
return require('../../plugin')
23+
return require('../../plugin.ts').default
2424
}
2525
},
2626
languageOptions: {

lib/index.js

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

lib/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import configs from './configs/index.js'
2+
import plugin from './plugin.ts'
3+
4+
export default Object.assign(plugin, { configs })

lib/meta.js

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

lib/meta.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pkg from '../package.json' with { type: 'json' }
2+
3+
export default { name: pkg.name, version: pkg.version }

0 commit comments

Comments
 (0)