-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
102 lines (102 loc) · 3.24 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
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
'eslint:recommended',
'@vue/typescript/recommended',
'@vue/prettier',
'@vue/prettier/@typescript-eslint',
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
// clean code
complexity: ['error', { max: 10 }],
'max-lines': ['error', { max: 300, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['error', { max: 80, skipBlankLines: true, skipComments: true }],
'max-depth': ['error', 4],
// /. clean code
// vue compiler macros
'no-undef': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// /. vue compiler macros
// vue base
'vue/eqeqeq': 'error',
'vue/component-definition-name-casing': ['warn', 'kebab-case'],
'vue/match-component-file-name': 'warn',
'vue/component-name-in-template-casing': [
'error',
'kebab-case',
{
registeredComponentsOnly: false,
},
],
// /.vue base
// vue2to3
'vue/no-v-for-template-key-on-child': 'off',
'vue/no-deprecated-v-bind-sync': 'off',
'vue/no-deprecated-dollar-listeners-api': 'off',
'vue/no-deprecated-v-on-native-modifier': 'off',
'vue/no-deprecated-destroyed-lifecycle': 'off',
'vue/no-deprecated-slot-attribute': 'warn',
'vue/no-deprecated-slot-scope-attribute': 'warn',
'vue/no-deprecated-scope-attribute': 'warn',
'vue/v-slot-style': 'off',
// /. vue2to3
// typescript
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: true,
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/array-type': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/member-ordering': [
'warn',
{
default: [
'public-method', // = ["public-static-method", "public-instance-method"]
'protected-method', // = ["protected-static-method", "protected-instance-method"]
'private-method', // = ["private-static-method", "private-instance-method"]
],
},
],
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': 'warn',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
'@typescript-eslint/strict-boolean-expressions': ['off'],
// /. typescript
// vite & esbuild
'no-restricted-syntax': [
'error',
{
selector: 'TSEnumDeclaration',
message: "Don't declare enums",
},
],
// /. vite & esbuild
},
overrides: [
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
env: {
jest: true,
},
},
],
}