generated from lvzhenbo/naive-tailwind-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.js
67 lines (66 loc) · 2.03 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
import { defineFlatConfig } from 'eslint-define-config';
import js from '@eslint/js';
import pluginVue from 'eslint-plugin-vue';
import vueTsEslintConfig from '@vue/eslint-config-typescript';
import prettierConfig from '@vue/eslint-config-prettier';
import parserVue from 'vue-eslint-parser';
import AutoImport from './.eslintrc-auto-import.json' with { type: 'json' };
export default defineFlatConfig([
...pluginVue.configs['flat/recommended'],
js.configs.recommended,
...vueTsEslintConfig({
supportedScriptLangs: {
ts: true,
tsx: true,
},
}),
{
name: 'app/vue-files',
files: ['**/*.vue'],
languageOptions: {
parser: parserVue,
parserOptions: {
ecmaVersion: 'latest',
},
},
},
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
languageOptions: {
globals: {
...AutoImport.globals,
},
},
rules: {
// 允许被禁止的类型 https://typescript-eslint.io/rules/ban-types/
'@typescript-eslint/ban-types': 'off',
// 允许any类型 https://typescript-eslint.io/rules/no-explicit-any/
'@typescript-eslint/no-explicit-any': 'off',
// 允许任何TS指令注释 https://typescript-eslint.io/rules/ban-ts-comment
'@typescript-eslint/ban-ts-comment': 'off',
// 允许空函数 https://typescript-eslint.io/rules/no-empty-function/
'@typescript-eslint/no-empty-function': 'off',
// 关闭强制多词组件名 https://eslint.vuejs.org/rules/multi-word-component-names.html
'vue/multi-word-component-names': 'off',
// 强制执行自我关闭风格 https://eslint.vuejs.org/rules/html-self-closing.html
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
},
},
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
},
prettierConfig,
]);