@defra/lis-infra-eslint-config 0.1.0-lreg-25.alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/package.json +41 -0
- package/src/index.js +42 -0
- package/src/jsdoc.js +38 -0
- package/src/sonarjs.js +334 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# lis-infra-eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint flat config for JavaScript/Node.js repos in the LIS ecosystem.
|
|
4
|
+
|
|
5
|
+
Using Defra's preferred `neostandard` as a base, this config adds `sonarjs` rules based on those enforced by the Defra JavaScript Standard from SonarQube.
|
|
6
|
+
It also adds requirements for `jsdoc`, focussed on exported interfaces, to improve maintainability as well as to provide better experience for developers using IDEs and AI coding agents.
|
|
7
|
+
|
|
8
|
+
**Stack:** ESM · ESLint flat config (neostandard + sonarjs + jsdoc)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Install:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install --save-dev @defra/lis-infra-eslint-config
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
In your repo's `eslint.config.js`:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import lisEslintConfig from '@defra/lis-infra-eslint-config'
|
|
24
|
+
|
|
25
|
+
export default [
|
|
26
|
+
...lisEslintConfig
|
|
27
|
+
// repo-specific overrides go here
|
|
28
|
+
]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Running locally
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install
|
|
37
|
+
npm run lint # eslint (lints this repo's own source using its own config)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Project structure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
src/
|
|
46
|
+
├── index.js # the exported ESLint flat config array
|
|
47
|
+
├── sonarjs.js # sonarjs-derived rules, sourced from the Defra JS Sonar profile
|
|
48
|
+
└── jsdoc.js # jsdoc rules, requiring docs on exported functions/methods
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Patterns
|
|
54
|
+
|
|
55
|
+
- Config changes here affect every consuming repo — treat this as a shared contract and version deliberately.
|
|
56
|
+
- These files are flat config data, not logic, so they aren't unit tested — correctness is checked by this repo's own `npm run lint` dogfooding the config.
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@defra/lis-infra-eslint-config",
|
|
3
|
+
"version": "0.1.0-lreg-25.alpha.7",
|
|
4
|
+
"description": "Shared ESLint flat config for the LIS ecosystem",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"format": "prettier --write \"src/**/*.js\" \"**/*.{js,cjs,md,json}\"",
|
|
18
|
+
"format:check": "prettier --check \"src/**/*.js\" \"**/*.{js,cjs,md,json}\"",
|
|
19
|
+
"lint": "eslint .",
|
|
20
|
+
"lint:fix": "eslint . --fix",
|
|
21
|
+
"prepare": "if [ ! \"$CI\" ]; then husky; fi",
|
|
22
|
+
"security-audit": "audit-ci",
|
|
23
|
+
"git:pre-commit-hook": "npm run security-audit && npm run format:check && npm run lint"
|
|
24
|
+
},
|
|
25
|
+
"author": "Defra DDTS",
|
|
26
|
+
"license": "OGL-UK-3.0",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"eslint-plugin-jsdoc": "^63.0.8",
|
|
29
|
+
"eslint-plugin-sonarjs": "^4.1.0",
|
|
30
|
+
"neostandard": "0.13.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"eslint": "^9.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"audit-ci": "^7.1.0",
|
|
37
|
+
"eslint": "^9.0.0",
|
|
38
|
+
"husky": "^9.1.7",
|
|
39
|
+
"prettier": "^3.8.4"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import neostandard from 'neostandard'
|
|
2
|
+
import sonarjsConfig from './sonarjs.js'
|
|
3
|
+
import jsdocConfig from './jsdoc.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared ESLint flat config for LIS JavaScript/Node.js repos.
|
|
7
|
+
*
|
|
8
|
+
* Spread this into a repo's own eslint.config.js, appending any
|
|
9
|
+
* repo-specific overrides after it.
|
|
10
|
+
*/
|
|
11
|
+
export default [
|
|
12
|
+
...neostandard({
|
|
13
|
+
env: ['node', 'vitest'],
|
|
14
|
+
ignores: [...neostandard.resolveIgnoresFromGitignore()],
|
|
15
|
+
noJsx: true,
|
|
16
|
+
noStyle: true
|
|
17
|
+
}),
|
|
18
|
+
sonarjsConfig,
|
|
19
|
+
jsdocConfig,
|
|
20
|
+
{
|
|
21
|
+
languageOptions: {
|
|
22
|
+
ecmaVersion: 2025
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
files: ['**/*.test.js', '**/*.spec.js'],
|
|
27
|
+
rules: {
|
|
28
|
+
'sonarjs/no-unused-vars': 'off',
|
|
29
|
+
'sonarjs/no-unused-function-argument': 'off',
|
|
30
|
+
'sonarjs/elseif-without-else': 'off',
|
|
31
|
+
'sonarjs/no-inconsistent-returns': 'off',
|
|
32
|
+
'sonarjs/no-duplicate-string': 'off',
|
|
33
|
+
'sonarjs/no-undefined-assignment': 'off',
|
|
34
|
+
'sonarjs/max-lines-per-function': 'off',
|
|
35
|
+
curly: 'off',
|
|
36
|
+
'max-lines-per-function': 'off',
|
|
37
|
+
'jsdoc/require-jsdoc': 'off',
|
|
38
|
+
'no-magic-numbers': 'off',
|
|
39
|
+
'sonarjs/no-identical-functions': 'off'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
package/src/jsdoc.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import jsdoc from 'eslint-plugin-jsdoc'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSDoc ESLint flat config entry, matching lis-examples-npm's convention of
|
|
5
|
+
* requiring JSDoc @param/@returns annotations on exported functions.
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
plugins: { jsdoc },
|
|
9
|
+
rules: {
|
|
10
|
+
'jsdoc/require-jsdoc': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
publicOnly: true,
|
|
14
|
+
require: {
|
|
15
|
+
FunctionDeclaration: true,
|
|
16
|
+
ArrowFunctionExpression: true,
|
|
17
|
+
FunctionExpression: true,
|
|
18
|
+
MethodDefinition: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
'jsdoc/require-param': 'error',
|
|
23
|
+
'jsdoc/require-param-name': 'error',
|
|
24
|
+
'jsdoc/require-param-type': 'error',
|
|
25
|
+
'jsdoc/require-returns': 'error',
|
|
26
|
+
'jsdoc/require-returns-type': 'error',
|
|
27
|
+
'jsdoc/check-param-names': 'error',
|
|
28
|
+
'jsdoc/check-types': 'warn',
|
|
29
|
+
'jsdoc/no-undefined-types': 'error',
|
|
30
|
+
'jsdoc/valid-types': 'error',
|
|
31
|
+
'jsdoc/check-tag-names': 'error',
|
|
32
|
+
'jsdoc/require-property': 'error',
|
|
33
|
+
'jsdoc/require-property-name': 'error',
|
|
34
|
+
'jsdoc/require-property-type': 'error',
|
|
35
|
+
'jsdoc/check-property-names': 'error',
|
|
36
|
+
'jsdoc/prefer-import-tag': ['error', { exemptTypedefs: false }]
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/sonarjs.js
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import sonarjs from 'eslint-plugin-sonarjs'
|
|
2
|
+
|
|
3
|
+
// Sonar profile thresholds, named so they read as intent rather than magic numbers.
|
|
4
|
+
const MAX_PARAMS = 7 // S107
|
|
5
|
+
const MAX_LINES = 500 // S104
|
|
6
|
+
const MAX_CONTROL_FLOW_NESTING = 3 // S134
|
|
7
|
+
const MAX_LINES_PER_FUNCTION = 75 // S138
|
|
8
|
+
const MAX_EXPRESSION_COMPLEXITY = 5 // S1067
|
|
9
|
+
const DUPLICATE_STRING_THRESHOLD = 3 // S1192
|
|
10
|
+
const MAX_SWITCH_CASES = 30 // S1479
|
|
11
|
+
const MAX_CYCLOMATIC_COMPLEXITY = 10 // S1541
|
|
12
|
+
const MAX_NESTED_FUNCTIONS = 4 // S2004
|
|
13
|
+
const MAX_COGNITIVE_COMPLEXITY = 15 // S3776
|
|
14
|
+
const MAX_FILE_UPLOAD_BYTES = 8_000_000 // S5693
|
|
15
|
+
const MAX_STANDARD_CONTENT_LENGTH_BYTES = 2_000_000 // S5693
|
|
16
|
+
const MAX_REGEX_COMPLEXITY = 20 // S5843
|
|
17
|
+
const SECRET_RANDOMNESS_SENSIBILITY = 5 // S6418
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sonar-derived ESLint flat config entry.
|
|
21
|
+
*
|
|
22
|
+
* Derived from the Defra JavaScript Standard SonarQube quality profile —
|
|
23
|
+
* every rule here has a corresponding entry in that profile.
|
|
24
|
+
*
|
|
25
|
+
* Severity is derived from the profile priority: BLOCKER/CRITICAL/MAJOR -> error,
|
|
26
|
+
* MINOR/INFO -> warn. Each rule is commented with its Sonar key and priority.
|
|
27
|
+
*
|
|
28
|
+
* Coverage: 230 of the profile's 433 javascript-repository rules have a
|
|
29
|
+
* matching eslint-plugin-sonarjs rule and are enabled below. A further 21
|
|
30
|
+
* rules have no sonarjs equivalent but do match a core ESLint rule (also
|
|
31
|
+
* below, each commented with its Sonar key/priority like the sonarjs ones).
|
|
32
|
+
* The remaining 182 have no ESLint equivalent at all. A further 56 rules in
|
|
33
|
+
* the profile's jssecurity and jsarchitecture repositories are out of scope
|
|
34
|
+
* for this plugin entirely.
|
|
35
|
+
*/
|
|
36
|
+
export default {
|
|
37
|
+
plugins: { sonarjs },
|
|
38
|
+
rules: {
|
|
39
|
+
// Core ESLint rules with no eslint-plugin-sonarjs equivalent, verified
|
|
40
|
+
// against the Sonar rule catalog (rules.sonarsource.com) rather than
|
|
41
|
+
// guessed from the Sonar key alone.
|
|
42
|
+
curly: ['error', 'all'], // S121 CRITICAL
|
|
43
|
+
'max-params': ['error', MAX_PARAMS], // S107 MAJOR
|
|
44
|
+
'no-magic-numbers': ['error', { ignore: [-1, 0, 1] }], // S109 MAJOR
|
|
45
|
+
'default-case': 'error', // S131 CRITICAL
|
|
46
|
+
'no-sequences': 'error', // S878 MAJOR
|
|
47
|
+
'no-unused-expressions': 'error', // S905 MAJOR
|
|
48
|
+
'no-unused-private-class-members': 'error', // S1068 MAJOR
|
|
49
|
+
'no-shadow': 'error', // S1117 MAJOR
|
|
50
|
+
'no-unsafe-finally': 'error', // S1143 CRITICAL
|
|
51
|
+
'no-empty-function': 'error', // S1186 CRITICAL
|
|
52
|
+
'no-octal': 'error', // S1314 BLOCKER
|
|
53
|
+
eqeqeq: 'error', // S1440 MAJOR
|
|
54
|
+
'no-self-assign': 'error', // S1656 MAJOR
|
|
55
|
+
'no-unreachable-loop': 'error', // S1751 MAJOR
|
|
56
|
+
'no-caller': 'error', // S2685 MAJOR
|
|
57
|
+
'use-isnan': 'error', // S2688 MAJOR
|
|
58
|
+
'no-redeclare': 'error', // S2814 MAJOR
|
|
59
|
+
'prefer-const': 'error', // S3353 CRITICAL
|
|
60
|
+
'no-var': 'error', // S3504 CRITICAL
|
|
61
|
+
'prefer-template': 'warn', // S3512 MINOR
|
|
62
|
+
'no-throw-literal': 'error', // S3696 MAJOR
|
|
63
|
+
'no-sparse-arrays': 'error', // S4140 MAJOR
|
|
64
|
+
'sonarjs/function-name': ['warn', { format: '^[_a-z][a-zA-Z0-9]*$' }], // S100 MINOR
|
|
65
|
+
'sonarjs/class-name': ['warn', { format: '^[A-Z][a-zA-Z0-9]*$' }], // S101 MINOR
|
|
66
|
+
'sonarjs/max-lines': ['error', { maximum: MAX_LINES }], // S104 MAJOR
|
|
67
|
+
'sonarjs/variable-name': [
|
|
68
|
+
'warn',
|
|
69
|
+
{ format: '^[_$A-Za-z][$A-Za-z0-9]*$|^[_$A-Z][_$A-Z0-9]+$' }
|
|
70
|
+
], // S117 MINOR
|
|
71
|
+
'sonarjs/elseif-without-else': 'error', // S126 CRITICAL
|
|
72
|
+
'sonarjs/no-fallthrough': 'error', // S128 BLOCKER
|
|
73
|
+
'sonarjs/nested-control-flow': [
|
|
74
|
+
'error',
|
|
75
|
+
{ maximumNestingLevel: MAX_CONTROL_FLOW_NESTING }
|
|
76
|
+
], // S134 CRITICAL
|
|
77
|
+
'sonarjs/too-many-break-or-continue-in-loop': 'warn', // S135 MINOR
|
|
78
|
+
'sonarjs/max-lines-per-function': [
|
|
79
|
+
'error',
|
|
80
|
+
{ maximum: MAX_LINES_PER_FUNCTION }
|
|
81
|
+
], // S138 MAJOR
|
|
82
|
+
'sonarjs/no-nested-incdec': 'error', // S881 MAJOR
|
|
83
|
+
'sonarjs/no-equals-in-for-termination': 'error', // S888 CRITICAL
|
|
84
|
+
'sonarjs/no-extra-arguments': 'error', // S930 CRITICAL
|
|
85
|
+
'sonarjs/no-collapsible-if': 'error', // S1066 MAJOR
|
|
86
|
+
'sonarjs/expression-complexity': [
|
|
87
|
+
'error',
|
|
88
|
+
{ max: MAX_EXPRESSION_COMPLEXITY }
|
|
89
|
+
], // S1067 CRITICAL
|
|
90
|
+
'sonarjs/no-labels': 'error', // S1119 MAJOR
|
|
91
|
+
'sonarjs/no-nested-assignment': 'error', // S1121 MAJOR
|
|
92
|
+
'sonarjs/no-redundant-boolean': 'warn', // S1125 MINOR
|
|
93
|
+
'sonarjs/prefer-single-boolean-return': 'warn', // S1126 MINOR
|
|
94
|
+
'sonarjs/unused-import': 'warn', // S1128 MINOR
|
|
95
|
+
'sonarjs/fixme-tag': 'error', // S1134 MAJOR
|
|
96
|
+
'sonarjs/todo-tag': 'warn', // S1135 INFO
|
|
97
|
+
'sonarjs/no-unused-function-argument': 'error', // S1172 MAJOR
|
|
98
|
+
'sonarjs/no-duplicate-string': [
|
|
99
|
+
'error',
|
|
100
|
+
{
|
|
101
|
+
threshold: DUPLICATE_STRING_THRESHOLD,
|
|
102
|
+
ignoreStrings: 'application/json'
|
|
103
|
+
}
|
|
104
|
+
], // S1192 CRITICAL
|
|
105
|
+
'sonarjs/no-case-label-in-switch': 'error', // S1219 BLOCKER
|
|
106
|
+
'sonarjs/no-parameter-reassignment': 'warn', // S1226 MINOR
|
|
107
|
+
'sonarjs/no-floating-point-equality': 'error', // S1244 MAJOR
|
|
108
|
+
'sonarjs/prefer-while': 'warn', // S1264 MINOR
|
|
109
|
+
'sonarjs/no-small-switch': 'warn', // S1301 MINOR
|
|
110
|
+
'sonarjs/no-hardcoded-ip': 'warn', // S1313 MINOR
|
|
111
|
+
'sonarjs/label-position': 'error', // S1439 MAJOR
|
|
112
|
+
'sonarjs/call-argument-line': 'warn', // S1472 MINOR
|
|
113
|
+
'sonarjs/max-switch-cases': ['error', MAX_SWITCH_CASES], // S1479 MAJOR
|
|
114
|
+
'sonarjs/no-unused-vars': 'warn', // S1481 MINOR
|
|
115
|
+
'sonarjs/function-inside-loop': 'error', // S1515 MAJOR
|
|
116
|
+
'sonarjs/code-eval': 'error', // S1523 CRITICAL
|
|
117
|
+
'sonarjs/no-variable-usage-before-declaration': 'error', // S1526 BLOCKER
|
|
118
|
+
'sonarjs/future-reserved-words': 'error', // S1527 BLOCKER
|
|
119
|
+
'sonarjs/array-constructor': 'warn', // S1528 MINOR
|
|
120
|
+
'sonarjs/bitwise-operators': 'error', // S1529 MAJOR
|
|
121
|
+
'sonarjs/no-function-declaration-in-block': 'warn', // S1530 MINOR
|
|
122
|
+
'sonarjs/no-primitive-wrappers': 'warn', // S1533 MINOR
|
|
123
|
+
'sonarjs/for-in': 'error', // S1535 MAJOR
|
|
124
|
+
'sonarjs/cyclomatic-complexity': [
|
|
125
|
+
'error',
|
|
126
|
+
{ threshold: MAX_CYCLOMATIC_COMPLEXITY }
|
|
127
|
+
], // S1541 CRITICAL
|
|
128
|
+
'sonarjs/no-skipped-tests': 'error', // S1607 MAJOR
|
|
129
|
+
'sonarjs/no-identical-expressions': 'error', // S1764 MAJOR
|
|
130
|
+
'sonarjs/no-nested-switch': 'error', // S1821 CRITICAL
|
|
131
|
+
'sonarjs/constructor-for-side-effects': 'error', // S1848 MAJOR
|
|
132
|
+
'sonarjs/no-dead-store': 'error', // S1854 MAJOR
|
|
133
|
+
'sonarjs/no-identical-conditions': 'error', // S1862 MAJOR
|
|
134
|
+
'sonarjs/no-duplicated-branches': 'error', // S1871 MAJOR
|
|
135
|
+
'sonarjs/deprecation': 'warn', // S1874 MINOR
|
|
136
|
+
'sonarjs/no-inverted-boolean-check': 'warn', // S1940 MINOR
|
|
137
|
+
'sonarjs/misplaced-loop-counter': 'error', // S1994 CRITICAL
|
|
138
|
+
'sonarjs/no-nested-functions': [
|
|
139
|
+
'error',
|
|
140
|
+
{ threshold: MAX_NESTED_FUNCTIONS }
|
|
141
|
+
], // S2004 CRITICAL
|
|
142
|
+
'sonarjs/no-hardcoded-passwords': [
|
|
143
|
+
'error',
|
|
144
|
+
{ passwordWords: ['password', 'pwd', 'passwd'] }
|
|
145
|
+
], // S2068 BLOCKER
|
|
146
|
+
'sonarjs/sql-queries': 'error', // S2077 MAJOR
|
|
147
|
+
'sonarjs/insecure-cookie': 'warn', // S2092 MINOR
|
|
148
|
+
'sonarjs/no-useless-increment': 'error', // S2123 MAJOR
|
|
149
|
+
'sonarjs/no-globals-shadowing': 'error', // S2137 MAJOR
|
|
150
|
+
'sonarjs/no-undefined-assignment': 'warn', // S2138 MINOR
|
|
151
|
+
'sonarjs/no-empty-test-file': 'error', // S2187 BLOCKER
|
|
152
|
+
'sonarjs/no-ignored-return': 'error', // S2201 MAJOR
|
|
153
|
+
'sonarjs/arguments-order': 'error', // S2234 MAJOR
|
|
154
|
+
'sonarjs/pseudo-random': 'error', // S2245 CRITICAL
|
|
155
|
+
'sonarjs/for-loop-increment-sign': 'error', // S2251 MAJOR
|
|
156
|
+
'sonarjs/null-dereference': 'error', // S2259 MAJOR
|
|
157
|
+
'sonarjs/no-selector-parameter': 'error', // S2301 MAJOR
|
|
158
|
+
'sonarjs/updated-loop-counter': 'error', // S2310 CRITICAL
|
|
159
|
+
'sonarjs/block-scoped-var': 'error', // S2392 MAJOR
|
|
160
|
+
'sonarjs/no-built-in-override': 'error', // S2424 MAJOR
|
|
161
|
+
'sonarjs/prefer-object-literal': 'warn', // S2428 MINOR
|
|
162
|
+
'sonarjs/no-ignored-exceptions': 'warn', // S2486 MINOR
|
|
163
|
+
'sonarjs/no-gratuitous-expressions': 'error', // S2589 MAJOR
|
|
164
|
+
'sonarjs/file-uploads': 'error', // S2598 CRITICAL
|
|
165
|
+
'sonarjs/file-permissions': 'error', // S2612 MAJOR
|
|
166
|
+
'sonarjs/no-empty-character-class': 'error', // S2639 MAJOR
|
|
167
|
+
'sonarjs/no-unenclosed-multiline-block': 'error', // S2681 MAJOR
|
|
168
|
+
'sonarjs/index-of-compare-to-positive-number': 'error', // S2692 MAJOR
|
|
169
|
+
'sonarjs/assertions-in-tests': 'error', // S2699 BLOCKER
|
|
170
|
+
'sonarjs/no-implicit-global': 'error', // S2703 BLOCKER
|
|
171
|
+
'sonarjs/no-useless-catch': 'warn', // S2737 MINOR
|
|
172
|
+
'sonarjs/xml-parser-xxe': 'error', // S2755 BLOCKER
|
|
173
|
+
'sonarjs/non-existent-operator': 'error', // S2757 MAJOR
|
|
174
|
+
'sonarjs/post-message': 'error', // S2819 CRITICAL
|
|
175
|
+
'sonarjs/no-array-delete': 'error', // S2870 MAJOR
|
|
176
|
+
'sonarjs/no-alphabetical-sort': 'error', // S2871 CRITICAL
|
|
177
|
+
'sonarjs/no-incomplete-assertions': 'error', // S2970 BLOCKER
|
|
178
|
+
'sonarjs/no-global-this': 'warn', // S2990 MINOR
|
|
179
|
+
'sonarjs/new-operator-misuse': ['error', { considerJSDoc: false }], // S2999 MAJOR
|
|
180
|
+
'sonarjs/no-delete-var': 'warn', // S3001 MINOR
|
|
181
|
+
'sonarjs/strings-comparison': 'error', // S3003 MAJOR
|
|
182
|
+
'sonarjs/file-name-differ-from-class': 'warn', // S3317 MINOR
|
|
183
|
+
'sonarjs/cookie-no-httponly': 'warn', // S3330 MINOR
|
|
184
|
+
'sonarjs/no-nested-conditional': 'error', // S3358 MAJOR
|
|
185
|
+
'sonarjs/no-incorrect-string-concat': 'warn', // S3402 MINOR
|
|
186
|
+
'sonarjs/different-types-comparison': 'error', // S3403 MAJOR
|
|
187
|
+
'sonarjs/inverted-assertion-arguments': 'error', // S3415 MAJOR
|
|
188
|
+
'sonarjs/updated-const-var': 'error', // S3500 MAJOR
|
|
189
|
+
'sonarjs/arguments-usage': 'error', // S3513 MAJOR
|
|
190
|
+
'sonarjs/no-invariant-returns': 'error', // S3516 BLOCKER
|
|
191
|
+
'sonarjs/class-prototype': 'error', // S3525 CRITICAL
|
|
192
|
+
'sonarjs/generator-without-yield': 'error', // S3531 MAJOR
|
|
193
|
+
'sonarjs/no-associative-arrays': 'error', // S3579 MAJOR
|
|
194
|
+
'sonarjs/comma-or-logical-or-case': 'error', // S3616 MAJOR
|
|
195
|
+
'sonarjs/no-redundant-jump': 'warn', // S3626 MINOR
|
|
196
|
+
'sonarjs/inconsistent-function-call': 'error', // S3686 MAJOR
|
|
197
|
+
'sonarjs/no-use-of-empty-return-value': 'error', // S3699 MAJOR
|
|
198
|
+
'sonarjs/void-use': 'error', // S3735 CRITICAL
|
|
199
|
+
'sonarjs/operation-returning-nan': 'error', // S3757 MAJOR
|
|
200
|
+
'sonarjs/values-not-convertible-to-numbers': 'error', // S3758 MAJOR
|
|
201
|
+
'sonarjs/non-number-in-arithmetic-expression': 'error', // S3760 MAJOR
|
|
202
|
+
'sonarjs/cognitive-complexity': ['error', MAX_COGNITIVE_COMPLEXITY], // S3776 CRITICAL
|
|
203
|
+
'sonarjs/argument-type': 'error', // S3782 MAJOR
|
|
204
|
+
'sonarjs/in-operator-type-error': 'error', // S3785 CRITICAL
|
|
205
|
+
'sonarjs/array-callback-without-return': 'error', // S3796 BLOCKER
|
|
206
|
+
'sonarjs/function-return-type': 'error', // S3800 MAJOR
|
|
207
|
+
'sonarjs/no-inconsistent-returns': 'error', // S3801 MAJOR
|
|
208
|
+
'sonarjs/no-reference-error': 'error', // S3827 BLOCKER
|
|
209
|
+
'sonarjs/no-all-duplicated-branches': 'error', // S3923 MAJOR
|
|
210
|
+
'sonarjs/no-same-line-conditional': 'error', // S3972 CRITICAL
|
|
211
|
+
'sonarjs/no-collection-size-mischeck': 'error', // S3981 MAJOR
|
|
212
|
+
'sonarjs/no-unthrown-error': 'error', // S3984 MAJOR
|
|
213
|
+
'sonarjs/no-unused-collection': 'error', // S4030 MAJOR
|
|
214
|
+
'sonarjs/no-os-command-from-path': 'warn', // S4036 MINOR
|
|
215
|
+
'sonarjs/no-misleading-array-reverse': 'error', // S4043 MAJOR
|
|
216
|
+
'sonarjs/no-for-in-iterable': 'error', // S4139 MAJOR
|
|
217
|
+
'sonarjs/no-element-overwrite': 'error', // S4143 MAJOR
|
|
218
|
+
'sonarjs/no-identical-functions': 'error', // S4144 MAJOR
|
|
219
|
+
'sonarjs/no-empty-collection': 'warn', // S4158 MINOR
|
|
220
|
+
'sonarjs/no-redundant-assignments': 'error', // S4165 MAJOR
|
|
221
|
+
'sonarjs/weak-ssl': 'error', // S4423 CRITICAL
|
|
222
|
+
'sonarjs/no-weak-keys': 'error', // S4426 CRITICAL
|
|
223
|
+
'sonarjs/csrf': 'error', // S4502 CRITICAL
|
|
224
|
+
'sonarjs/production-debug': 'warn', // S4507 MINOR
|
|
225
|
+
'sonarjs/prefer-default-last': 'error', // S4524 CRITICAL
|
|
226
|
+
'sonarjs/no-in-misuse': 'error', // S4619 MAJOR
|
|
227
|
+
'sonarjs/no-nested-template-literals': 'error', // S4624 MAJOR
|
|
228
|
+
'sonarjs/prefer-promise-shorthand': 'error', // S4634 MAJOR
|
|
229
|
+
'sonarjs/hashing': 'error', // S4790 CRITICAL
|
|
230
|
+
'sonarjs/no-try-promise': 'error', // S4822 MAJOR
|
|
231
|
+
'sonarjs/unverified-certificate': 'error', // S4830 CRITICAL
|
|
232
|
+
'sonarjs/cors': 'warn', // S5122 MINOR
|
|
233
|
+
'sonarjs/link-with-target-blank': 'warn', // S5148 MINOR
|
|
234
|
+
'sonarjs/disabled-auto-escaping': 'error', // S5247 MAJOR
|
|
235
|
+
'sonarjs/table-header': 'error', // S5256 MAJOR
|
|
236
|
+
'sonarjs/no-table-as-layout': 'error', // S5257 MAJOR
|
|
237
|
+
'sonarjs/table-header-reference': 'error', // S5260 CRITICAL
|
|
238
|
+
'sonarjs/object-alt-content': 'warn', // S5264 MINOR
|
|
239
|
+
'sonarjs/no-clear-text-protocols': 'error', // S5332 CRITICAL
|
|
240
|
+
'sonarjs/publicly-writable-directories': 'error', // S5443 CRITICAL
|
|
241
|
+
'sonarjs/unverified-hostname': 'error', // S5527 CRITICAL
|
|
242
|
+
'sonarjs/encryption-secure-mode': 'error', // S5542 CRITICAL
|
|
243
|
+
'sonarjs/no-weak-cipher': 'error', // S5547 CRITICAL
|
|
244
|
+
'sonarjs/insecure-jwt-token': 'error', // S5659 CRITICAL
|
|
245
|
+
'sonarjs/x-powered-by': 'warn', // S5689 MINOR
|
|
246
|
+
'sonarjs/content-length': [
|
|
247
|
+
'error',
|
|
248
|
+
{
|
|
249
|
+
fileUploadSizeLimit: MAX_FILE_UPLOAD_BYTES,
|
|
250
|
+
standardSizeLimit: MAX_STANDARD_CONTENT_LENGTH_BYTES
|
|
251
|
+
}
|
|
252
|
+
], // S5693 MAJOR
|
|
253
|
+
'sonarjs/disabled-resource-integrity': 'warn', // S5725 MINOR
|
|
254
|
+
'sonarjs/content-security-policy': 'warn', // S5728 MINOR
|
|
255
|
+
'sonarjs/no-mime-sniff': 'warn', // S5734 MINOR
|
|
256
|
+
'sonarjs/no-referrer-policy': 'warn', // S5736 MINOR
|
|
257
|
+
'sonarjs/strict-transport-security': 'warn', // S5739 MINOR
|
|
258
|
+
'sonarjs/empty-string-repetition': 'warn', // S5842 MINOR
|
|
259
|
+
'sonarjs/regex-complexity': ['error', { threshold: MAX_REGEX_COMPLEXITY }], // S5843 MAJOR
|
|
260
|
+
'sonarjs/no-incompatible-assertion-types': 'error', // S5845 CRITICAL
|
|
261
|
+
'sonarjs/anchor-precedence': 'error', // S5850 MAJOR
|
|
262
|
+
'sonarjs/slow-regex': 'error', // S5852 CRITICAL
|
|
263
|
+
'sonarjs/no-invalid-regexp': 'error', // S5856 CRITICAL
|
|
264
|
+
'sonarjs/unused-named-groups': 'error', // S5860 MAJOR
|
|
265
|
+
'sonarjs/no-same-argument-assert': 'error', // S5863 MAJOR
|
|
266
|
+
'sonarjs/unicode-aware-regex': 'warn', // S5867 MINOR
|
|
267
|
+
'sonarjs/no-misleading-character-class': 'error', // S5868 MAJOR
|
|
268
|
+
'sonarjs/duplicates-in-character-class': 'error', // S5869 MAJOR
|
|
269
|
+
'sonarjs/session-regeneration': 'error', // S5876 CRITICAL
|
|
270
|
+
'sonarjs/prefer-specific-assertions': 'warn', // S5906 MINOR
|
|
271
|
+
'sonarjs/no-trivial-assertions': 'error', // S5914 MAJOR
|
|
272
|
+
'sonarjs/test-check-exception': 'error', // S5958 MAJOR
|
|
273
|
+
'sonarjs/stable-tests': 'error', // S5973 MAJOR
|
|
274
|
+
'sonarjs/no-empty-after-reluctant': 'error', // S6019 MAJOR
|
|
275
|
+
'sonarjs/single-character-alternation': 'error', // S6035 MAJOR
|
|
276
|
+
'sonarjs/no-code-after-done': 'error', // S6079 CRITICAL
|
|
277
|
+
'sonarjs/disabled-timeout': 'error', // S6080 MAJOR
|
|
278
|
+
'sonarjs/chai-determinate-assertion': 'error', // S6092 MAJOR
|
|
279
|
+
'sonarjs/aws-s3-bucket-insecure-http': 'error', // S6249 CRITICAL
|
|
280
|
+
'sonarjs/aws-s3-bucket-versioning': 'warn', // S6252 MINOR
|
|
281
|
+
'sonarjs/aws-s3-bucket-granted-access': 'error', // S6265 BLOCKER
|
|
282
|
+
'sonarjs/no-angular-bypass-sanitization': 'error', // S6268 BLOCKER
|
|
283
|
+
'sonarjs/aws-iam-public-access': 'error', // S6270 BLOCKER
|
|
284
|
+
'sonarjs/aws-ec2-unencrypted-ebs-volume': 'error', // S6275 MAJOR
|
|
285
|
+
'sonarjs/aws-s3-bucket-public-access': 'error', // S6281 CRITICAL
|
|
286
|
+
'sonarjs/aws-iam-all-privileges': 'error', // S6302 BLOCKER
|
|
287
|
+
'sonarjs/aws-rds-unencrypted-databases': 'error', // S6303 MAJOR
|
|
288
|
+
'sonarjs/aws-opensearchservice-domain': 'error', // S6308 MAJOR
|
|
289
|
+
'sonarjs/aws-iam-privilege-escalation': 'error', // S6317 CRITICAL
|
|
290
|
+
'sonarjs/aws-sagemaker-unencrypted-notebook': 'error', // S6319 MAJOR
|
|
291
|
+
'sonarjs/aws-restricted-ip-admin-access': 'warn', // S6321 MINOR
|
|
292
|
+
'sonarjs/no-empty-alternatives': 'error', // S6323 MAJOR
|
|
293
|
+
'sonarjs/no-control-regex': 'error', // S6324 MAJOR
|
|
294
|
+
'sonarjs/no-regex-spaces': 'error', // S6326 MAJOR
|
|
295
|
+
'sonarjs/aws-sns-unencrypted-topics': 'error', // S6327 MAJOR
|
|
296
|
+
'sonarjs/existing-groups': 'error', // S6328 MAJOR
|
|
297
|
+
'sonarjs/aws-ec2-rds-dms-public': 'error', // S6329 BLOCKER
|
|
298
|
+
'sonarjs/aws-sqs-unencrypted-queue': 'error', // S6330 MAJOR
|
|
299
|
+
'sonarjs/no-empty-group': 'error', // S6331 MAJOR
|
|
300
|
+
'sonarjs/aws-efs-unencrypted': 'error', // S6332 MAJOR
|
|
301
|
+
'sonarjs/aws-apigateway-public-api': 'error', // S6333 BLOCKER
|
|
302
|
+
'sonarjs/stateful-regex': 'error', // S6351 MAJOR
|
|
303
|
+
'sonarjs/concise-regex': 'warn', // S6353 MINOR
|
|
304
|
+
'sonarjs/single-char-in-character-classes': 'error', // S6397 MAJOR
|
|
305
|
+
'sonarjs/no-hardcoded-secrets': [
|
|
306
|
+
'error',
|
|
307
|
+
{
|
|
308
|
+
secretWords: 'api[_.-]?key,auth,credential,secret,token',
|
|
309
|
+
randomnessSensibility: SECRET_RANDOMNESS_SENSIBILITY
|
|
310
|
+
}
|
|
311
|
+
], // S6418 BLOCKER
|
|
312
|
+
'sonarjs/no-exclusive-tests': 'error', // S6426 MAJOR
|
|
313
|
+
'sonarjs/hardcoded-secret-signatures': 'error', // S6437 BLOCKER
|
|
314
|
+
'sonarjs/jsx-no-leaked-render': 'error', // S6439 MAJOR
|
|
315
|
+
'sonarjs/no-hook-setter-in-body': 'error', // S6442 MAJOR
|
|
316
|
+
'sonarjs/no-useless-react-setstate': 'error', // S6443 MAJOR
|
|
317
|
+
'sonarjs/no-uniq-key': 'error', // S6486 MAJOR
|
|
318
|
+
'sonarjs/prefer-regexp-exec': 'warn', // S6594 MINOR
|
|
319
|
+
'sonarjs/no-internal-api-use': 'error', // S6627 MAJOR
|
|
320
|
+
'sonarjs/no-literal-call': 'error', // S6958 CRITICAL
|
|
321
|
+
'sonarjs/reduce-initial-value': 'error', // S6959 MAJOR
|
|
322
|
+
'sonarjs/no-async-constructor': 'error', // S7059 MAJOR
|
|
323
|
+
'sonarjs/review-blockchain-mnemonic': 'error', // S7639 BLOCKER
|
|
324
|
+
'sonarjs/dynamically-constructed-templates': 'error', // S7790 MAJOR
|
|
325
|
+
'sonarjs/no-session-cookies-on-static-assets': 'warn', // S8441 MINOR
|
|
326
|
+
'sonarjs/dompurify-unsafe-config': 'warn', // S8479 MINOR
|
|
327
|
+
'sonarjs/no-duplicate-test-title': 'error', // S8754 MAJOR
|
|
328
|
+
'sonarjs/async-test-assertions': 'error', // S8780 CRITICAL
|
|
329
|
+
'sonarjs/no-empty-test-title': 'error', // S8781 MAJOR
|
|
330
|
+
'sonarjs/hooks-before-test-cases': 'error', // S8782 MAJOR
|
|
331
|
+
'sonarjs/no-forced-browser-interaction': 'error', // S8783 MAJOR
|
|
332
|
+
'sonarjs/super-linear-regex': 'error' // S8786 MAJOR
|
|
333
|
+
}
|
|
334
|
+
}
|