Skip to content

Commit b820b0f

Browse files
committed
feat: auto JS fallback
1 parent f8014b7 commit b820b0f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

packages/vue/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
const { isPackageExists } = require('local-pkg')
2+
3+
const TS = isPackageExists('typescript')
4+
5+
if (!TS)
6+
console.warn('[@antfu/eslint-config] TypeScript is not installed, fallback to JS only.')
7+
18
module.exports = {
29
overrides: [
310
{
@@ -9,13 +16,17 @@ module.exports = {
916
rules: {
1017
'no-unused-vars': 'off',
1118
'no-undef': 'off',
12-
'@typescript-eslint/no-unused-vars': 'off',
19+
...(TS
20+
? { '@typescript-eslint/no-unused-vars': 'off' }
21+
: null),
1322
},
1423
},
1524
],
1625
extends: [
1726
'plugin:vue/vue3-recommended',
18-
'@antfu/eslint-config-ts',
27+
TS
28+
? '@antfu/eslint-config-ts'
29+
: '@antfu/eslint-config-basic',
1930
],
2031
rules: {
2132
'vue/max-attributes-per-line': 'off',

packages/vue/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
},
1717
"dependencies": {
1818
"@antfu/eslint-config-ts": "workspace:*",
19+
"@antfu/eslint-config-basic": "workspace:*",
1920
"eslint-plugin-vue": "^9.4.0"
2021
},
2122
"devDependencies": {
22-
"eslint": "^8.23.0"
23+
"eslint": "^8.23.0",
24+
"local-pkg": "^0.4.2"
2325
}
2426
}

pnpm-lock.yaml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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