-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Expand file tree
/
Copy patheslint.sonarjs.config.mjs
More file actions
61 lines (59 loc) · 2.01 KB
/
Copy patheslint.sonarjs.config.mjs
File metadata and controls
61 lines (59 loc) · 2.01 KB
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
// eslint.sonarjs.config.mjs
// STANDALONE flat config for the cognitive-complexity ratchet
// (scripts/check/check-cognitive-complexity.mjs).
//
// Intentionally does NOT extend the project's main eslint.config.mjs — it
// enables ONLY `sonarjs/cognitive-complexity` so its violation count is
// isolated from the main lint's ratcheted warning budget (3653).
//
// Run via:
// node_modules/.bin/eslint --no-config-lookup \
// --config eslint.sonarjs.config.mjs --format json src open-sse
import tseslint from "typescript-eslint";
import sonarjs from "eslint-plugin-sonarjs";
/** @type {import("eslint").Linter.Config[]} */
const sonarisCognitiveConfig = [
{
files: ["src/**/*.{ts,tsx}", "open-sse/**/*.{ts,tsx}"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: { jsx: true },
},
},
plugins: { sonarjs },
// Silence inline disable directives that reference rules from OTHER plugins
// (react-hooks, @next/next, etc.) that this standalone config does NOT load.
// Without noInlineConfig those produce error-severity "rule not found" noise
// that pollutes and destabilises the violation count.
linterOptions: {
noInlineConfig: true,
reportUnusedDisableDirectives: "off",
},
// ONLY this one sonarjs rule. Keep the list minimal so the reported count
// is exactly "functions over the cognitive-complexity threshold".
rules: {
"sonarjs/cognitive-complexity": ["error", 15],
},
},
// Ignore everything that is not first-party src/open-sse production code so
// the count is not polluted by tests, type declarations, or build output.
{
ignores: [
"**/*.test.ts",
"**/*.test.tsx",
"**/__tests__/**",
"**/*.d.ts",
"node_modules/**",
"electron/node_modules/**",
"electron/dist-electron/**",
".next/**",
".build/**",
"dist/**",
"coverage/**",
],
},
];
export default sonarisCognitiveConfig;