feat: auto JS fallback
This commit is contained in:
parent
f8014b745e
commit
b820b0fd92
@ -1,3 +1,10 @@
|
||||
const { isPackageExists } = require('local-pkg')
|
||||
|
||||
const TS = isPackageExists('typescript')
|
||||
|
||||
if (!TS)
|
||||
console.warn('[@antfu/eslint-config] TypeScript is not installed, fallback to JS only.')
|
||||
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
@ -9,13 +16,17 @@ module.exports = {
|
||||
rules: {
|
||||
'no-unused-vars': 'off',
|
||||
'no-undef': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
...(TS
|
||||
? { '@typescript-eslint/no-unused-vars': 'off' }
|
||||
: null),
|
||||
},
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
'plugin:vue/vue3-recommended',
|
||||
'@antfu/eslint-config-ts',
|
||||
TS
|
||||
? '@antfu/eslint-config-ts'
|
||||
: '@antfu/eslint-config-basic',
|
||||
],
|
||||
rules: {
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
|
@ -16,9 +16,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@antfu/eslint-config-ts": "workspace:*",
|
||||
"@antfu/eslint-config-basic": "workspace:*",
|
||||
"eslint-plugin-vue": "^9.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.23.0"
|
||||
"eslint": "^8.23.0",
|
||||
"local-pkg": "^0.4.2"
|
||||
}
|
||||
}
|
||||
|
@ -131,14 +131,18 @@ importers:
|
||||
|
||||
packages/vue:
|
||||
specifiers:
|
||||
'@antfu/eslint-config-basic': workspace:*
|
||||
'@antfu/eslint-config-ts': workspace:*
|
||||
eslint: ^8.23.0
|
||||
eslint-plugin-vue: ^9.4.0
|
||||
local-pkg: ^0.4.2
|
||||
dependencies:
|
||||
'@antfu/eslint-config-basic': link:../basic
|
||||
'@antfu/eslint-config-ts': link:../typescript
|
||||
eslint-plugin-vue: 9.4.0_eslint@8.23.0
|
||||
devDependencies:
|
||||
eslint: 8.23.0
|
||||
local-pkg: 0.4.2
|
||||
|
||||
packages:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user