generated from PreciousnessX/ts-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
154 lines (151 loc) · 3.6 KB
/
.eslintrc.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
module.exports = {
root: true,
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'plugin:vue/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es6: true,
node: true,
},
rules: {
// js/ts
// 'no-console': ['warn', { allow: ['error'] }],
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
camelcase: [
'error',
{
properties: 'never',
},
],
// indent: ["error", "tab"],
'no-var': 'error',
'no-empty': [
'error',
{
allowEmptyCatch: true,
},
],
'no-void': 'error',
'prefer-const': [
'warn',
{
destructuring: 'all',
ignoreReadBeforeAssign: true,
},
],
'prefer-template': 'error',
'object-shorthand': [
'error',
'always',
{
ignoreConstructors: false,
avoidQuotes: true,
},
],
'block-scoped-var': 'error',
'no-constant-condition': [
'error',
{
checkLoops: false,
},
],
'arrow-spacing': [
'error',
{
before: true,
after: true,
},
],
'no-multi-spaces': 'error', // 不允许多个空格
'no-multiple-empty-lines': [
'error',
{
max: 2,
maxEOF: 0,
},
], // 不允许多个空行
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
// '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
// prettier
'prettier/prettier': [
'error',
{
tabWidrh: 4,
// 用制表符(tab)不是空格缩进行
// 如果为true,则取编辑器tabSize值
// 安装editorconfig编辑器插件并配置文件,则取 editorConfig 文件中设置的值
// 具体取indent_size或者tab_width,依据indent_style值来决定
// 如果为false,则取值为tabWidth值,但是有问题,经常需要重启编辑器才生效
useTabs: true,
singleQuote: true,
},
],
// vue
// 'vue/no-v-html': 'off',
// 'vue/require-default-prop': 'off',
// 'vue/require-explicit-emits': 'off',
// 'vue/multi-word-component-names': 'off',
// import
// 'import/first': 'error',
// 'import/no-duplicates': 'error',
// 'import/order': [
// 'error',
// {
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
// pathGroups: [{
// pattern: 'vue',
// group: 'external',
// position: 'before',
// },
// {
// pattern: '@vue/**',
// group: 'external',
// position: 'before',
// },
// {
// pattern: 'ant-design-vue',
// group: 'internal',
// },
// ],
// pathGroupsExcludedImportTypes: ['type'],
// },
// ],
},
};