-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
109 lines (108 loc) · 3.1 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import jsLint from '@eslint/js'
import tsLint from 'typescript-eslint'
import vueLint from 'eslint-plugin-vue'
import tsParser from '@typescript-eslint/parser'
import vueParser from 'vue-eslint-parser'
export default tsLint.config(
jsLint.configs.recommended,
...tsLint.configs.recommended,
...vueLint.configs['flat/recommended'],
{
ignores: ['dist', 'src/static'], // 该项要单独放才生效
},
{
files: ['**/*.{js,jsx,ts,tsx,d.ts,vue}'],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tsParser,
sourceType: 'module',
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
globalReturn: false,
},
},
globals: {
uni: 'readonly',
},
},
rules: {
indent: [
'error',
4,
{
SwitchCase: 1,
},
],
quotes: ['error', 'single'],
semi: ['error', 'never'],
'comma-dangle': ['error', 'always-multiline'],
'arrow-spacing': [
'error',
{
before: true,
after: true,
},
],
'keyword-spacing': [
'error',
{
before: true,
after: true,
},
],
'switch-colon-spacing': [
'error',
{
after: true,
},
],
'space-before-blocks': ['error', 'always'],
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': false,
},
],
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'with-single-extends',
},
],
'@typescript-eslint/no-unused-expressions': 'off',
'vue/html-indent': ['error', 4],
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
},
},
],
'vue/no-v-text-v-html-on-component': 'off',
'vue/attribute-hyphenation': ['error', 'never'],
'vue/multi-word-component-names': [
'error',
{
ignores: ['index', 'Dropdown'],
},
],
'vue/no-bare-strings-in-template': [
'error',
{
allowlist: [],
attributes: {},
directives: [],
},
],
'vue/singleline-html-element-content-newline': [
'error',
{
ignoreWhenNoAttributes: false,
},
],
},
},
)