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.
- package/cjs/S125/rule.js +8 -7
- package/cjs/S7790/rule.js +21 -1
- package/cjs/{S3854 → S8441}/generated-meta.js +5 -5
- package/cjs/{S3854 → S8441}/meta.js +4 -2
- package/cjs/S8441/rule.js +132 -0
- package/cjs/helpers/ancestor.js +11 -0
- package/cjs/helpers/module-ts.js +7 -2
- package/cjs/plugin-rules.js +450 -454
- package/docs/arrow-function-convention.md +4 -4
- package/docs/class-name.md +3 -3
- package/docs/comment-regex.md +5 -5
- package/docs/content-length.md +4 -4
- package/docs/cyclomatic-complexity.md +3 -3
- package/docs/expression-complexity.md +3 -3
- package/docs/file-header.md +4 -4
- package/docs/function-name.md +3 -3
- package/docs/max-lines-per-function.md +3 -3
- package/docs/max-lines.md +3 -3
- package/docs/max-union-size.md +3 -3
- package/docs/nested-control-flow.md +3 -3
- package/docs/new-operator-misuse.md +3 -3
- package/docs/no-duplicate-string.md +4 -4
- package/docs/no-hardcoded-passwords.md +3 -3
- package/docs/no-hardcoded-secrets.md +4 -4
- package/docs/no-implicit-dependencies.md +3 -3
- package/docs/no-intrusive-permissions.md +3 -3
- package/docs/no-nested-functions.md +3 -3
- package/docs/{code-eval.md → no-session-cookies-on-static-assets.md} +2 -2
- package/docs/regex-complexity.md +3 -3
- package/docs/variable-name.md +3 -3
- package/package.json +1 -37
- package/types/S125/rule.d.ts +1 -1
- package/types/{S1523 → S8441}/generated-meta.d.ts +2 -2
- package/types/S8441/meta.d.ts +3 -0
- package/types/helpers/ancestor.d.ts +2 -0
- package/types/plugin-rules.d.ts +1 -6
- package/cjs/S1523/generated-meta.js +0 -51
- package/cjs/S1523/meta.js +0 -21
- package/cjs/S1523/rule.js +0 -105
- package/cjs/S3723/config.js +0 -25
- package/cjs/S3723/generated-meta.js +0 -51
- package/cjs/S3723/index.js +0 -21
- package/cjs/S3723/meta.js +0 -37
- package/cjs/S3723/rule.js +0 -64
- package/cjs/S3854/index.js +0 -21
- package/cjs/S3854/rule.js +0 -68
- package/cjs/external/core.js +0 -23
- package/docs/enforce-trailing-comma.md +0 -25
- package/docs/super-invocation.md +0 -7
- package/types/S1523/meta.d.ts +0 -2
- package/types/S3723/config.d.ts +0 -3
- package/types/S3723/generated-meta.d.ts +0 -17
- package/types/S3723/index.d.ts +0 -1
- package/types/S3723/meta.d.ts +0 -4
- package/types/S3723/rule.d.ts +0 -8
- package/types/S3854/generated-meta.d.ts +0 -17
- package/types/S3854/index.d.ts +0 -1
- package/types/S3854/meta.d.ts +0 -2
- package/types/S3854/rule.d.ts +0 -2
- package/types/external/core.d.ts +0 -1
- /package/cjs/{S1523 → S8441}/index.js +0 -0
- /package/types/{S1523 → S8441}/index.d.ts +0 -0
- /package/types/{S1523 → S8441}/rule.d.ts +0 -0
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------------------------- | :------ |
|
|
15
|
-
| `requireBodyBraces` | Boolean |
|
|
16
|
-
| `requireParameterParentheses` | Boolean |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------------------------- | :------ | :------ |
|
|
15
|
+
| `requireBodyBraces` | Boolean | `false` |
|
|
16
|
+
| `requireParameterParentheses` | Boolean | `false` |
|
|
17
17
|
|
|
18
18
|
<!-- end auto-generated rule options list -->
|
package/docs/class-name.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :------- | :----- |
|
|
15
|
-
| `format` | String |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :------- | :----- | :-------------------- |
|
|
15
|
+
| `format` | String | `^[A-Z][a-zA-Z0-9]*$` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/docs/comment-regex.md
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :------------------ | :----- |
|
|
15
|
-
| `flags` | String |
|
|
16
|
-
| `message` | String |
|
|
17
|
-
| `regularExpression` | String |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :------------------ | :----- | :--------------------------------------------- |
|
|
15
|
+
| `flags` | String | `` |
|
|
16
|
+
| `message` | String | `The regular expression matches this comment.` |
|
|
17
|
+
| `regularExpression` | String | `` |
|
|
18
18
|
|
|
19
19
|
<!-- end auto-generated rule options list -->
|
package/docs/content-length.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------------------- | :------ |
|
|
15
|
-
| `fileUploadSizeLimit` | Integer |
|
|
16
|
-
| `standardSizeLimit` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------------------- | :------ | :-------- |
|
|
15
|
+
| `fileUploadSizeLimit` | Integer | `8000000` |
|
|
16
|
+
| `standardSizeLimit` | Integer | `2000000` |
|
|
17
17
|
|
|
18
18
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------- | :------ |
|
|
15
|
-
| `threshold` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------- | :------ | :------ |
|
|
15
|
+
| `threshold` | Integer | `10` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---- | :------ |
|
|
15
|
-
| `max` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---- | :------ | :------ |
|
|
15
|
+
| `max` | Integer | `3` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/docs/file-header.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------------------- | :------ |
|
|
15
|
-
| `headerFormat` | String |
|
|
16
|
-
| `isRegularExpression` | Boolean |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------------------- | :------ | :------ |
|
|
15
|
+
| `headerFormat` | String | `` |
|
|
16
|
+
| `isRegularExpression` | Boolean | `false` |
|
|
17
17
|
|
|
18
18
|
<!-- end auto-generated rule options list -->
|
package/docs/function-name.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :------- | :----- |
|
|
15
|
-
| `format` | String |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :------- | :----- | :--------------------- |
|
|
15
|
+
| `format` | String | `^[_a-z][a-zA-Z0-9]*$` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------- | :------ |
|
|
15
|
-
| `maximum` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------- | :------ | :------ |
|
|
15
|
+
| `maximum` | Integer | `200` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/docs/max-lines.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------- | :------ |
|
|
15
|
-
| `maximum` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------- | :------ | :------ |
|
|
15
|
+
| `maximum` | Integer | `1000` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/docs/max-union-size.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------- | :------ |
|
|
15
|
-
| `threshold` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------- | :------ | :------ |
|
|
15
|
+
| `threshold` | Integer | `3` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------------------- | :------ |
|
|
15
|
-
| `maximumNestingLevel` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------------------- | :------ | :------ |
|
|
15
|
+
| `maximumNestingLevel` | Integer | `3` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
<!-- begin auto-generated rule options list -->
|
|
14
14
|
|
|
15
|
-
| Name | Type |
|
|
16
|
-
| :-------------- | :------ |
|
|
17
|
-
| `considerJSDoc` | Boolean |
|
|
15
|
+
| Name | Type | Default |
|
|
16
|
+
| :-------------- | :------ | :------ |
|
|
17
|
+
| `considerJSDoc` | Boolean | `false` |
|
|
18
18
|
|
|
19
19
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------------- | :------ |
|
|
15
|
-
| `ignoreStrings` | String |
|
|
16
|
-
| `threshold` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------------- | :------ | :----------------- |
|
|
15
|
+
| `ignoreStrings` | String | `application/json` |
|
|
16
|
+
| `threshold` | Integer | `3` |
|
|
17
17
|
|
|
18
18
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :-------------- | :------- |
|
|
15
|
-
| `passwordWords` | String[] |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :-------------- | :------- | :------------------------------------------ |
|
|
15
|
+
| `passwordWords` | String[] | [`password`, `pwd`, `passwd`, `passphrase`] |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------------------- | :----- |
|
|
15
|
-
| `randomnessSensibility` | Number |
|
|
16
|
-
| `secretWords` | String |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------------------- | :----- | :------------------------------------------ |
|
|
15
|
+
| `randomnessSensibility` | Number | `5` |
|
|
16
|
+
| `secretWords` | String | `api[_.-]?key,auth,credential,secret,token` |
|
|
17
17
|
|
|
18
18
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------- | :------- |
|
|
15
|
-
| `whitelist` | String[] |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------- | :------- | :------ |
|
|
15
|
+
| `whitelist` | String[] | `[]` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :------------ | :------- |
|
|
15
|
-
| `permissions` | String[] |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :------------ | :------- | :-------------- |
|
|
15
|
+
| `permissions` | String[] | [`geolocation`] |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :---------- | :------ |
|
|
15
|
-
| `threshold` | Integer |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :---------- | :------ | :------ |
|
|
15
|
+
| `threshold` | Integer | `4` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/docs/regex-complexity.md
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
<!-- begin auto-generated rule options list -->
|
|
14
14
|
|
|
15
|
-
| Name | Type |
|
|
16
|
-
| :---------- | :------ |
|
|
17
|
-
| `threshold` | Integer |
|
|
15
|
+
| Name | Type | Default |
|
|
16
|
+
| :---------- | :------ | :------ |
|
|
17
|
+
| `threshold` | Integer | `20` |
|
|
18
18
|
|
|
19
19
|
<!-- end auto-generated rule options list -->
|
package/docs/variable-name.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- begin auto-generated rule options list -->
|
|
12
12
|
|
|
13
|
-
| Name | Type |
|
|
14
|
-
| :------- | :----- |
|
|
15
|
-
| `format` | String |
|
|
13
|
+
| Name | Type | Default |
|
|
14
|
+
| :------- | :----- | :------------------------------------------------ |
|
|
15
|
+
| `format` | String | `^[_$A-Za-z][$A-Za-z0-9]*$\|^[_$A-Z][_$A-Z0-9]+$` |
|
|
16
16
|
|
|
17
17
|
<!-- end auto-generated rule options list -->
|
package/package.json
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint-plugin-sonarjs",
|
|
3
|
-
"description": "SonarJS rules for ESLint",
|
|
4
|
-
"version": "3.0.7",
|
|
5
|
-
"main": "./cjs/plugin.js",
|
|
6
|
-
"types": "./types/plugin.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/SonarSource/SonarJS.git"
|
|
10
|
-
},
|
|
11
|
-
"author": "SonarSource",
|
|
12
|
-
"license": "LGPL-3.0-only",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"sonarjs",
|
|
15
|
-
"eslint",
|
|
16
|
-
"eslintplugin"
|
|
17
|
-
],
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://community.sonarsource.com/"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@eslint-community/regexpp": "4.12.2",
|
|
24
|
-
"builtin-modules": "3.3.0",
|
|
25
|
-
"bytes": "3.1.2",
|
|
26
|
-
"functional-red-black-tree": "1.0.1",
|
|
27
|
-
"jsx-ast-utils-x": "0.1.0",
|
|
28
|
-
"lodash.merge": "4.6.2",
|
|
29
|
-
"minimatch": "10.1.2",
|
|
30
|
-
"scslre": "0.3.0",
|
|
31
|
-
"semver": "7.7.4",
|
|
32
|
-
"typescript": ">=5"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"eslint": "^8.0.0 || ^9.0.0"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{"author":"SonarSource","bugs":{"url":"https://community.sonarsource.com/"},"description":"SonarJS rules for ESLint","homepage":"https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md","keywords":["sonarjs","eslint","eslintplugin"],"license":"LGPL-3.0-only","main":"./cjs/plugin.js","peerDependencies":{"eslint":"^8.0.0 || ^9.0.0 || ^10.0.0"},"repository":{"type":"git","url":"git+https://github.com/SonarSource/SonarJS.git"},"types":"./types/plugin.d.ts","name":"eslint-plugin-sonarjs","version":"4.0.0","dependencies":{"typescript":">=5","semver":"7.7.4","jsx-ast-utils-x":"0.1.0","lodash.merge":"4.6.2","functional-red-black-tree":"1.0.1","@eslint-community/regexpp":"4.12.2","minimatch":"10.2.1","ts-api-utils":"2.4.0","scslre":"0.3.0","bytes":"3.1.2","builtin-modules":"3.3.0","globals":"17.3.0"}}
|
package/types/S125/rule.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Rule } from 'eslint';
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
2
|
export declare const rule: Rule.RuleModule;
|
|
@@ -11,7 +11,7 @@ export declare const meta: {
|
|
|
11
11
|
deprecated: false;
|
|
12
12
|
defaultOptions: never[];
|
|
13
13
|
};
|
|
14
|
-
export declare const sonarKey = "
|
|
15
|
-
export declare const scope = "
|
|
14
|
+
export declare const sonarKey = "S8441";
|
|
15
|
+
export declare const scope = "All";
|
|
16
16
|
export declare const languages: ('js' | 'ts')[];
|
|
17
17
|
export declare const requiredDependency: never[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
2
|
import { Rule, SourceCode } from 'eslint';
|
|
3
3
|
import type { Node } from 'estree';
|
|
4
|
+
import ts from 'typescript';
|
|
4
5
|
export declare function findFirstMatchingLocalAncestor(node: TSESTree.Node, predicate: (node: TSESTree.Node) => boolean): TSESTree.Node | undefined;
|
|
5
6
|
export declare function findFirstMatchingAncestor(node: TSESTree.Node, predicate: (node: TSESTree.Node) => boolean): TSESTree.Node | undefined;
|
|
6
7
|
export declare function localAncestorsChain(node: TSESTree.Node): TSESTree.Node[];
|
|
@@ -28,3 +29,4 @@ export declare function getNodeParent(node: Node): Node;
|
|
|
28
29
|
* @returns the node children
|
|
29
30
|
*/
|
|
30
31
|
export declare function childrenOf(node: Node, visitorKeys: SourceCode.VisitorKeys): Node[];
|
|
32
|
+
export declare function isTsAncestor(candidate: ts.Node, node: ts.Node): boolean;
|
package/types/plugin-rules.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ export declare const rules: {
|
|
|
41
41
|
'no-unused-vars': import("eslint").Rule.RuleModule;
|
|
42
42
|
'prefer-immediate-return': import("eslint").Rule.RuleModule;
|
|
43
43
|
'function-inside-loop': import("eslint").Rule.RuleModule;
|
|
44
|
-
'code-eval': import("eslint").Rule.RuleModule;
|
|
45
44
|
'no-variable-usage-before-declaration': import("eslint").Rule.RuleModule;
|
|
46
45
|
'future-reserved-words': import("eslint").Rule.RuleModule;
|
|
47
46
|
'array-constructor': import("eslint").Rule.RuleModule;
|
|
@@ -121,10 +120,6 @@ export declare const rules: {
|
|
|
121
120
|
'no-redundant-jump': import("eslint").Rule.RuleModule;
|
|
122
121
|
'inconsistent-function-call': import("eslint").Rule.RuleModule;
|
|
123
122
|
'no-use-of-empty-return-value': import("eslint").Rule.RuleModule;
|
|
124
|
-
'enforce-trailing-comma': {
|
|
125
|
-
meta: import("@eslint/core").RulesMeta<string, unknown[], unknown>;
|
|
126
|
-
create(context: import("eslint").Rule.RuleContext): import("eslint").Rule.RuleListener;
|
|
127
|
-
};
|
|
128
123
|
'void-use': import("eslint").Rule.RuleModule;
|
|
129
124
|
'operation-returning-nan': import("eslint").Rule.RuleModule;
|
|
130
125
|
'values-not-convertible-to-numbers': import("eslint").Rule.RuleModule;
|
|
@@ -137,7 +132,6 @@ export declare const rules: {
|
|
|
137
132
|
'function-return-type': import("eslint").Rule.RuleModule;
|
|
138
133
|
'no-inconsistent-returns': import("eslint").Rule.RuleModule;
|
|
139
134
|
'no-reference-error': import("eslint").Rule.RuleModule;
|
|
140
|
-
'super-invocation': import("eslint").Rule.RuleModule;
|
|
141
135
|
'no-all-duplicated-branches': import("eslint").Rule.RuleModule;
|
|
142
136
|
'no-same-line-conditional': import("eslint").Rule.RuleModule;
|
|
143
137
|
'conditional-indentation': import("eslint").Rule.RuleModule;
|
|
@@ -271,4 +265,5 @@ export declare const rules: {
|
|
|
271
265
|
'no-async-constructor': import("eslint").Rule.RuleModule;
|
|
272
266
|
'review-blockchain-mnemonic': import("eslint").Rule.RuleModule;
|
|
273
267
|
'dynamically-constructed-templates': import("eslint").Rule.RuleModule;
|
|
268
|
+
'no-session-cookies-on-static-assets': import("eslint").Rule.RuleModule;
|
|
274
269
|
};
|
|
@@ -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/S1523/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: 'problem',
|
|
38
|
-
docs: {
|
|
39
|
-
description: 'Dynamically executing code is security-sensitive',
|
|
40
|
-
recommended: true,
|
|
41
|
-
url: 'https://sonarsource.github.io/rspec/#/rspec/S1523/javascript',
|
|
42
|
-
requiresTypeChecking: false,
|
|
43
|
-
},
|
|
44
|
-
fixable: undefined,
|
|
45
|
-
deprecated: false,
|
|
46
|
-
defaultOptions: [],
|
|
47
|
-
};
|
|
48
|
-
exports.sonarKey = 'S1523';
|
|
49
|
-
exports.scope = 'Main';
|
|
50
|
-
exports.languages = ['js', 'ts'];
|
|
51
|
-
exports.requiredDependency = [];
|
package/cjs/S1523/meta.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.eslintId = exports.implementation = 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
|
-
exports.implementation = 'original';
|
|
21
|
-
exports.eslintId = 'code-eval';
|
package/cjs/S1523/rule.js
DELETED
|
@@ -1,105 +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/S1523/javascript
|
|
19
|
-
// SQ key 'eval'
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(o, k2, desc);
|
|
27
|
-
}) : (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
o[k2] = m[k];
|
|
30
|
-
}));
|
|
31
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
-
}) : function(o, v) {
|
|
34
|
-
o["default"] = v;
|
|
35
|
-
});
|
|
36
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
-
var ownKeys = function(o) {
|
|
38
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
-
var ar = [];
|
|
40
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
-
return ar;
|
|
42
|
-
};
|
|
43
|
-
return ownKeys(o);
|
|
44
|
-
};
|
|
45
|
-
return function (mod) {
|
|
46
|
-
if (mod && mod.__esModule) return mod;
|
|
47
|
-
var result = {};
|
|
48
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
-
__setModuleDefault(result, mod);
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
})();
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.rule = void 0;
|
|
55
|
-
const core_js_1 = require("../external/core.js");
|
|
56
|
-
const index_js_1 = require("../helpers/index.js");
|
|
57
|
-
const meta = __importStar(require("./generated-meta.js"));
|
|
58
|
-
const noScriptUrlRule = (0, core_js_1.getESLintCoreRule)('no-script-url');
|
|
59
|
-
const EVAL_LIKE_FUNCTIONS = new Set([
|
|
60
|
-
'eval',
|
|
61
|
-
'Function',
|
|
62
|
-
'vm.Script',
|
|
63
|
-
'vm.SourceTextModule',
|
|
64
|
-
'vm.runInContext',
|
|
65
|
-
'vm.runInNewContext',
|
|
66
|
-
'vm.runInThisContext',
|
|
67
|
-
]);
|
|
68
|
-
exports.rule = {
|
|
69
|
-
meta: (0, index_js_1.generateMeta)(meta, {
|
|
70
|
-
messages: {
|
|
71
|
-
safeCode: 'Make sure that this dynamic injection or execution of code is safe.',
|
|
72
|
-
unexpectedScriptURL: "Make sure that 'javascript:' code is safe as it is a form of eval().",
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
create(context) {
|
|
76
|
-
return {
|
|
77
|
-
CallExpression: (node) => checkCallExpression(node, context),
|
|
78
|
-
NewExpression: (node) => checkCallExpression(node, context),
|
|
79
|
-
...noScriptUrlRule.create(context),
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
function checkCallExpression(node, context) {
|
|
84
|
-
if (['Identifier', 'MemberExpression'].includes(node.callee.type)) {
|
|
85
|
-
const name = (0, index_js_1.getFullyQualifiedName)(context, node) || '';
|
|
86
|
-
if (EVAL_LIKE_FUNCTIONS.has(name) && hasAtLeastOneVariableArgument(node.arguments)) {
|
|
87
|
-
context.report({
|
|
88
|
-
messageId: 'safeCode',
|
|
89
|
-
node: node.callee,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function hasAtLeastOneVariableArgument(args) {
|
|
95
|
-
return args.some(arg => !isLiteral(arg));
|
|
96
|
-
}
|
|
97
|
-
function isLiteral(node) {
|
|
98
|
-
if (node.type === 'Literal') {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
if (node.type === 'TemplateLiteral') {
|
|
102
|
-
return node.expressions.length === 0;
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
package/cjs/S3723/config.js
DELETED
|
@@ -1,25 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.fields = void 0;
|
|
21
|
-
exports.fields = [
|
|
22
|
-
{
|
|
23
|
-
default: 'always-multiline',
|
|
24
|
-
},
|
|
25
|
-
];
|