-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
90 lines (86 loc) · 2.09 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import path from 'path'
import globals from 'globals'
import pluginJs from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import VueEslintParser from 'vue-eslint-parser'
import prettier from 'eslint-plugin-prettier'
import oxlint from 'eslint-plugin-oxlint'
import { FlatCompat } from '@eslint/eslintrc'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname
})
/** @type {import('eslint').Linter.Config[]} */
export default [
{
files: ['**/*.{js,mjs,cjs,vue}']
},
{
languageOptions: {
ecmaVersion: '2022',
globals: {
...globals.browser,
...globals.node
},
parser: VueEslintParser
}
},
/** js推荐配置 */
pluginJs.configs.recommended,
/** vue推荐配置 */
...pluginVue.configs['flat/essential'],
/** 继承自动导入配置 */
...compat.extends('./.eslintrc-auto-import.json'),
/** oxlint推荐配置 */
oxlint.configs['flat/recommended'],
/** 自定义eslint配置 */
{
rules: {
'no-var': 'error', // 要求使用 let 或 const 而不是 var
'no-multiple-empty-lines': ['warn', { max: 1 }], // 不允许多个空行
'no-unexpected-multiline': 'error', // 禁止空余的多行
'no-useless-escape': 'off', // 禁止不必要的转义字符
'vue/multi-word-component-names': 0
}
},
/**
* prettier 配置
* 会合并根目录下的prettier.config.js 文件
* @see https://prettier.io/docs/en/options
* https://github.com/prettier/eslint-plugin-prettier/issues/634
*/
{
plugins: {
prettier
},
rules: {
...prettier.configs.recommended.rules
}
},
// 忽略文件
{
ignores: [
'**/dist',
'./src/main.ts',
'.vscode',
'.idea',
'*.sh',
'**/node_modules',
'*.md',
'*.woff',
'*.woff',
'*.ttf',
'yarn.lock',
'package-lock.json',
'/public',
'/docs',
'**/output',
'.husky',
'.local',
'/bin',
'Dockerfile'
]
}
]