Skip to content

Commit

Permalink
feat: auto JS fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 12, 2022
1 parent f8014b7 commit b820b0f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
15 changes: 13 additions & 2 deletions packages/vue/index.js
@@ -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: [
{
Expand All @@ -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',
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/package.json
Expand Up @@ -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"
}
}
4 changes: 4 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b820b0f

Please sign in to comment.