-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
139 lines (136 loc) · 3.73 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
129
130
131
132
133
134
135
136
137
138
139
/* eslint-disable @typescript-eslint/naming-convention,sonarjs/no-duplicate-string */
module.exports = {
root: true,
env: {
node: true,
browser: true,
es6: true,
es2021: true,
es2022: true,
es2023: true,
commonjs: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:security/recommended',
'plugin:no-unsanitized/DOM',
'plugin:xss/recommended',
'plugin:sonarjs/recommended',
],
plugins: [
'@typescript-eslint/eslint-plugin',
'eslint-plugin-no-unsanitized',
'eslint-plugin-node',
'eslint-plugin-security',
'eslint-plugin-sonarjs',
'eslint-plugin-xss',
],
parserOptions: {
ecmaVersion: 2023,
parser: require.resolve('@typescript-eslint/parser'),
},
rules: {
/* --------------------------------------------------
Standard Rules
-------------------------------------------------- */
indent: 0,
semi: ['error', 'always'],
quotes: ['error', 'single'],
'no-console': 0,
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-use-before-define': 0,
'no-useless-constructor': 0,
'scss/vendorPrefix': 0,
'func-call-spacing': 0,
'no-new': 0,
'array-bracket-spacing': 0,
'prefer-promise-reject-errors': 0,
'padded-blocks': 0,
'n/no-callback-literal': 0,
'no-tabs': 0,
'no-useless-return': 0,
'operator-linebreak': ['error', 'before'],
'keyword-spacing': [
'error', {
overrides: {
catch: {
before: true,
after: false,
},
},
},
],
'no-trailing-spaces': ['error', {
ignoreComments: true,
skipBlankLines: false,
}],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
}],
/* --------------------------------------------------
TypeScript Rules
-------------------------------------------------- */
'@typescript-eslint/indent': ['error', 'tab'],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-member-accessibility': ['error'],
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/no-useless-constructor': ['error'],
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/consistent-type-imports': ['error', {
'prefer': 'no-type-imports',
}],
'@typescript-eslint/ban-ts-comment': ['error', {
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
'ts-check': 'allow-with-description',
minimumDescriptionLength: 25,
}],
'@typescript-eslint/naming-convention': ['error',
{
selector: 'default',
format: ['PascalCase', 'camelCase', 'snake_case', 'UPPER_CASE'],
leadingUnderscore: 'forbid',
},
{
selector: 'function',
format: ['PascalCase', 'camelCase'],
leadingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: 'memberLike',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
],
/* --------------------------------------------------
Security Rules
-------------------------------------------------- */
'security/detect-object-injection': 0,
'security/detect-non-literal-regexp': 0,
'xss/no-location-href-assign': 0,
'xss/no-mixed-html': 0,
'sonarjs/no-nested-template-literals': 0,
'sonarjs/no-duplicate-string': ['error', {
threshold: 25,
}],
'sonarjs/cognitive-complexity': ['error', 250],
'sonarjs/prefer-single-boolean-return': 0,
},
};