-
-
Notifications
You must be signed in to change notification settings - Fork 696
feat: introduce tsdown, support mixed js & ts in codebase
#2916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b9ad774
928fe26
1b24273
0f786d8
aedcd8d
bd930b7
79d440d
18d7488
861c1d6
3d7f91c
f1c5923
eb2d18d
27f3479
8c11d97
17974eb
5e71d49
6c4041b
8d33d93
f081f42
7108c0a
1d7a583
e9f7c7e
3b54278
4438e9f
7633074
75b42d3
34f9c2b
4f2f525
7cfa8d0
e3dbe93
b92bc9c
46ac044
9c58e1f
e4a6bdb
7559e8d
7e482cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,12 +26,35 @@ jobs: | |
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: lts/* | ||
|
|
||
| - name: Install Packages | ||
| run: npm install | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
|
|
||
| - name: Cache dist | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| retention-days: 3 | ||
| name: dist | ||
| path: dist | ||
|
|
||
| test: | ||
| name: Test | ||
| strategy: | ||
| matrix: | ||
| node: [18, 20, 21, 'lts/*'] | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -41,12 +64,18 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| - name: Install Packages | ||
| run: npm install | ||
| - name: Restore dist cache | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: dist | ||
|
Comment on lines
+67
to
+70
|
||
| - name: Test | ||
| run: npm test | ||
|
|
||
| test-with-eslint-v8: | ||
| name: Test with ESLint v8 | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -58,12 +87,18 @@ jobs: | |
| run: npm install | ||
| - name: Install ESLint v8 | ||
| run: npm install --save-dev eslint@8 --force | ||
| - name: Restore dist cache | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: dist | ||
|
Comment on lines
+90
to
+93
|
||
| - name: Test | ||
| run: npm test | ||
|
|
||
| test-without-eslint-stylistic: | ||
| name: Test without ESLint Stylistic | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -73,6 +108,10 @@ jobs: | |
| run: npm install | ||
| - name: Uninstall @stylistic/eslint-plugin | ||
| run: npm uninstall @stylistic/eslint-plugin | ||
| - name: Restore dist cache | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: dist | ||
|
Comment on lines
+111
to
+114
|
||
| - name: Test | ||
| run: npm test | ||
|
|
||
|
|
@@ -82,6 +121,8 @@ jobs: | |
| matrix: | ||
| stylistic: [2, 3, 4] | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -91,12 +132,18 @@ jobs: | |
| run: npm install | ||
| - name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }} | ||
| run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force | ||
| - name: Restore dist cache | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: dist | ||
|
Comment on lines
+135
to
+138
|
||
| - name: Test | ||
| run: npm test | ||
|
|
||
| test-with-typescript-eslint-v7: | ||
| name: Test with typescript-eslint v7 | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -106,5 +153,9 @@ jobs: | |
| run: npm install | ||
| - name: Install @typescript-eslint/parser v7 | ||
| run: npm install -D @typescript-eslint/parser@7 --force | ||
| - name: Restore dist cache | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: dist | ||
|
Comment on lines
+156
to
+159
|
||
| - name: Test | ||
| run: npm test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ yarn-error.log | |
| /docs/.vitepress/cache | ||
| typings/eslint/lib/rules | ||
| eslint-typegen.d.ts | ||
| dist | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -142,7 +142,7 @@ export default { | |||||
| this.height = `${Math.max(120, 20 * (1 + lines))}px` | ||||||
| // Load linter. | ||||||
| const [plugin, { Linter }, vueEslintParser, globals] = await Promise.all([ | ||||||
| import('../../../..'), | ||||||
| import('../../../../lib/index'), | ||||||
|
||||||
| import('../../../../lib/index'), | |
| import('../../../../dist/index'), |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import configs from './configs/index.js' | ||
| import plugin from './plugin.js' | ||
FloEdelmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export default Object.assign(plugin, { configs }) | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import pkg from '../package.json' with { type: 'json' } | ||
|
|
||
| export default { name: pkg.name, version: pkg.version } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |||||||||
| 'use strict' | ||||||||||
|
|
||||||||||
| const plugin = { | ||||||||||
| meta: require('./meta'), | ||||||||||
| meta: require('./meta.ts').default, | ||||||||||
|
||||||||||
| rules: { | ||||||||||
| 'array-bracket-newline': require('./rules/array-bracket-newline'), | ||||||||||
| 'array-bracket-spacing': require('./rules/array-bracket-spacing'), | ||||||||||
|
|
@@ -258,8 +258,8 @@ const plugin = { | |||||||||
| 'valid-v-text': require('./rules/valid-v-text') | ||||||||||
| }, | ||||||||||
| processors: { | ||||||||||
| '.vue': require('./processor'), | ||||||||||
| vue: require('./processor') | ||||||||||
| '.vue': require('./processor.ts').default, | ||||||||||
| vue: require('./processor.ts').default | ||||||||||
|
Comment on lines
+261
to
+262
|
||||||||||
| '.vue': require('./processor.ts').default, | |
| vue: require('./processor.ts').default | |
| '.vue': require('./processor.js').default, | |
| vue: require('./processor.js').default |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| import fs from 'node:fs/promises' | ||||||
| import { pluginsToRulesDTS } from 'eslint-typegen/core' | ||||||
| import plugin from '../lib/index.js' | ||||||
| import plugin from '../lib/index.ts' | ||||||
|
||||||
| import plugin from '../lib/index.ts' | |
| import plugin from '../lib/index.js' |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,15 +24,15 @@ const content = `/* | |||||||||
| 'use strict' | ||||||||||
|
|
||||||||||
| const plugin = { | ||||||||||
| meta: require('./meta'), | ||||||||||
| meta: require('./meta.ts').default, | ||||||||||
|
||||||||||
| rules: { | ||||||||||
| ${rules | ||||||||||
| .map((rule) => `'${rule.name}': require('./rules/${rule.name}')`) | ||||||||||
| .join(',\n')} | ||||||||||
| }, | ||||||||||
| processors: { | ||||||||||
| '.vue': require('./processor'), | ||||||||||
| 'vue': require('./processor') | ||||||||||
| '.vue': require('./processor.ts').default, | ||||||||||
| 'vue': require('./processor.ts').default | ||||||||||
|
Comment on lines
+34
to
+35
|
||||||||||
| '.vue': require('./processor.ts').default, | |
| 'vue': require('./processor.ts').default | |
| '.vue': require('./processor.js').default, | |
| 'vue': require('./processor.js').default |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { defineConfig } from 'tsdown' | ||
|
|
||
| export default defineConfig({ | ||
| entry: ['lib/index.ts'], | ||
| format: ['cjs'], | ||
| copy: ['lib/index.d.ts', 'lib/eslint-typegen.d.ts', 'lib/removed-rules.js'], | ||
| dts: false, | ||
| external: ['typescript'], | ||
| unbundle: true, | ||
| fixedExtension: false | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build job uses
npm installwithout the--legacy-peer-depsflag, while the lint job usesnpm install --legacy-peer-deps. This inconsistency could lead to different dependency resolution and potential build failures. The build job should use the same installation command as other jobs for consistency.