eslint-plugin-sonarjs 3.0.7 → 4.0.0

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.
Files changed (63) hide show
  1. package/cjs/S125/rule.js +8 -7
  2. package/cjs/S7790/rule.js +21 -1
  3. package/cjs/{S3854 → S8441}/generated-meta.js +5 -5
  4. package/cjs/{S3854 → S8441}/meta.js +4 -2
  5. package/cjs/S8441/rule.js +132 -0
  6. package/cjs/helpers/ancestor.js +11 -0
  7. package/cjs/helpers/module-ts.js +7 -2
  8. package/cjs/plugin-rules.js +450 -454
  9. package/docs/arrow-function-convention.md +4 -4
  10. package/docs/class-name.md +3 -3
  11. package/docs/comment-regex.md +5 -5
  12. package/docs/content-length.md +4 -4
  13. package/docs/cyclomatic-complexity.md +3 -3
  14. package/docs/expression-complexity.md +3 -3
  15. package/docs/file-header.md +4 -4
  16. package/docs/function-name.md +3 -3
  17. package/docs/max-lines-per-function.md +3 -3
  18. package/docs/max-lines.md +3 -3
  19. package/docs/max-union-size.md +3 -3
  20. package/docs/nested-control-flow.md +3 -3
  21. package/docs/new-operator-misuse.md +3 -3
  22. package/docs/no-duplicate-string.md +4 -4
  23. package/docs/no-hardcoded-passwords.md +3 -3
  24. package/docs/no-hardcoded-secrets.md +4 -4
  25. package/docs/no-implicit-dependencies.md +3 -3
  26. package/docs/no-intrusive-permissions.md +3 -3
  27. package/docs/no-nested-functions.md +3 -3
  28. package/docs/{code-eval.md → no-session-cookies-on-static-assets.md} +2 -2
  29. package/docs/regex-complexity.md +3 -3
  30. package/docs/variable-name.md +3 -3
  31. package/package.json +1 -37
  32. package/types/S125/rule.d.ts +1 -1
  33. package/types/{S1523 → S8441}/generated-meta.d.ts +2 -2
  34. package/types/S8441/meta.d.ts +3 -0
  35. package/types/helpers/ancestor.d.ts +2 -0
  36. package/types/plugin-rules.d.ts +1 -6
  37. package/cjs/S1523/generated-meta.js +0 -51
  38. package/cjs/S1523/meta.js +0 -21
  39. package/cjs/S1523/rule.js +0 -105
  40. package/cjs/S3723/config.js +0 -25
  41. package/cjs/S3723/generated-meta.js +0 -51
  42. package/cjs/S3723/index.js +0 -21
  43. package/cjs/S3723/meta.js +0 -37
  44. package/cjs/S3723/rule.js +0 -64
  45. package/cjs/S3854/index.js +0 -21
  46. package/cjs/S3854/rule.js +0 -68
  47. package/cjs/external/core.js +0 -23
  48. package/docs/enforce-trailing-comma.md +0 -25
  49. package/docs/super-invocation.md +0 -7
  50. package/types/S1523/meta.d.ts +0 -2
  51. package/types/S3723/config.d.ts +0 -3
  52. package/types/S3723/generated-meta.d.ts +0 -17
  53. package/types/S3723/index.d.ts +0 -1
  54. package/types/S3723/meta.d.ts +0 -4
  55. package/types/S3723/rule.d.ts +0 -8
  56. package/types/S3854/generated-meta.d.ts +0 -17
  57. package/types/S3854/index.d.ts +0 -1
  58. package/types/S3854/meta.d.ts +0 -2
  59. package/types/S3854/rule.d.ts +0 -2
  60. package/types/external/core.d.ts +0 -1
  61. /package/cjs/{S1523 → S8441}/index.js +0 -0
  62. /package/types/{S1523 → S8441}/index.d.ts +0 -0
  63. /package/types/{S1523 → S8441}/rule.d.ts +0 -0
@@ -1,51 +0,0 @@
1
- "use strict";
2
- /*
3
- * SonarQube JavaScript Plugin
4
- * Copyright (C) 2011-2025 SonarSource Sàrl
5
- * mailto:info AT sonarsource DOT com
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- * See the Sonar Source-Available License for more details.
14
- *
15
- * You should have received a copy of the Sonar Source-Available License
16
- * along with this program; if not, see https://sonarsource.com/license/ssal/
17
- */
18
- // https://sonarsource.github.io/rspec/#/rspec/S3723/javascript
19
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
20
- if (k2 === undefined) k2 = k;
21
- var desc = Object.getOwnPropertyDescriptor(m, k);
22
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
23
- desc = { enumerable: true, get: function() { return m[k]; } };
24
- }
25
- Object.defineProperty(o, k2, desc);
26
- }) : (function(o, m, k, k2) {
27
- if (k2 === undefined) k2 = k;
28
- o[k2] = m[k];
29
- }));
30
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
31
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
32
- };
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.requiredDependency = exports.languages = exports.scope = exports.sonarKey = exports.meta = void 0;
35
- __exportStar(require("./meta.js"), exports);
36
- exports.meta = {
37
- type: 'suggestion',
38
- docs: {
39
- description: 'Trailing commas should be used',
40
- recommended: false,
41
- url: 'https://sonarsource.github.io/rspec/#/rspec/S3723/javascript',
42
- requiresTypeChecking: false,
43
- },
44
- fixable: 'code',
45
- deprecated: true,
46
- defaultOptions: ['always-multiline'],
47
- };
48
- exports.sonarKey = 'S3723';
49
- exports.scope = 'Main';
50
- exports.languages = ['js', 'ts'];
51
- exports.requiredDependency = [];
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rule = void 0;
4
- /*
5
- * SonarQube JavaScript Plugin
6
- * Copyright (C) 2011-2025 SonarSource Sàrl
7
- * mailto:info AT sonarsource DOT com
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
- * See the Sonar Source-Available License for more details.
16
- *
17
- * You should have received a copy of the Sonar Source-Available License
18
- * along with this program; if not, see https://sonarsource.com/license/ssal/
19
- */
20
- var rule_js_1 = require("./rule.js");
21
- Object.defineProperty(exports, "rule", { enumerable: true, get: function () { return rule_js_1.rule; } });
package/cjs/S3723/meta.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.quickFixMessage = exports.eslintId = exports.implementation = void 0;
18
- /*
19
- * SonarQube JavaScript Plugin
20
- * Copyright (C) 2011-2025 SonarSource Sàrl
21
- * mailto:info AT sonarsource DOT com
22
- *
23
- * This program is free software; you can redistribute it and/or
24
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
25
- *
26
- * This program is distributed in the hope that it will be useful,
27
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
29
- * See the Sonar Source-Available License for more details.
30
- *
31
- * You should have received a copy of the Sonar Source-Available License
32
- * along with this program; if not, see https://sonarsource.com/license/ssal/
33
- */
34
- exports.implementation = 'original';
35
- exports.eslintId = 'enforce-trailing-comma';
36
- __exportStar(require("./config.js"), exports);
37
- exports.quickFixMessage = 'Add trailing comma';
package/cjs/S3723/rule.js DELETED
@@ -1,64 +0,0 @@
1
- "use strict";
2
- /*
3
- * SonarQube JavaScript Plugin
4
- * Copyright (C) 2011-2025 SonarSource Sàrl
5
- * mailto:info AT sonarsource DOT com
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- * See the Sonar Source-Available License for more details.
14
- *
15
- * You should have received a copy of the Sonar Source-Available License
16
- * along with this program; if not, see https://sonarsource.com/license/ssal/
17
- */
18
- // https://sonarsource.github.io/rspec/#/rspec/S3723/javascript
19
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
20
- if (k2 === undefined) k2 = k;
21
- var desc = Object.getOwnPropertyDescriptor(m, k);
22
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
23
- desc = { enumerable: true, get: function() { return m[k]; } };
24
- }
25
- Object.defineProperty(o, k2, desc);
26
- }) : (function(o, m, k, k2) {
27
- if (k2 === undefined) k2 = k;
28
- o[k2] = m[k];
29
- }));
30
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
31
- Object.defineProperty(o, "default", { enumerable: true, value: v });
32
- }) : function(o, v) {
33
- o["default"] = v;
34
- });
35
- var __importStar = (this && this.__importStar) || (function () {
36
- var ownKeys = function(o) {
37
- ownKeys = Object.getOwnPropertyNames || function (o) {
38
- var ar = [];
39
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
- return ar;
41
- };
42
- return ownKeys(o);
43
- };
44
- return function (mod) {
45
- if (mod && mod.__esModule) return mod;
46
- var result = {};
47
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
48
- __setModuleDefault(result, mod);
49
- return result;
50
- };
51
- })();
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.rule = void 0;
54
- const core_js_1 = require("../external/core.js");
55
- const index_js_1 = require("../helpers/index.js");
56
- const meta = __importStar(require("./generated-meta.js"));
57
- /**
58
- * S1537 ('comma-dangle') and S3723 ('enforce-trailing-comma') both depend on the
59
- * same ESLint implementation, but the plugin doesn't allow rule key duplicates.
60
- */
61
- exports.rule = {
62
- ...(0, core_js_1.getESLintCoreRule)('comma-dangle'),
63
- meta: (0, index_js_1.generateMeta)(meta, (0, core_js_1.getESLintCoreRule)('comma-dangle').meta),
64
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rule = void 0;
4
- /*
5
- * SonarQube JavaScript Plugin
6
- * Copyright (C) 2011-2025 SonarSource Sàrl
7
- * mailto:info AT sonarsource DOT com
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
- * See the Sonar Source-Available License for more details.
16
- *
17
- * You should have received a copy of the Sonar Source-Available License
18
- * along with this program; if not, see https://sonarsource.com/license/ssal/
19
- */
20
- var rule_js_1 = require("./rule.js");
21
- Object.defineProperty(exports, "rule", { enumerable: true, get: function () { return rule_js_1.rule; } });
package/cjs/S3854/rule.js DELETED
@@ -1,68 +0,0 @@
1
- "use strict";
2
- /*
3
- * SonarQube JavaScript Plugin
4
- * Copyright (C) 2011-2025 SonarSource Sàrl
5
- * mailto:info AT sonarsource DOT com
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- * See the Sonar Source-Available License for more details.
14
- *
15
- * You should have received a copy of the Sonar Source-Available License
16
- * along with this program; if not, see https://sonarsource.com/license/ssal/
17
- */
18
- // https://sonarsource.github.io/rspec/#/rspec/S3854/javascript
19
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
20
- if (k2 === undefined) k2 = k;
21
- var desc = Object.getOwnPropertyDescriptor(m, k);
22
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
23
- desc = { enumerable: true, get: function() { return m[k]; } };
24
- }
25
- Object.defineProperty(o, k2, desc);
26
- }) : (function(o, m, k, k2) {
27
- if (k2 === undefined) k2 = k;
28
- o[k2] = m[k];
29
- }));
30
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
31
- Object.defineProperty(o, "default", { enumerable: true, value: v });
32
- }) : function(o, v) {
33
- o["default"] = v;
34
- });
35
- var __importStar = (this && this.__importStar) || (function () {
36
- var ownKeys = function(o) {
37
- ownKeys = Object.getOwnPropertyNames || function (o) {
38
- var ar = [];
39
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
- return ar;
41
- };
42
- return ownKeys(o);
43
- };
44
- return function (mod) {
45
- if (mod && mod.__esModule) return mod;
46
- var result = {};
47
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
48
- __setModuleDefault(result, mod);
49
- return result;
50
- };
51
- })();
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.rule = void 0;
54
- const core_js_1 = require("../external/core.js");
55
- const index_js_1 = require("../helpers/index.js");
56
- const meta = __importStar(require("./generated-meta.js"));
57
- const constructorSuperRule = (0, core_js_1.getESLintCoreRule)('constructor-super');
58
- const noThisBeforeSuperRule = (0, core_js_1.getESLintCoreRule)('no-this-before-super');
59
- exports.rule = {
60
- meta: (0, index_js_1.generateMeta)(meta, {
61
- messages: { ...constructorSuperRule.meta.messages, ...noThisBeforeSuperRule.meta.messages },
62
- }),
63
- create(context) {
64
- const constructorSuperListener = constructorSuperRule.create(context);
65
- const notThisBeforeSuperListener = noThisBeforeSuperRule.create(context);
66
- return (0, index_js_1.mergeRules)(constructorSuperListener, notThisBeforeSuperListener);
67
- },
68
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getESLintCoreRule = getESLintCoreRule;
4
- /*
5
- * SonarQube JavaScript Plugin
6
- * Copyright (C) 2011-2025 SonarSource Sàrl
7
- * mailto:info AT sonarsource DOT com
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
- * See the Sonar Source-Available License for more details.
16
- *
17
- * You should have received a copy of the Sonar Source-Available License
18
- * along with this program; if not, see https://sonarsource.com/license/ssal/
19
- */
20
- const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
21
- function getESLintCoreRule(key) {
22
- return use_at_your_own_risk_1.builtinRules.get(key);
23
- }
@@ -1,25 +0,0 @@
1
- # sonarjs/enforce-trailing-comma
2
-
3
- 📝 Trailing commas should be used.
4
-
5
- ❌ This rule is deprecated.
6
-
7
- 🚫 This rule is _disabled_ in the ✅ `recommended` config.
8
-
9
- 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
10
-
11
- <!-- end auto-generated rule header -->
12
-
13
- ## Options
14
-
15
- <!-- begin auto-generated rule options list -->
16
-
17
- | Name |
18
- | :---------- |
19
- | `arrays` |
20
- | `exports` |
21
- | `functions` |
22
- | `imports` |
23
- | `objects` |
24
-
25
- <!-- end auto-generated rule options list -->
@@ -1,7 +0,0 @@
1
- # sonarjs/super-invocation
2
-
3
- 📝 "super()" should be invoked appropriately.
4
-
5
- 💼 This rule is enabled in the ✅ `recommended` config.
6
-
7
- <!-- end auto-generated rule header -->
@@ -1,2 +0,0 @@
1
- export declare const implementation = "original";
2
- export declare const eslintId = "code-eval";
@@ -1,3 +0,0 @@
1
- export declare const fields: [{
2
- readonly default: "always-multiline";
3
- }];
@@ -1,17 +0,0 @@
1
- export * from './meta.js';
2
- export declare const meta: {
3
- type: "suggestion";
4
- docs: {
5
- description: string;
6
- recommended: boolean;
7
- url: string;
8
- requiresTypeChecking: false;
9
- };
10
- fixable: "code";
11
- deprecated: true;
12
- defaultOptions: string[];
13
- };
14
- export declare const sonarKey = "S3723";
15
- export declare const scope = "Main";
16
- export declare const languages: ('js' | 'ts')[];
17
- export declare const requiredDependency: never[];
@@ -1 +0,0 @@
1
- export { rule } from './rule.js';
@@ -1,4 +0,0 @@
1
- export declare const implementation = "original";
2
- export declare const eslintId = "enforce-trailing-comma";
3
- export * from './config.js';
4
- export declare const quickFixMessage = "Add trailing comma";
@@ -1,8 +0,0 @@
1
- /**
2
- * S1537 ('comma-dangle') and S3723 ('enforce-trailing-comma') both depend on the
3
- * same ESLint implementation, but the plugin doesn't allow rule key duplicates.
4
- */
5
- export declare const rule: {
6
- meta: import("@eslint/core").RulesMeta<string, unknown[], unknown>;
7
- create(context: import("eslint").Rule.RuleContext): import("eslint").Rule.RuleListener;
8
- };
@@ -1,17 +0,0 @@
1
- export * from './meta.js';
2
- export declare const meta: {
3
- type: "problem";
4
- docs: {
5
- description: string;
6
- recommended: boolean;
7
- url: string;
8
- requiresTypeChecking: false;
9
- };
10
- fixable: undefined;
11
- deprecated: false;
12
- defaultOptions: never[];
13
- };
14
- export declare const sonarKey = "S3854";
15
- export declare const scope = "Main";
16
- export declare const languages: ('js' | 'ts')[];
17
- export declare const requiredDependency: never[];
@@ -1 +0,0 @@
1
- export { rule } from './rule.js';
@@ -1,2 +0,0 @@
1
- export declare const implementation = "original";
2
- export declare const eslintId = "super-invocation";
@@ -1,2 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- export declare const rule: Rule.RuleModule;
@@ -1 +0,0 @@
1
- export declare function getESLintCoreRule(key: string): import("eslint").Rule.RuleModule;
File without changes
File without changes
File without changes