Skip to content
Permalink
Browse files
feat: auto JS fallback
  • Loading branch information
antfu committed Nov 12, 2022
1 parent f8014b7 commit b820b0fd92fe18056bfca76066715028a4869dc9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
@@ -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:

0 comments on commit b820b0f

Please sign in to comment.