-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
128 lines (118 loc) · 3.97 KB
/
.eslintrc.cjs
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
const stylistic = require('@stylistic/eslint-plugin')
const customized = stylistic.configs.customize({
indent: 2,
quotes: 'single',
semi: false,
})
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
overrides: [
{
files: ['*.js', '*.cjs', '*.mjs'],
plugins: ['sonarjs', '@stylistic'],
extends: ['eslint:recommended', 'plugin:sonarjs/recommended'],
parserOptions: {
ecmaVersion: 'latest',
},
rules: {
...customized.rules,
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': 'off',
'no-undef': 'off', // auto-imports are not recognized
'sonarjs/no-duplicate-string': 'off',
},
},
{
files: ['*.ts'],
plugins: ['sonarjs', '@typescript-eslint', '@stylistic'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:sonarjs/recommended',
],
parserOptions: {
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
sourceType: 'module',
tsconfigRootDir: __dirname,
},
rules: {
...customized.rules,
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': 'off',
'no-undef': 'off', // auto-imports are not recognized
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/cognitive-complexity': 'off',
},
},
{
files: ['*.vue'],
plugins: ['sonarjs', '@typescript-eslint', '@stylistic'],
extends: [
'eslint:recommended',
'plugin:tailwindcss/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:sonarjs/recommended',
'plugin:vue/vue3-recommended',
'plugin:vuejs-accessibility/recommended',
],
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module',
tsconfigRootDir: __dirname,
},
rules: {
...customized.rules,
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': 'off',
'no-undef': 'off', // auto-imports are not recognized
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'vue/script-setup-uses-vars': 'error',
'vue/multi-word-component-names': 'off',
'vue/define-macros-order': 'error',
// vue 3.3 allows setup props destructuring
'vue/no-setup-props-destructure': 'off',
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 2,
},
multiline: {
max: 1,
},
},
],
'vuejs-accessibility/form-control-has-label': 'off',
'vuejs-accessibility/label-has-for': 'off',
'vuejs-accessibility/anchor-has-content': 'off',
'vuejs-accessibility/click-events-have-key-events': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/cognitive-complexity': 'off',
'tailwindcss/no-custom-classname': 'off',
'tailwindcss/classnames-order': 'error',
},
},
],
}