Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ba941a

Browse files
chore: cleanup the ESLint config for the project itself
We are not using either Vue.js or TypeScript in this project, so we can simplify the ESLint config.
1 parent cfaba5d commit 7ba941a

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

‎bin/create-eslint-config.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ let vueVersion
102102
try {
103103
vueVersion = requireInCwd('vue/package.json').version
104104
console.info(dim(`Detected Vue.js version: ${vueVersion}`))
105-
} catch {}
105+
} catch {
106+
// Vue.js not found, will prompt later
107+
}
106108

107-
if (!vueVersion || !/^3/.test(vueVersion)) {
109+
if (!vueVersion || !vueVersion.startsWith('3.')) {
108110
const { continueAnyway } = await prompt({
109111
type: 'toggle',
110112
disabled: 'No',
@@ -126,7 +128,9 @@ try {
126128
const tsVersion = requireInCwd('typescript/package.json').version
127129
console.info(dim(`Detected TypeScript version: ${tsVersion}`))
128130
detectedTypeScript = true
129-
} catch {}
131+
} catch {
132+
// TypeScript not found, will prompt later
133+
}
130134

131135
const { hasTypeScript } = await prompt({
132136
type: 'toggle',

‎eslint.config.js‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
import pluginVuefrom 'eslint-plugin-vue'
2-
// Use the TS config here because the default js parser doesn't support import attributes
3-
import vueTsEslintConfig from '@vue/eslint-config-typescript'
1+
import {defineConfig,globalIgnores}from 'eslint/config'
2+
importglobalsfrom'globals'
3+
import js from '@eslint/js'
44

5-
export default [
5+
export default defineConfig([
66
{
77
name: 'app/files-to-lint',
8-
files: ['**/*.{js,mjs,jsx,ts,mts,tsx,vue}'],
9-
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
8+
files: ['**/*.{js,mjs}'],
109
},
11-
...pluginVue.configs['flat/essential'],
12-
...vueTsEslintConfig(),
13-
]
10+
11+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
12+
13+
{
14+
languageOptions: {
15+
globals: {
16+
...globals.node,
17+
},
18+
},
19+
},
20+
21+
js.configs.recommended,
22+
])

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /