eslint-plugin-sonarjs 4.0.0 → 4.0.2
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 +269 -268
- package/cjs/S100/rule.js +7 -5
- package/cjs/S101/rule.js +2 -2
- package/cjs/S104/rule.js +2 -2
- package/cjs/S105/rule.js +2 -2
- package/cjs/S1066/rule.js +5 -4
- package/cjs/S1067/rule.js +8 -6
- package/cjs/S1110/rule.js +7 -5
- package/cjs/S1119/rule.js +85 -7
- package/cjs/S1121/rule.js +4 -3
- package/cjs/S1125/rule.js +9 -8
- package/cjs/S1126/rule.js +2 -2
- package/cjs/S1128/rule.js +8 -5
- package/cjs/S1134/rule.js +2 -2
- package/cjs/S1135/rule.js +2 -2
- package/cjs/S1154/rule.js +6 -4
- package/cjs/S117/rule.js +6 -5
- package/cjs/S1172/rule.js +2 -2
- package/cjs/S1192/rule.js +5 -4
- package/cjs/S1219/rule.js +4 -3
- package/cjs/S1226/rule.js +6 -4
- package/cjs/S124/rule.js +2 -2
- package/cjs/S125/rule.js +9 -7
- package/cjs/S126/rule.js +2 -2
- package/cjs/S1264/rule.js +2 -2
- package/cjs/S128/rule.js +4 -3
- package/cjs/S1291/rule.js +2 -2
- package/cjs/S1301/rule.js +2 -2
- package/cjs/S1313/rule.js +2 -2
- package/cjs/S134/rule.js +7 -5
- package/cjs/S135/rule.js +5 -4
- package/cjs/S138/rule.js +9 -6
- package/cjs/S1439/rule.js +2 -2
- package/cjs/S1444/rule.js +2 -2
- package/cjs/S1451/rule.js +2 -2
- package/cjs/S1472/rule.js +2 -2
- package/cjs/S1479/rule.js +2 -2
- package/cjs/S1481/rule.js +2 -2
- package/cjs/S1488/generated-meta.js +1 -1
- package/cjs/S1488/rule.js +11 -7
- package/cjs/S1515/rule.js +10 -8
- package/cjs/{helpers/aws/index.js → S1523/generated-meta.js} +34 -18
- package/cjs/S1523/index.js +21 -0
- package/cjs/S1523/meta.js +21 -0
- package/cjs/S1523/rule.js +143 -0
- package/cjs/S1526/rule.js +5 -4
- package/cjs/S1527/rule.js +2 -2
- package/cjs/S1528/rule.js +2 -2
- package/cjs/S1529/generated-meta.js +1 -1
- package/cjs/S1529/rule.js +4 -3
- package/cjs/S1530/rule.js +5 -3
- package/cjs/S1533/rule.js +2 -2
- package/cjs/S1535/rule.js +2 -2
- package/cjs/S1541/rule.js +10 -7
- package/cjs/S1607/rule.js +22 -20
- package/cjs/S1764/rule.js +10 -7
- package/cjs/S1821/rule.js +2 -2
- package/cjs/S1848/rule.js +10 -7
- package/cjs/S1854/rule.js +18 -14
- package/cjs/S1862/rule.js +10 -8
- package/cjs/S1871/rule.js +21 -16
- package/cjs/S1874/rule.js +4 -3
- package/cjs/S1940/rule.js +2 -2
- package/cjs/S1994/rule.js +10 -7
- package/cjs/S2004/rule.js +9 -7
- package/cjs/S2068/rule.js +75 -12
- package/cjs/S2077/generated-meta.js +1 -1
- package/cjs/S2077/rule.js +10 -6
- package/cjs/S2092/rule.js +2 -2
- package/cjs/S2123/rule.js +2 -2
- package/cjs/S2137/rule.js +2 -2
- package/cjs/S2138/rule.js +4 -3
- package/cjs/S2187/rule.js +2 -2
- package/cjs/S2201/rule.js +47 -5
- package/cjs/S2208/rule.js +2 -2
- package/cjs/S2234/rule.js +58 -11
- package/cjs/S2245/rule.js +4 -3
- package/cjs/S2251/rule.js +5 -4
- package/cjs/S2255/rule.js +6 -5
- package/cjs/S2259/rule.js +14 -9
- package/cjs/S2301/rule.js +14 -9
- package/cjs/S2310/rule.js +80 -9
- package/cjs/S2392/rule.js +7 -5
- package/cjs/S2424/rule.js +2 -2
- package/cjs/S2428/rule.js +8 -6
- package/cjs/S2486/rule.js +4 -3
- package/cjs/S2589/rule.js +12 -10
- package/cjs/S2598/rule.js +17 -14
- package/cjs/S2612/generated-meta.js +1 -1
- package/cjs/S2612/rule.js +8 -6
- package/cjs/S2639/rule.js +2 -2
- package/cjs/S2681/rule.js +2 -2
- package/cjs/S2692/rule.js +6 -4
- package/cjs/S2699/generated-meta.js +1 -1
- package/cjs/S2699/rule.js +40 -31
- package/cjs/S2703/rule.js +2 -2
- package/cjs/S2737/rule.js +6 -4
- package/cjs/S2755/rule.js +9 -6
- package/cjs/S2757/rule.js +2 -2
- package/cjs/S2817/rule.js +10 -7
- package/cjs/S2819/rule.js +16 -12
- package/cjs/S2870/rule.js +8 -5
- package/cjs/S2871/rule.js +12 -9
- package/cjs/S2970/rule.js +9 -8
- package/cjs/S2990/rule.js +2 -2
- package/cjs/S2999/rule.js +10 -7
- package/cjs/S3001/rule.js +2 -2
- package/cjs/S3003/rule.js +10 -7
- package/cjs/S3317/rule.js +4 -3
- package/cjs/S3330/rule.js +2 -2
- package/cjs/S3358/rule.js +2 -2
- package/cjs/S3402/rule.js +14 -10
- package/cjs/S3403/rule.js +10 -7
- package/cjs/S3415/rule.js +16 -13
- package/cjs/S3499/rule.js +5 -4
- package/cjs/S3500/rule.js +5 -4
- package/cjs/S3513/rule.js +5 -4
- package/cjs/S3514/rule.js +10 -7
- package/cjs/S3516/rule.js +10 -7
- package/cjs/S3524/rule.js +2 -2
- package/cjs/S3525/rule.js +6 -4
- package/cjs/S3531/rule.js +5 -3
- package/cjs/S3533/rule.js +8 -7
- package/cjs/S3579/rule.js +6 -4
- package/cjs/S3616/rule.js +6 -4
- package/cjs/S3626/rule.js +4 -3
- package/cjs/S3686/rule.js +7 -5
- package/cjs/S3699/rule.js +4 -3
- package/cjs/S3735/rule.js +8 -5
- package/cjs/S3757/rule.js +8 -6
- package/cjs/S3758/rule.js +9 -7
- package/cjs/S3760/rule.js +24 -21
- package/cjs/S3776/rule.js +26 -22
- package/cjs/S3782/rule.js +6 -4
- package/cjs/S3785/rule.js +9 -6
- package/cjs/S3796/rule.js +12 -8
- package/cjs/S3798/rule.js +4 -3
- package/cjs/S3800/rule.js +22 -11
- package/cjs/S3801/generated-meta.js +1 -1
- package/cjs/S3801/rule.js +15 -11
- package/cjs/S3827/rule.js +9 -6
- package/cjs/S3923/rule.js +9 -6
- package/cjs/S3972/rule.js +5 -4
- package/cjs/S3973/rule.js +7 -5
- package/cjs/S3981/rule.js +4 -3
- package/cjs/S3984/rule.js +4 -3
- package/cjs/S4030/rule.js +10 -7
- package/cjs/S4036/rule.js +7 -5
- package/cjs/S4043/rule.js +12 -8
- package/cjs/S4139/rule.js +7 -5
- package/cjs/S4143/rule.js +12 -9
- package/cjs/S4144/rule.js +12 -9
- package/cjs/S4158/rule.js +11 -8
- package/cjs/S4165/rule.js +14 -12
- package/cjs/S4322/rule.js +8 -5
- package/cjs/S4323/rule.js +4 -3
- package/cjs/S4324/rule.js +7 -5
- package/cjs/S4328/rule.js +2 -2
- package/cjs/S4335/rule.js +6 -4
- package/cjs/S4423/rule.js +4 -3
- package/cjs/S4423/rule.lib.js +8 -7
- package/cjs/S4426/rule.js +11 -10
- package/cjs/S4502/rule.js +16 -13
- package/cjs/S4507/rule.js +8 -6
- package/cjs/S4524/rule.js +2 -2
- package/cjs/S4619/rule.js +6 -4
- package/cjs/S4621/rule.js +5 -4
- package/cjs/S4622/rule.js +5 -3
- package/cjs/S4623/rule.js +8 -5
- package/cjs/S4624/rule.js +6 -4
- package/cjs/S4634/rule.js +4 -3
- package/cjs/S4721/rule.js +7 -5
- package/cjs/S4782/rule.js +7 -5
- package/cjs/S4784/rule.js +5 -4
- package/cjs/S4787/rule.js +9 -7
- package/cjs/S4790/rule.js +7 -5
- package/cjs/S4798/rule.js +2 -2
- package/cjs/S4817/rule.js +10 -8
- package/cjs/S4818/rule.js +4 -3
- package/cjs/S4822/rule.js +13 -9
- package/cjs/S4823/rule.js +4 -3
- package/cjs/S4829/rule.js +4 -3
- package/cjs/S4830/rule.js +11 -8
- package/cjs/S5042/rule.js +9 -7
- package/cjs/S5122/rule.js +40 -36
- package/cjs/S5148/rule.js +9 -8
- package/cjs/S5247/rule.js +22 -18
- package/cjs/S5256/rule.js +5 -4
- package/cjs/S5257/rule.js +4 -3
- package/cjs/S5260/rule.js +4 -3
- package/cjs/S5264/rule.js +4 -3
- package/cjs/S5332/rule.js +4 -3
- package/cjs/S5332/rule.lib.js +19 -17
- package/cjs/S5443/rule.js +2 -2
- package/cjs/S5527/rule.js +18 -14
- package/cjs/S5542/rule.js +6 -4
- package/cjs/S5547/rule.js +6 -4
- package/cjs/S5604/rule.js +15 -14
- package/cjs/S5659/rule.js +15 -12
- package/cjs/S5689/rule.js +11 -8
- package/cjs/S5691/rule.js +7 -5
- package/cjs/S5693/rule.js +14 -12
- package/cjs/S5725/rule.js +9 -6
- package/cjs/S5728/rule.js +7 -4
- package/cjs/S5730/rule.js +9 -6
- package/cjs/S5732/rule.js +8 -5
- package/cjs/S5734/rule.js +7 -4
- package/cjs/S5736/rule.js +8 -5
- package/cjs/S5739/rule.js +11 -8
- package/cjs/S5742/rule.js +7 -4
- package/cjs/S5743/rule.js +8 -6
- package/cjs/S5757/rule.js +13 -10
- package/cjs/S5759/rule.js +10 -7
- package/cjs/S5842/rule.js +2 -2
- package/cjs/S5843/rule.js +22 -19
- package/cjs/S5850/rule.js +4 -3
- package/cjs/S5852/rule.js +2 -2
- package/cjs/S5856/rule.js +10 -7
- package/cjs/S5860/rule.js +30 -26
- package/cjs/S5863/rule.js +15 -11
- package/cjs/S5867/rule.js +8 -7
- package/cjs/S5868/rule.js +7 -5
- package/cjs/S5869/rule.js +6 -5
- package/cjs/S5876/rule.js +12 -8
- package/cjs/S5958/rule.js +12 -9
- package/cjs/S5973/rule.js +10 -7
- package/cjs/S6019/rule.js +4 -3
- package/cjs/S6035/rule.js +2 -2
- package/cjs/S6079/rule.js +9 -6
- package/cjs/S6080/rule.js +13 -10
- package/cjs/S6092/rule.js +9 -7
- package/cjs/S6245/rule.js +14 -9
- package/cjs/S6249/rule.js +7 -5
- package/cjs/S6252/rule.js +12 -8
- package/cjs/S6265/rule.js +27 -20
- package/cjs/S6268/rule.js +5 -4
- package/cjs/S6270/rule.js +12 -9
- package/cjs/S6275/rule.js +2 -2
- package/cjs/S6281/rule.js +22 -17
- package/cjs/S6299/rule.js +2 -2
- package/cjs/S6302/rule.js +6 -5
- package/cjs/S6303/rule.js +12 -10
- package/cjs/S6304/rule.js +6 -5
- package/cjs/S6308/rule.js +7 -5
- package/cjs/S6317/rule.js +5 -4
- package/cjs/S6319/rule.js +2 -2
- package/cjs/S6321/rule.js +25 -23
- package/cjs/S6323/rule.js +4 -3
- package/cjs/S6324/rule.js +2 -2
- package/cjs/S6326/rule.js +2 -2
- package/cjs/S6327/rule.js +2 -2
- package/cjs/S6328/rule.js +4 -3
- package/cjs/S6329/rule.js +7 -5
- package/cjs/S6330/rule.js +2 -2
- package/cjs/S6332/rule.js +2 -2
- package/cjs/S6333/rule.js +8 -6
- package/cjs/S6351/rule.js +22 -19
- package/cjs/S6353/rule.js +2 -2
- package/cjs/S6397/rule.js +2 -2
- package/cjs/S6418/config.js +1 -1
- package/cjs/S6418/rule.js +9 -24
- package/cjs/S6426/rule.js +5 -4
- package/cjs/S6437/rule.js +10 -7
- package/cjs/S6439/rule.js +9 -7
- package/cjs/S6442/rule.js +11 -8
- package/cjs/S6443/rule.js +9 -7
- package/cjs/S6486/rule.js +5 -4
- package/cjs/S6564/rule.js +4 -3
- package/cjs/S6594/rule.js +12 -8
- package/cjs/S6627/rule.js +6 -4
- package/cjs/S6759/rule.js +10 -6
- package/cjs/S6958/rule.js +2 -2
- package/cjs/S6959/rule.js +9 -6
- package/cjs/S7059/generated-meta.js +1 -1
- package/cjs/S7059/rule.js +8 -5
- package/cjs/S7639/generated-meta.js +1 -1
- package/cjs/S7639/rule.js +5 -4
- package/cjs/S7790/generated-meta.js +1 -1
- package/cjs/S7790/rule.js +7 -5
- package/cjs/S8441/generated-meta.js +1 -1
- package/cjs/S8441/rule.js +13 -9
- package/cjs/S881/rule.js +2 -2
- package/cjs/S888/rule.js +4 -3
- package/cjs/S930/rule.js +14 -12
- package/cjs/helpers/ast.js +11 -8
- package/cjs/helpers/aws/s3.js +9 -6
- package/cjs/helpers/chai.js +41 -43
- package/cjs/helpers/configs.js +92 -0
- package/cjs/helpers/cookie-flag-check.js +19 -17
- package/cjs/helpers/{decorators/index.js → entropy.js} +16 -17
- package/cjs/helpers/express.js +127 -128
- package/cjs/helpers/find-up/all-in-parent-dirs.js +0 -16
- package/cjs/helpers/mocha.js +50 -54
- package/cjs/helpers/regex/ast.js +7 -6
- package/cjs/helpers/regex/extract.js +11 -11
- package/cjs/helpers/regex/group.js +2 -2
- package/cjs/helpers/regex/location.js +2 -2
- package/cjs/helpers/regex/range.js +5 -4
- package/cjs/helpers/regex/rule-template.js +4 -3
- package/cjs/helpers/sinon.js +33 -36
- package/cjs/helpers/supertest.js +34 -37
- package/cjs/helpers/vitest.js +29 -32
- package/cjs/plugin-rules.js +452 -450
- package/docs/assertions-in-tests.md +2 -0
- package/docs/bitwise-operators.md +2 -0
- package/docs/code-eval.md +7 -0
- package/docs/file-permissions.md +1 -1
- package/docs/no-async-constructor.md +2 -0
- package/docs/no-inconsistent-returns.md +2 -0
- package/docs/prefer-immediate-return.md +2 -0
- package/docs/sql-queries.md +2 -0
- package/package.json +39 -1
- package/types/S1067/rule.d.ts +1 -1
- package/types/S1110/rule.d.ts +1 -1
- package/types/S1128/rule.d.ts +1 -1
- package/types/S1172/rule.d.ts +1 -1
- package/types/S1226/rule.d.ts +1 -1
- package/types/S134/rule.d.ts +1 -1
- package/types/S1472/rule.d.ts +1 -1
- package/types/S1481/rule.d.ts +1 -1
- package/types/S1488/generated-meta.d.ts +1 -1
- package/types/S1515/rule.d.ts +1 -1
- package/types/S1523/generated-meta.d.ts +17 -0
- package/types/S1523/index.d.ts +1 -0
- package/types/S1523/meta.d.ts +2 -0
- package/types/S1523/rule.d.ts +2 -0
- package/types/S1527/rule.d.ts +1 -1
- package/types/S1529/generated-meta.d.ts +1 -1
- package/types/S1541/rule.d.ts +1 -1
- package/types/S1862/rule.d.ts +1 -1
- package/types/S2077/generated-meta.d.ts +1 -1
- package/types/S2123/rule.d.ts +1 -1
- package/types/S2259/rule.d.ts +1 -1
- package/types/S2428/rule.d.ts +1 -1
- package/types/S2589/rule.d.ts +1 -1
- package/types/S2598/rule.d.ts +1 -1
- package/types/S2699/generated-meta.d.ts +1 -1
- package/types/S2699/rule.d.ts +1 -1
- package/types/S2737/rule.d.ts +1 -1
- package/types/S2757/rule.d.ts +1 -1
- package/types/S2819/rule.d.ts +1 -1
- package/types/S3001/rule.d.ts +1 -1
- package/types/S3317/rule.d.ts +1 -1
- package/types/S3500/rule.d.ts +1 -1
- package/types/S3513/rule.d.ts +1 -1
- package/types/S3686/rule.d.ts +1 -1
- package/types/S3801/generated-meta.d.ts +1 -1
- package/types/S3972/rule.d.ts +1 -1
- package/types/S3973/rule.d.ts +1 -1
- package/types/S4030/rule.d.ts +1 -1
- package/types/S4143/rule.d.ts +1 -1
- package/types/S4158/rule.d.ts +1 -1
- package/types/S4621/rule.d.ts +1 -1
- package/types/S4782/rule.d.ts +1 -1
- package/types/S5693/rule.d.ts +1 -1
- package/types/S5725/rule.d.ts +1 -1
- package/types/S5860/rule.d.ts +1 -1
- package/types/S5868/rule.d.ts +1 -1
- package/types/S5869/rule.d.ts +1 -1
- package/types/S6079/rule.d.ts +1 -1
- package/types/S6326/rule.d.ts +1 -1
- package/types/S6351/rule.d.ts +1 -1
- package/types/S6418/config.d.ts +1 -1
- package/types/S6443/rule.d.ts +1 -1
- package/types/S7059/generated-meta.d.ts +1 -1
- package/types/S7639/generated-meta.d.ts +1 -1
- package/types/S7790/generated-meta.d.ts +1 -1
- package/types/S8441/generated-meta.d.ts +1 -1
- package/types/S930/rule.d.ts +1 -1
- package/types/helpers/ancestor.d.ts +3 -3
- package/types/helpers/ast.d.ts +1 -1
- package/types/helpers/aws/iam.d.ts +2 -2
- package/types/helpers/aws/s3.d.ts +1 -1
- package/types/helpers/chai.d.ts +3 -5
- package/types/helpers/configs.d.ts +39 -1
- package/types/helpers/entropy.d.ts +1 -0
- package/types/helpers/equivalence.d.ts +1 -1
- package/types/helpers/express.d.ts +38 -43
- package/types/helpers/find-up/all-in-parent-dirs.d.ts +1 -1
- package/types/helpers/find-up/closest.d.ts +1 -1
- package/types/helpers/find-up/find-minimatch.d.ts +1 -1
- package/types/helpers/generate-meta.d.ts +1 -1
- package/types/helpers/mocha.d.ts +19 -21
- package/types/helpers/module.d.ts +1 -1
- package/types/helpers/package-jsons/all-in-parent-dirs.d.ts +1 -1
- package/types/helpers/package-jsons/dependencies.d.ts +1 -1
- package/types/helpers/recognizers/CodeRecognizer.d.ts +1 -1
- package/types/helpers/recognizers/JavaScriptFootPrint.d.ts +2 -2
- package/types/helpers/recognizers/LanguageFootprint.d.ts +1 -1
- package/types/helpers/regex/alternation.d.ts +1 -1
- package/types/helpers/regex/ast.d.ts +1 -1
- package/types/helpers/regex/location.d.ts +2 -2
- package/types/helpers/regex/range.d.ts +2 -2
- package/types/helpers/regex/rule-template.d.ts +1 -1
- package/types/helpers/result.d.ts +1 -1
- package/types/helpers/sinon.d.ts +4 -6
- package/types/helpers/sonar-runtime.d.ts +1 -1
- package/types/helpers/supertest.d.ts +4 -6
- package/types/helpers/type.d.ts +1 -1
- package/types/helpers/vitest.d.ts +4 -6
- package/types/plugin-rules.d.ts +1 -0
- package/cjs/helpers/decorators/interceptor.js +0 -88
- package/cjs/helpers/index.js +0 -60
- package/cjs/helpers/recognizers/index.js +0 -37
- package/cjs/helpers/rule-detect-react.js +0 -29
- package/cjs/helpers/validate-version.js +0 -94
- package/types/helpers/aws/index.d.ts +0 -3
- package/types/helpers/decorators/index.d.ts +0 -2
- package/types/helpers/decorators/interceptor.d.ts +0 -16
- package/types/helpers/index.d.ts +0 -28
- package/types/helpers/recognizers/index.d.ts +0 -2
- package/types/helpers/rule-detect-react.d.ts +0 -2
- package/types/helpers/validate-version.d.ts +0 -13
package/cjs/helpers/mocha.js
CHANGED
|
@@ -1,58 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
-
}
|
|
3
|
+
exports.isTestConstruct = isTestConstruct;
|
|
4
|
+
exports.extractTestCase = extractTestCase;
|
|
5
|
+
exports.isTestCase = isTestCase;
|
|
6
|
+
exports.isDescribeCase = isDescribeCase;
|
|
7
|
+
const ast_js_1 = require("./ast.js");
|
|
8
|
+
const TEST_CONSTRUCTS = [
|
|
9
|
+
'describe',
|
|
10
|
+
'context',
|
|
11
|
+
'it',
|
|
12
|
+
'specify',
|
|
13
|
+
'before',
|
|
14
|
+
'after',
|
|
15
|
+
'beforeEach',
|
|
16
|
+
'afterEach',
|
|
17
|
+
];
|
|
18
|
+
function isTestConstruct(node, constructs = TEST_CONSTRUCTS) {
|
|
19
|
+
return constructs.some(construct => {
|
|
20
|
+
return (node.type === 'CallExpression' &&
|
|
21
|
+
((0, ast_js_1.isIdentifier)(node.callee, construct) ||
|
|
22
|
+
(node.callee.type === 'MemberExpression' &&
|
|
23
|
+
(0, ast_js_1.isIdentifier)(node.callee.object, construct) &&
|
|
24
|
+
(0, ast_js_1.isIdentifier)(node.callee.property, 'only', 'skip'))));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function extractTestCase(node) {
|
|
28
|
+
if (isTestCase(node)) {
|
|
29
|
+
const callExpr = node;
|
|
30
|
+
const [, callback] = callExpr.arguments;
|
|
31
|
+
if (callback && ast_js_1.FUNCTION_NODES.includes(callback.type)) {
|
|
32
|
+
return { node: callExpr.callee, callback: callback };
|
|
34
33
|
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
Mocha.extractTestCase = extractTestCase;
|
|
38
|
-
/**
|
|
39
|
-
* returns true if the node is a test case
|
|
40
|
-
*
|
|
41
|
-
* @param node
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
function isTestCase(node) {
|
|
45
|
-
return isTestConstruct(node, ['it', 'specify']);
|
|
46
|
-
}
|
|
47
|
-
Mocha.isTestCase = isTestCase;
|
|
48
|
-
/**
|
|
49
|
-
* returns true if the node is a describe block
|
|
50
|
-
*
|
|
51
|
-
* @param node
|
|
52
|
-
* @returns
|
|
53
|
-
*/
|
|
54
|
-
function isDescribeCase(node) {
|
|
55
|
-
return isTestConstruct(node, ['describe']);
|
|
56
34
|
}
|
|
57
|
-
|
|
58
|
-
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* returns true if the node is a test case
|
|
39
|
+
*
|
|
40
|
+
* @param node
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
function isTestCase(node) {
|
|
44
|
+
return isTestConstruct(node, ['it', 'specify']);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* returns true if the node is a describe block
|
|
48
|
+
*
|
|
49
|
+
* @param node
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
function isDescribeCase(node) {
|
|
53
|
+
return isTestConstruct(node, ['describe']);
|
|
54
|
+
}
|
package/cjs/helpers/regex/ast.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isRegExpConstructor = isRegExpConstructor;
|
|
4
4
|
exports.isStringReplaceCall = isStringReplaceCall;
|
|
5
5
|
exports.isStringRegexMethodCall = isStringRegexMethodCall;
|
|
6
|
-
const
|
|
6
|
+
const ast_js_1 = require("../ast.js");
|
|
7
|
+
const type_js_1 = require("../type.js");
|
|
7
8
|
function isRegExpConstructor(node) {
|
|
8
9
|
return (((node.type === 'CallExpression' || node.type === 'NewExpression') &&
|
|
9
10
|
node.callee.type === 'Identifier' &&
|
|
@@ -17,7 +18,7 @@ function isStringReplaceCall(call, services) {
|
|
|
17
18
|
!call.callee.computed &&
|
|
18
19
|
['replace', 'replaceAll'].includes(call.callee.property.name) &&
|
|
19
20
|
call.arguments.length > 1 &&
|
|
20
|
-
(0,
|
|
21
|
+
(0, type_js_1.isString)(call.callee.object, services));
|
|
21
22
|
}
|
|
22
23
|
function isStringRegexMethodCall(call, services) {
|
|
23
24
|
return (call.callee.type === 'MemberExpression' &&
|
|
@@ -25,13 +26,13 @@ function isStringRegexMethodCall(call, services) {
|
|
|
25
26
|
!call.callee.computed &&
|
|
26
27
|
['match', 'matchAll', 'search'].includes(call.callee.property.name) &&
|
|
27
28
|
call.arguments.length > 0 &&
|
|
28
|
-
(0,
|
|
29
|
-
(0,
|
|
29
|
+
(0, type_js_1.isString)(call.callee.object, services) &&
|
|
30
|
+
(0, type_js_1.isString)(call.arguments[0], services));
|
|
30
31
|
}
|
|
31
32
|
function isRegExpWithGlobalThis(node) {
|
|
32
33
|
return (node.type === 'NewExpression' &&
|
|
33
34
|
node.callee.type === 'MemberExpression' &&
|
|
34
|
-
(0,
|
|
35
|
-
(0,
|
|
35
|
+
(0, ast_js_1.isIdentifier)(node.callee.object, 'globalThis') &&
|
|
36
|
+
(0, ast_js_1.isIdentifier)(node.callee.property, 'RegExp') &&
|
|
36
37
|
node.arguments.length > 0);
|
|
37
38
|
}
|
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.getParsedRegex = getParsedRegex;
|
|
37
37
|
exports.getPatternFromNode = getPatternFromNode;
|
|
38
38
|
const regexpp = __importStar(require("@eslint-community/regexpp"));
|
|
39
|
-
const
|
|
40
|
-
const
|
|
39
|
+
const ast_js_1 = require("../ast.js");
|
|
40
|
+
const ast_js_2 = require("./ast.js");
|
|
41
41
|
const flags_js_1 = require("./flags.js");
|
|
42
42
|
function getParsedRegex(node, context) {
|
|
43
43
|
const patternAndFlags = getPatternFromNode(node, context);
|
|
@@ -52,7 +52,7 @@ function getParsedRegex(node, context) {
|
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
function getPatternFromNode(node, context) {
|
|
55
|
-
if ((0,
|
|
55
|
+
if ((0, ast_js_2.isRegExpConstructor)(node)) {
|
|
56
56
|
const patternOnly = getPatternFromNode(node.arguments[0], context);
|
|
57
57
|
const flags = (0, flags_js_1.getFlags)(node, context);
|
|
58
58
|
if (patternOnly && flags !== null) {
|
|
@@ -61,26 +61,26 @@ function getPatternFromNode(node, context) {
|
|
|
61
61
|
return { pattern: patternOnly.pattern, flags };
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
else if ((0,
|
|
64
|
+
else if ((0, ast_js_1.isRegexLiteral)(node)) {
|
|
65
65
|
return node.regex;
|
|
66
66
|
}
|
|
67
|
-
else if ((0,
|
|
67
|
+
else if ((0, ast_js_1.isStringLiteral)(node)) {
|
|
68
68
|
return { pattern: node.value, flags: '' };
|
|
69
69
|
}
|
|
70
|
-
else if ((0,
|
|
70
|
+
else if ((0, ast_js_1.isStaticTemplateLiteral)(node)) {
|
|
71
71
|
return { pattern: node.quasis[0].value.raw, flags: '' };
|
|
72
72
|
}
|
|
73
|
-
else if ((0,
|
|
74
|
-
return { pattern: (0,
|
|
73
|
+
else if ((0, ast_js_1.isSimpleRawString)(node)) {
|
|
74
|
+
return { pattern: (0, ast_js_1.getSimpleRawStringValue)(node), flags: '' };
|
|
75
75
|
}
|
|
76
|
-
else if ((0,
|
|
77
|
-
const assignedExpression = (0,
|
|
76
|
+
else if ((0, ast_js_1.isIdentifier)(node)) {
|
|
77
|
+
const assignedExpression = (0, ast_js_1.getUniqueWriteUsage)(context, node.name, node);
|
|
78
78
|
if (assignedExpression &&
|
|
79
79
|
assignedExpression.parent?.type === 'VariableDeclarator') {
|
|
80
80
|
return getPatternFromNode(assignedExpression, context);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
else if ((0,
|
|
83
|
+
else if ((0, ast_js_1.isBinaryPlus)(node)) {
|
|
84
84
|
const left = getPatternFromNode(node.left, context);
|
|
85
85
|
const right = getPatternFromNode(node.right, context);
|
|
86
86
|
if (left && right) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractReferences = extractReferences;
|
|
4
|
-
const
|
|
4
|
+
const ast_js_1 = require("../ast.js");
|
|
5
5
|
function extractReferences(node) {
|
|
6
6
|
const references = [];
|
|
7
|
-
if ((0,
|
|
7
|
+
if ((0, ast_js_1.isStringLiteral)(node)) {
|
|
8
8
|
const str = node.value;
|
|
9
9
|
const reg = /\$(\d+)|\$<([a-zA-Z]\w*)>/g;
|
|
10
10
|
let match;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRegexpLocation = getRegexpLocation;
|
|
4
|
-
const
|
|
4
|
+
const ast_js_1 = require("../ast.js");
|
|
5
5
|
const range_js_1 = require("./range.js");
|
|
6
6
|
/**
|
|
7
7
|
* Gets the regexp node location in the ESLint referential
|
|
@@ -13,7 +13,7 @@ const range_js_1 = require("./range.js");
|
|
|
13
13
|
*/
|
|
14
14
|
function getRegexpLocation(node, regexpNode, context, offset = [0, 0]) {
|
|
15
15
|
let loc;
|
|
16
|
-
if ((0,
|
|
16
|
+
if ((0, ast_js_1.isRegexLiteral)(node) || (0, ast_js_1.isStringLiteral)(node)) {
|
|
17
17
|
const source = context.sourceCode;
|
|
18
18
|
const [start] = node.range;
|
|
19
19
|
const [reStart, reEnd] = (0, range_js_1.getRegexpRange)(node, regexpNode);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRegexpRange = getRegexpRange;
|
|
4
|
-
const
|
|
4
|
+
const collection_js_1 = require("../collection.js");
|
|
5
|
+
const ast_js_1 = require("../ast.js");
|
|
5
6
|
const tokenizer_js_1 = require("./tokenizer.js");
|
|
6
7
|
/**
|
|
7
8
|
* Returns the location of regexpNode relative to the node, which is regexp string or literal. If the computation
|
|
8
9
|
* of location fails, it returns the range of the whole node.
|
|
9
10
|
*/
|
|
10
11
|
function getRegexpRange(node, regexpNode) {
|
|
11
|
-
if ((0,
|
|
12
|
+
if ((0, ast_js_1.isRegexLiteral)(node)) {
|
|
12
13
|
return [regexpNode.start, regexpNode.end];
|
|
13
14
|
}
|
|
14
|
-
if ((0,
|
|
15
|
+
if ((0, ast_js_1.isStringLiteral)(node)) {
|
|
15
16
|
if (node.value === '') {
|
|
16
17
|
return [0, 2];
|
|
17
18
|
}
|
|
@@ -30,7 +31,7 @@ function getRegexpRange(node, regexpNode) {
|
|
|
30
31
|
else {
|
|
31
32
|
// '|' second empty alternative regex node will have start = 2, end = 2
|
|
32
33
|
// +1 is to account for string quote
|
|
33
|
-
return [(0,
|
|
34
|
+
return [(0, collection_js_1.last)(tokens).range[1] + 1, (0, collection_js_1.last)(tokens).range[1] + 1];
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
// regexpNode positions are 1 - based, we need to -1 to report as 0 - based
|
|
@@ -38,7 +38,8 @@ const regexpp = __importStar(require("@eslint-community/regexpp"));
|
|
|
38
38
|
const ast_js_1 = require("./ast.js");
|
|
39
39
|
const extract_js_1 = require("./extract.js");
|
|
40
40
|
const location_js_1 = require("./location.js");
|
|
41
|
-
const
|
|
41
|
+
const location_js_2 = require("../location.js");
|
|
42
|
+
const parser_services_js_1 = require("../parser-services.js");
|
|
42
43
|
/**
|
|
43
44
|
* Rule template to create regex rules.
|
|
44
45
|
* @param handlers - the regexpp node handlers
|
|
@@ -49,7 +50,7 @@ function createRegExpRule(handlers, meta = {}) {
|
|
|
49
50
|
return {
|
|
50
51
|
meta,
|
|
51
52
|
create(context) {
|
|
52
|
-
const services = (0,
|
|
53
|
+
const services = (0, parser_services_js_1.isRequiredParserServices)(context.sourceCode.parserServices)
|
|
53
54
|
? context.sourceCode.parserServices
|
|
54
55
|
: null;
|
|
55
56
|
function checkRegex(node, regExpAST) {
|
|
@@ -66,7 +67,7 @@ function createRegExpRule(handlers, meta = {}) {
|
|
|
66
67
|
const loc = (0, location_js_1.getRegexpLocation)(node, regexpNode, context, offset);
|
|
67
68
|
if (loc) {
|
|
68
69
|
if (secondaryLocations?.length) {
|
|
69
|
-
(0,
|
|
70
|
+
(0, location_js_2.report)(context, { ...rest, loc }, secondaryLocations);
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
context.report({ ...rest, loc });
|
package/cjs/helpers/sinon.js
CHANGED
|
@@ -3,43 +3,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.isImported = isImported;
|
|
7
|
+
exports.isAssertion = isAssertion;
|
|
8
|
+
exports.isTSAssertion = isTSAssertion;
|
|
9
|
+
const module_js_1 = require("./module.js");
|
|
10
|
+
const module_ts_js_1 = require("./module-ts.js");
|
|
8
11
|
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function isImported(context) {
|
|
13
|
+
return ((0, module_js_1.getRequireCalls)(context).some(r => r.arguments[0].type === 'Literal' && r.arguments[0].value === 'sinon') || (0, module_js_1.getImportDeclarations)(context).some(i => i.source.value === 'sinon'));
|
|
14
|
+
}
|
|
15
|
+
function isAssertion(context, node) {
|
|
16
|
+
return isAssertUsage(context, node);
|
|
17
|
+
}
|
|
18
|
+
function isTSAssertion(services, node) {
|
|
19
|
+
if (node.kind !== typescript_1.default.SyntaxKind.CallExpression) {
|
|
20
|
+
return false;
|
|
13
21
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
const fqn = (0, module_ts_js_1.getFullyQualifiedNameTS)(services, node);
|
|
23
|
+
return isFQNAssertion(fqn);
|
|
24
|
+
}
|
|
25
|
+
function isAssertUsage(context, node) {
|
|
26
|
+
// assert.<expr>(), sinon.assert.<expr>()
|
|
27
|
+
const fqn = extractFQNforCallExpression(context, node);
|
|
28
|
+
return isFQNAssertion(fqn);
|
|
29
|
+
}
|
|
30
|
+
function isFQNAssertion(fqn) {
|
|
31
|
+
if (!fqn) {
|
|
32
|
+
return false;
|
|
17
33
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return isFQNAssertion(fqn);
|
|
34
|
+
const names = fqn.split('.');
|
|
35
|
+
return names.length === 3 && names[0] === 'sinon' && names[1] === 'assert';
|
|
36
|
+
}
|
|
37
|
+
function extractFQNforCallExpression(context, node) {
|
|
38
|
+
if (node.type !== 'CallExpression') {
|
|
39
|
+
return undefined;
|
|
25
40
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// assert.<expr>(), sinon.assert.<expr>()
|
|
29
|
-
const fqn = extractFQNforCallExpression(context, node);
|
|
30
|
-
return isFQNAssertion(fqn);
|
|
31
|
-
}
|
|
32
|
-
function isFQNAssertion(fqn) {
|
|
33
|
-
if (!fqn) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const names = fqn.split('.');
|
|
37
|
-
return names.length === 3 && names[0] === 'sinon' && names[1] === 'assert';
|
|
38
|
-
}
|
|
39
|
-
function extractFQNforCallExpression(context, node) {
|
|
40
|
-
if (node.type !== 'CallExpression') {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return (0, index_js_1.getFullyQualifiedName)(context, node);
|
|
44
|
-
}
|
|
45
|
-
})(Sinon || (exports.Sinon = Sinon = {}));
|
|
41
|
+
return (0, module_js_1.getFullyQualifiedName)(context, node);
|
|
42
|
+
}
|
package/cjs/helpers/supertest.js
CHANGED
|
@@ -3,44 +3,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.isImported = isImported;
|
|
7
|
+
exports.isAssertion = isAssertion;
|
|
8
|
+
exports.isTSAssertion = isTSAssertion;
|
|
9
|
+
const module_js_1 = require("./module.js");
|
|
10
|
+
const module_ts_js_1 = require("./module-ts.js");
|
|
8
11
|
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function isImported(context) {
|
|
13
|
+
return ((0, module_js_1.getRequireCalls)(context).some(r => r.arguments[0].type === 'Literal' && r.arguments[0].value === 'supertest') || (0, module_js_1.getImportDeclarations)(context).some(i => i.source.value === 'supertest'));
|
|
14
|
+
}
|
|
15
|
+
function isAssertion(context, node) {
|
|
16
|
+
const fqn = extractFQNForCallExpression(context, node);
|
|
17
|
+
return isFQNAssertion(fqn);
|
|
18
|
+
}
|
|
19
|
+
function isTSAssertion(services, node) {
|
|
20
|
+
if (node.kind !== typescript_1.default.SyntaxKind.CallExpression) {
|
|
21
|
+
return false;
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
const fqn = (0, module_ts_js_1.getFullyQualifiedNameTS)(services, node);
|
|
24
|
+
return isFQNAssertion(fqn);
|
|
25
|
+
}
|
|
26
|
+
function isFQNAssertion(fqn) {
|
|
27
|
+
if (!fqn) {
|
|
28
|
+
return false;
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
const names = fqn.split('.');
|
|
31
|
+
/**
|
|
32
|
+
* supertest assertions look like `[supertest instance](...).[HTTP verb](...).expect(...)`, typically:
|
|
33
|
+
* `supertest(application).get('/foo').expect(200)`
|
|
34
|
+
* hence only the first and third values matter, the second one being an HTTP verb irrelevant for assertion detection
|
|
35
|
+
*/
|
|
36
|
+
return names.length >= 3 && names[0] === 'supertest' && names[2] === 'expect';
|
|
37
|
+
}
|
|
38
|
+
function extractFQNForCallExpression(context, node) {
|
|
39
|
+
if (node.type !== 'CallExpression') {
|
|
40
|
+
return undefined;
|
|
26
41
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!fqn) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const names = fqn.split('.');
|
|
33
|
-
/**
|
|
34
|
-
* supertest assertions look like `[supertest instance](...).[HTTP verb](...).expect(...)`, typically:
|
|
35
|
-
* `supertest(application).get('/foo').expect(200)`
|
|
36
|
-
* hence only the first and third values matter, the second one being an HTTP verb irrelevant for assertion detection
|
|
37
|
-
*/
|
|
38
|
-
return names.length >= 3 && names[0] === 'supertest' && names[2] === 'expect';
|
|
39
|
-
}
|
|
40
|
-
function extractFQNForCallExpression(context, node) {
|
|
41
|
-
if (node.type !== 'CallExpression') {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
return (0, index_js_1.getFullyQualifiedName)(context, node);
|
|
45
|
-
}
|
|
46
|
-
})(Supertest || (exports.Supertest = Supertest = {}));
|
|
42
|
+
return (0, module_js_1.getFullyQualifiedName)(context, node);
|
|
43
|
+
}
|
package/cjs/helpers/vitest.js
CHANGED
|
@@ -3,39 +3,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.isImported = isImported;
|
|
7
|
+
exports.isAssertion = isAssertion;
|
|
8
|
+
exports.isTSAssertion = isTSAssertion;
|
|
9
|
+
const module_js_1 = require("./module.js");
|
|
10
|
+
const module_ts_js_1 = require("./module-ts.js");
|
|
8
11
|
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function isImported(context) {
|
|
13
|
+
return ((0, module_js_1.getRequireCalls)(context).some(r => r.arguments[0].type === 'Literal' && r.arguments[0].value === 'vitest') || (0, module_js_1.getImportDeclarations)(context).some(i => i.source.value === 'vitest'));
|
|
14
|
+
}
|
|
15
|
+
function isAssertion(context, node) {
|
|
16
|
+
const fullyQualifiedName = extractFQNforCallExpression(context, node);
|
|
17
|
+
return isFQNAssertion(fullyQualifiedName);
|
|
18
|
+
}
|
|
19
|
+
function isTSAssertion(services, node) {
|
|
20
|
+
if (node.kind !== typescript_1.default.SyntaxKind.CallExpression) {
|
|
21
|
+
return false;
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
const fqn = (0, module_ts_js_1.getFullyQualifiedNameTS)(services, node);
|
|
24
|
+
return isFQNAssertion(fqn);
|
|
25
|
+
}
|
|
26
|
+
function isFQNAssertion(fqn) {
|
|
27
|
+
if (!fqn) {
|
|
28
|
+
return false;
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return isFQNAssertion(fqn);
|
|
30
|
+
const validAssertionCalls = ['vitest.expect', 'vitest.expectTypeOf', 'vitest.assertType'];
|
|
31
|
+
return validAssertionCalls.some(callPrefix => fqn.startsWith(callPrefix));
|
|
32
|
+
}
|
|
33
|
+
function extractFQNforCallExpression(context, node) {
|
|
34
|
+
if (node.type !== 'CallExpression') {
|
|
35
|
+
return undefined;
|
|
26
36
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!fqn) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const validAssertionCalls = ['vitest.expect', 'vitest.expectTypeOf', 'vitest.assertType'];
|
|
33
|
-
return validAssertionCalls.some(callPrefix => fqn.startsWith(callPrefix));
|
|
34
|
-
}
|
|
35
|
-
function extractFQNforCallExpression(context, node) {
|
|
36
|
-
if (node.type !== 'CallExpression') {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
return (0, index_js_1.getFullyQualifiedName)(context, node);
|
|
40
|
-
}
|
|
41
|
-
})(Vitest || (exports.Vitest = Vitest = {}));
|
|
37
|
+
return (0, module_js_1.getFullyQualifiedName)(context, node);
|
|
38
|
+
}
|