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.
Files changed (413) hide show
  1. package/README.md +269 -268
  2. package/cjs/S100/rule.js +7 -5
  3. package/cjs/S101/rule.js +2 -2
  4. package/cjs/S104/rule.js +2 -2
  5. package/cjs/S105/rule.js +2 -2
  6. package/cjs/S1066/rule.js +5 -4
  7. package/cjs/S1067/rule.js +8 -6
  8. package/cjs/S1110/rule.js +7 -5
  9. package/cjs/S1119/rule.js +85 -7
  10. package/cjs/S1121/rule.js +4 -3
  11. package/cjs/S1125/rule.js +9 -8
  12. package/cjs/S1126/rule.js +2 -2
  13. package/cjs/S1128/rule.js +8 -5
  14. package/cjs/S1134/rule.js +2 -2
  15. package/cjs/S1135/rule.js +2 -2
  16. package/cjs/S1154/rule.js +6 -4
  17. package/cjs/S117/rule.js +6 -5
  18. package/cjs/S1172/rule.js +2 -2
  19. package/cjs/S1192/rule.js +5 -4
  20. package/cjs/S1219/rule.js +4 -3
  21. package/cjs/S1226/rule.js +6 -4
  22. package/cjs/S124/rule.js +2 -2
  23. package/cjs/S125/rule.js +9 -7
  24. package/cjs/S126/rule.js +2 -2
  25. package/cjs/S1264/rule.js +2 -2
  26. package/cjs/S128/rule.js +4 -3
  27. package/cjs/S1291/rule.js +2 -2
  28. package/cjs/S1301/rule.js +2 -2
  29. package/cjs/S1313/rule.js +2 -2
  30. package/cjs/S134/rule.js +7 -5
  31. package/cjs/S135/rule.js +5 -4
  32. package/cjs/S138/rule.js +9 -6
  33. package/cjs/S1439/rule.js +2 -2
  34. package/cjs/S1444/rule.js +2 -2
  35. package/cjs/S1451/rule.js +2 -2
  36. package/cjs/S1472/rule.js +2 -2
  37. package/cjs/S1479/rule.js +2 -2
  38. package/cjs/S1481/rule.js +2 -2
  39. package/cjs/S1488/generated-meta.js +1 -1
  40. package/cjs/S1488/rule.js +11 -7
  41. package/cjs/S1515/rule.js +10 -8
  42. package/cjs/{helpers/aws/index.js → S1523/generated-meta.js} +34 -18
  43. package/cjs/S1523/index.js +21 -0
  44. package/cjs/S1523/meta.js +21 -0
  45. package/cjs/S1523/rule.js +143 -0
  46. package/cjs/S1526/rule.js +5 -4
  47. package/cjs/S1527/rule.js +2 -2
  48. package/cjs/S1528/rule.js +2 -2
  49. package/cjs/S1529/generated-meta.js +1 -1
  50. package/cjs/S1529/rule.js +4 -3
  51. package/cjs/S1530/rule.js +5 -3
  52. package/cjs/S1533/rule.js +2 -2
  53. package/cjs/S1535/rule.js +2 -2
  54. package/cjs/S1541/rule.js +10 -7
  55. package/cjs/S1607/rule.js +22 -20
  56. package/cjs/S1764/rule.js +10 -7
  57. package/cjs/S1821/rule.js +2 -2
  58. package/cjs/S1848/rule.js +10 -7
  59. package/cjs/S1854/rule.js +18 -14
  60. package/cjs/S1862/rule.js +10 -8
  61. package/cjs/S1871/rule.js +21 -16
  62. package/cjs/S1874/rule.js +4 -3
  63. package/cjs/S1940/rule.js +2 -2
  64. package/cjs/S1994/rule.js +10 -7
  65. package/cjs/S2004/rule.js +9 -7
  66. package/cjs/S2068/rule.js +75 -12
  67. package/cjs/S2077/generated-meta.js +1 -1
  68. package/cjs/S2077/rule.js +10 -6
  69. package/cjs/S2092/rule.js +2 -2
  70. package/cjs/S2123/rule.js +2 -2
  71. package/cjs/S2137/rule.js +2 -2
  72. package/cjs/S2138/rule.js +4 -3
  73. package/cjs/S2187/rule.js +2 -2
  74. package/cjs/S2201/rule.js +47 -5
  75. package/cjs/S2208/rule.js +2 -2
  76. package/cjs/S2234/rule.js +58 -11
  77. package/cjs/S2245/rule.js +4 -3
  78. package/cjs/S2251/rule.js +5 -4
  79. package/cjs/S2255/rule.js +6 -5
  80. package/cjs/S2259/rule.js +14 -9
  81. package/cjs/S2301/rule.js +14 -9
  82. package/cjs/S2310/rule.js +80 -9
  83. package/cjs/S2392/rule.js +7 -5
  84. package/cjs/S2424/rule.js +2 -2
  85. package/cjs/S2428/rule.js +8 -6
  86. package/cjs/S2486/rule.js +4 -3
  87. package/cjs/S2589/rule.js +12 -10
  88. package/cjs/S2598/rule.js +17 -14
  89. package/cjs/S2612/generated-meta.js +1 -1
  90. package/cjs/S2612/rule.js +8 -6
  91. package/cjs/S2639/rule.js +2 -2
  92. package/cjs/S2681/rule.js +2 -2
  93. package/cjs/S2692/rule.js +6 -4
  94. package/cjs/S2699/generated-meta.js +1 -1
  95. package/cjs/S2699/rule.js +40 -31
  96. package/cjs/S2703/rule.js +2 -2
  97. package/cjs/S2737/rule.js +6 -4
  98. package/cjs/S2755/rule.js +9 -6
  99. package/cjs/S2757/rule.js +2 -2
  100. package/cjs/S2817/rule.js +10 -7
  101. package/cjs/S2819/rule.js +16 -12
  102. package/cjs/S2870/rule.js +8 -5
  103. package/cjs/S2871/rule.js +12 -9
  104. package/cjs/S2970/rule.js +9 -8
  105. package/cjs/S2990/rule.js +2 -2
  106. package/cjs/S2999/rule.js +10 -7
  107. package/cjs/S3001/rule.js +2 -2
  108. package/cjs/S3003/rule.js +10 -7
  109. package/cjs/S3317/rule.js +4 -3
  110. package/cjs/S3330/rule.js +2 -2
  111. package/cjs/S3358/rule.js +2 -2
  112. package/cjs/S3402/rule.js +14 -10
  113. package/cjs/S3403/rule.js +10 -7
  114. package/cjs/S3415/rule.js +16 -13
  115. package/cjs/S3499/rule.js +5 -4
  116. package/cjs/S3500/rule.js +5 -4
  117. package/cjs/S3513/rule.js +5 -4
  118. package/cjs/S3514/rule.js +10 -7
  119. package/cjs/S3516/rule.js +10 -7
  120. package/cjs/S3524/rule.js +2 -2
  121. package/cjs/S3525/rule.js +6 -4
  122. package/cjs/S3531/rule.js +5 -3
  123. package/cjs/S3533/rule.js +8 -7
  124. package/cjs/S3579/rule.js +6 -4
  125. package/cjs/S3616/rule.js +6 -4
  126. package/cjs/S3626/rule.js +4 -3
  127. package/cjs/S3686/rule.js +7 -5
  128. package/cjs/S3699/rule.js +4 -3
  129. package/cjs/S3735/rule.js +8 -5
  130. package/cjs/S3757/rule.js +8 -6
  131. package/cjs/S3758/rule.js +9 -7
  132. package/cjs/S3760/rule.js +24 -21
  133. package/cjs/S3776/rule.js +26 -22
  134. package/cjs/S3782/rule.js +6 -4
  135. package/cjs/S3785/rule.js +9 -6
  136. package/cjs/S3796/rule.js +12 -8
  137. package/cjs/S3798/rule.js +4 -3
  138. package/cjs/S3800/rule.js +22 -11
  139. package/cjs/S3801/generated-meta.js +1 -1
  140. package/cjs/S3801/rule.js +15 -11
  141. package/cjs/S3827/rule.js +9 -6
  142. package/cjs/S3923/rule.js +9 -6
  143. package/cjs/S3972/rule.js +5 -4
  144. package/cjs/S3973/rule.js +7 -5
  145. package/cjs/S3981/rule.js +4 -3
  146. package/cjs/S3984/rule.js +4 -3
  147. package/cjs/S4030/rule.js +10 -7
  148. package/cjs/S4036/rule.js +7 -5
  149. package/cjs/S4043/rule.js +12 -8
  150. package/cjs/S4139/rule.js +7 -5
  151. package/cjs/S4143/rule.js +12 -9
  152. package/cjs/S4144/rule.js +12 -9
  153. package/cjs/S4158/rule.js +11 -8
  154. package/cjs/S4165/rule.js +14 -12
  155. package/cjs/S4322/rule.js +8 -5
  156. package/cjs/S4323/rule.js +4 -3
  157. package/cjs/S4324/rule.js +7 -5
  158. package/cjs/S4328/rule.js +2 -2
  159. package/cjs/S4335/rule.js +6 -4
  160. package/cjs/S4423/rule.js +4 -3
  161. package/cjs/S4423/rule.lib.js +8 -7
  162. package/cjs/S4426/rule.js +11 -10
  163. package/cjs/S4502/rule.js +16 -13
  164. package/cjs/S4507/rule.js +8 -6
  165. package/cjs/S4524/rule.js +2 -2
  166. package/cjs/S4619/rule.js +6 -4
  167. package/cjs/S4621/rule.js +5 -4
  168. package/cjs/S4622/rule.js +5 -3
  169. package/cjs/S4623/rule.js +8 -5
  170. package/cjs/S4624/rule.js +6 -4
  171. package/cjs/S4634/rule.js +4 -3
  172. package/cjs/S4721/rule.js +7 -5
  173. package/cjs/S4782/rule.js +7 -5
  174. package/cjs/S4784/rule.js +5 -4
  175. package/cjs/S4787/rule.js +9 -7
  176. package/cjs/S4790/rule.js +7 -5
  177. package/cjs/S4798/rule.js +2 -2
  178. package/cjs/S4817/rule.js +10 -8
  179. package/cjs/S4818/rule.js +4 -3
  180. package/cjs/S4822/rule.js +13 -9
  181. package/cjs/S4823/rule.js +4 -3
  182. package/cjs/S4829/rule.js +4 -3
  183. package/cjs/S4830/rule.js +11 -8
  184. package/cjs/S5042/rule.js +9 -7
  185. package/cjs/S5122/rule.js +40 -36
  186. package/cjs/S5148/rule.js +9 -8
  187. package/cjs/S5247/rule.js +22 -18
  188. package/cjs/S5256/rule.js +5 -4
  189. package/cjs/S5257/rule.js +4 -3
  190. package/cjs/S5260/rule.js +4 -3
  191. package/cjs/S5264/rule.js +4 -3
  192. package/cjs/S5332/rule.js +4 -3
  193. package/cjs/S5332/rule.lib.js +19 -17
  194. package/cjs/S5443/rule.js +2 -2
  195. package/cjs/S5527/rule.js +18 -14
  196. package/cjs/S5542/rule.js +6 -4
  197. package/cjs/S5547/rule.js +6 -4
  198. package/cjs/S5604/rule.js +15 -14
  199. package/cjs/S5659/rule.js +15 -12
  200. package/cjs/S5689/rule.js +11 -8
  201. package/cjs/S5691/rule.js +7 -5
  202. package/cjs/S5693/rule.js +14 -12
  203. package/cjs/S5725/rule.js +9 -6
  204. package/cjs/S5728/rule.js +7 -4
  205. package/cjs/S5730/rule.js +9 -6
  206. package/cjs/S5732/rule.js +8 -5
  207. package/cjs/S5734/rule.js +7 -4
  208. package/cjs/S5736/rule.js +8 -5
  209. package/cjs/S5739/rule.js +11 -8
  210. package/cjs/S5742/rule.js +7 -4
  211. package/cjs/S5743/rule.js +8 -6
  212. package/cjs/S5757/rule.js +13 -10
  213. package/cjs/S5759/rule.js +10 -7
  214. package/cjs/S5842/rule.js +2 -2
  215. package/cjs/S5843/rule.js +22 -19
  216. package/cjs/S5850/rule.js +4 -3
  217. package/cjs/S5852/rule.js +2 -2
  218. package/cjs/S5856/rule.js +10 -7
  219. package/cjs/S5860/rule.js +30 -26
  220. package/cjs/S5863/rule.js +15 -11
  221. package/cjs/S5867/rule.js +8 -7
  222. package/cjs/S5868/rule.js +7 -5
  223. package/cjs/S5869/rule.js +6 -5
  224. package/cjs/S5876/rule.js +12 -8
  225. package/cjs/S5958/rule.js +12 -9
  226. package/cjs/S5973/rule.js +10 -7
  227. package/cjs/S6019/rule.js +4 -3
  228. package/cjs/S6035/rule.js +2 -2
  229. package/cjs/S6079/rule.js +9 -6
  230. package/cjs/S6080/rule.js +13 -10
  231. package/cjs/S6092/rule.js +9 -7
  232. package/cjs/S6245/rule.js +14 -9
  233. package/cjs/S6249/rule.js +7 -5
  234. package/cjs/S6252/rule.js +12 -8
  235. package/cjs/S6265/rule.js +27 -20
  236. package/cjs/S6268/rule.js +5 -4
  237. package/cjs/S6270/rule.js +12 -9
  238. package/cjs/S6275/rule.js +2 -2
  239. package/cjs/S6281/rule.js +22 -17
  240. package/cjs/S6299/rule.js +2 -2
  241. package/cjs/S6302/rule.js +6 -5
  242. package/cjs/S6303/rule.js +12 -10
  243. package/cjs/S6304/rule.js +6 -5
  244. package/cjs/S6308/rule.js +7 -5
  245. package/cjs/S6317/rule.js +5 -4
  246. package/cjs/S6319/rule.js +2 -2
  247. package/cjs/S6321/rule.js +25 -23
  248. package/cjs/S6323/rule.js +4 -3
  249. package/cjs/S6324/rule.js +2 -2
  250. package/cjs/S6326/rule.js +2 -2
  251. package/cjs/S6327/rule.js +2 -2
  252. package/cjs/S6328/rule.js +4 -3
  253. package/cjs/S6329/rule.js +7 -5
  254. package/cjs/S6330/rule.js +2 -2
  255. package/cjs/S6332/rule.js +2 -2
  256. package/cjs/S6333/rule.js +8 -6
  257. package/cjs/S6351/rule.js +22 -19
  258. package/cjs/S6353/rule.js +2 -2
  259. package/cjs/S6397/rule.js +2 -2
  260. package/cjs/S6418/config.js +1 -1
  261. package/cjs/S6418/rule.js +9 -24
  262. package/cjs/S6426/rule.js +5 -4
  263. package/cjs/S6437/rule.js +10 -7
  264. package/cjs/S6439/rule.js +9 -7
  265. package/cjs/S6442/rule.js +11 -8
  266. package/cjs/S6443/rule.js +9 -7
  267. package/cjs/S6486/rule.js +5 -4
  268. package/cjs/S6564/rule.js +4 -3
  269. package/cjs/S6594/rule.js +12 -8
  270. package/cjs/S6627/rule.js +6 -4
  271. package/cjs/S6759/rule.js +10 -6
  272. package/cjs/S6958/rule.js +2 -2
  273. package/cjs/S6959/rule.js +9 -6
  274. package/cjs/S7059/generated-meta.js +1 -1
  275. package/cjs/S7059/rule.js +8 -5
  276. package/cjs/S7639/generated-meta.js +1 -1
  277. package/cjs/S7639/rule.js +5 -4
  278. package/cjs/S7790/generated-meta.js +1 -1
  279. package/cjs/S7790/rule.js +7 -5
  280. package/cjs/S8441/generated-meta.js +1 -1
  281. package/cjs/S8441/rule.js +13 -9
  282. package/cjs/S881/rule.js +2 -2
  283. package/cjs/S888/rule.js +4 -3
  284. package/cjs/S930/rule.js +14 -12
  285. package/cjs/helpers/ast.js +11 -8
  286. package/cjs/helpers/aws/s3.js +9 -6
  287. package/cjs/helpers/chai.js +41 -43
  288. package/cjs/helpers/configs.js +92 -0
  289. package/cjs/helpers/cookie-flag-check.js +19 -17
  290. package/cjs/helpers/{decorators/index.js → entropy.js} +16 -17
  291. package/cjs/helpers/express.js +127 -128
  292. package/cjs/helpers/find-up/all-in-parent-dirs.js +0 -16
  293. package/cjs/helpers/mocha.js +50 -54
  294. package/cjs/helpers/regex/ast.js +7 -6
  295. package/cjs/helpers/regex/extract.js +11 -11
  296. package/cjs/helpers/regex/group.js +2 -2
  297. package/cjs/helpers/regex/location.js +2 -2
  298. package/cjs/helpers/regex/range.js +5 -4
  299. package/cjs/helpers/regex/rule-template.js +4 -3
  300. package/cjs/helpers/sinon.js +33 -36
  301. package/cjs/helpers/supertest.js +34 -37
  302. package/cjs/helpers/vitest.js +29 -32
  303. package/cjs/plugin-rules.js +452 -450
  304. package/docs/assertions-in-tests.md +2 -0
  305. package/docs/bitwise-operators.md +2 -0
  306. package/docs/code-eval.md +7 -0
  307. package/docs/file-permissions.md +1 -1
  308. package/docs/no-async-constructor.md +2 -0
  309. package/docs/no-inconsistent-returns.md +2 -0
  310. package/docs/prefer-immediate-return.md +2 -0
  311. package/docs/sql-queries.md +2 -0
  312. package/package.json +39 -1
  313. package/types/S1067/rule.d.ts +1 -1
  314. package/types/S1110/rule.d.ts +1 -1
  315. package/types/S1128/rule.d.ts +1 -1
  316. package/types/S1172/rule.d.ts +1 -1
  317. package/types/S1226/rule.d.ts +1 -1
  318. package/types/S134/rule.d.ts +1 -1
  319. package/types/S1472/rule.d.ts +1 -1
  320. package/types/S1481/rule.d.ts +1 -1
  321. package/types/S1488/generated-meta.d.ts +1 -1
  322. package/types/S1515/rule.d.ts +1 -1
  323. package/types/S1523/generated-meta.d.ts +17 -0
  324. package/types/S1523/index.d.ts +1 -0
  325. package/types/S1523/meta.d.ts +2 -0
  326. package/types/S1523/rule.d.ts +2 -0
  327. package/types/S1527/rule.d.ts +1 -1
  328. package/types/S1529/generated-meta.d.ts +1 -1
  329. package/types/S1541/rule.d.ts +1 -1
  330. package/types/S1862/rule.d.ts +1 -1
  331. package/types/S2077/generated-meta.d.ts +1 -1
  332. package/types/S2123/rule.d.ts +1 -1
  333. package/types/S2259/rule.d.ts +1 -1
  334. package/types/S2428/rule.d.ts +1 -1
  335. package/types/S2589/rule.d.ts +1 -1
  336. package/types/S2598/rule.d.ts +1 -1
  337. package/types/S2699/generated-meta.d.ts +1 -1
  338. package/types/S2699/rule.d.ts +1 -1
  339. package/types/S2737/rule.d.ts +1 -1
  340. package/types/S2757/rule.d.ts +1 -1
  341. package/types/S2819/rule.d.ts +1 -1
  342. package/types/S3001/rule.d.ts +1 -1
  343. package/types/S3317/rule.d.ts +1 -1
  344. package/types/S3500/rule.d.ts +1 -1
  345. package/types/S3513/rule.d.ts +1 -1
  346. package/types/S3686/rule.d.ts +1 -1
  347. package/types/S3801/generated-meta.d.ts +1 -1
  348. package/types/S3972/rule.d.ts +1 -1
  349. package/types/S3973/rule.d.ts +1 -1
  350. package/types/S4030/rule.d.ts +1 -1
  351. package/types/S4143/rule.d.ts +1 -1
  352. package/types/S4158/rule.d.ts +1 -1
  353. package/types/S4621/rule.d.ts +1 -1
  354. package/types/S4782/rule.d.ts +1 -1
  355. package/types/S5693/rule.d.ts +1 -1
  356. package/types/S5725/rule.d.ts +1 -1
  357. package/types/S5860/rule.d.ts +1 -1
  358. package/types/S5868/rule.d.ts +1 -1
  359. package/types/S5869/rule.d.ts +1 -1
  360. package/types/S6079/rule.d.ts +1 -1
  361. package/types/S6326/rule.d.ts +1 -1
  362. package/types/S6351/rule.d.ts +1 -1
  363. package/types/S6418/config.d.ts +1 -1
  364. package/types/S6443/rule.d.ts +1 -1
  365. package/types/S7059/generated-meta.d.ts +1 -1
  366. package/types/S7639/generated-meta.d.ts +1 -1
  367. package/types/S7790/generated-meta.d.ts +1 -1
  368. package/types/S8441/generated-meta.d.ts +1 -1
  369. package/types/S930/rule.d.ts +1 -1
  370. package/types/helpers/ancestor.d.ts +3 -3
  371. package/types/helpers/ast.d.ts +1 -1
  372. package/types/helpers/aws/iam.d.ts +2 -2
  373. package/types/helpers/aws/s3.d.ts +1 -1
  374. package/types/helpers/chai.d.ts +3 -5
  375. package/types/helpers/configs.d.ts +39 -1
  376. package/types/helpers/entropy.d.ts +1 -0
  377. package/types/helpers/equivalence.d.ts +1 -1
  378. package/types/helpers/express.d.ts +38 -43
  379. package/types/helpers/find-up/all-in-parent-dirs.d.ts +1 -1
  380. package/types/helpers/find-up/closest.d.ts +1 -1
  381. package/types/helpers/find-up/find-minimatch.d.ts +1 -1
  382. package/types/helpers/generate-meta.d.ts +1 -1
  383. package/types/helpers/mocha.d.ts +19 -21
  384. package/types/helpers/module.d.ts +1 -1
  385. package/types/helpers/package-jsons/all-in-parent-dirs.d.ts +1 -1
  386. package/types/helpers/package-jsons/dependencies.d.ts +1 -1
  387. package/types/helpers/recognizers/CodeRecognizer.d.ts +1 -1
  388. package/types/helpers/recognizers/JavaScriptFootPrint.d.ts +2 -2
  389. package/types/helpers/recognizers/LanguageFootprint.d.ts +1 -1
  390. package/types/helpers/regex/alternation.d.ts +1 -1
  391. package/types/helpers/regex/ast.d.ts +1 -1
  392. package/types/helpers/regex/location.d.ts +2 -2
  393. package/types/helpers/regex/range.d.ts +2 -2
  394. package/types/helpers/regex/rule-template.d.ts +1 -1
  395. package/types/helpers/result.d.ts +1 -1
  396. package/types/helpers/sinon.d.ts +4 -6
  397. package/types/helpers/sonar-runtime.d.ts +1 -1
  398. package/types/helpers/supertest.d.ts +4 -6
  399. package/types/helpers/type.d.ts +1 -1
  400. package/types/helpers/vitest.d.ts +4 -6
  401. package/types/plugin-rules.d.ts +1 -0
  402. package/cjs/helpers/decorators/interceptor.js +0 -88
  403. package/cjs/helpers/index.js +0 -60
  404. package/cjs/helpers/recognizers/index.js +0 -37
  405. package/cjs/helpers/rule-detect-react.js +0 -29
  406. package/cjs/helpers/validate-version.js +0 -94
  407. package/types/helpers/aws/index.d.ts +0 -3
  408. package/types/helpers/decorators/index.d.ts +0 -2
  409. package/types/helpers/decorators/interceptor.d.ts +0 -16
  410. package/types/helpers/index.d.ts +0 -28
  411. package/types/helpers/recognizers/index.d.ts +0 -2
  412. package/types/helpers/rule-detect-react.d.ts +0 -2
  413. package/types/helpers/validate-version.d.ts +0 -13
@@ -4,4 +4,6 @@
4
4
 
5
5
  💼 This rule is enabled in the ✅ `recommended` config.
6
6
 
7
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
8
+
7
9
  <!-- end auto-generated rule header -->
@@ -4,4 +4,6 @@
4
4
 
5
5
  💼 This rule is enabled in the ✅ `recommended` config.
6
6
 
7
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
8
+
7
9
  <!-- end auto-generated rule header -->
@@ -0,0 +1,7 @@
1
+ # sonarjs/code-eval
2
+
3
+ 📝 Dynamically executing code is security-sensitive.
4
+
5
+ 💼 This rule is enabled in the ✅ `recommended` config.
6
+
7
+ <!-- end auto-generated rule header -->
@@ -1,6 +1,6 @@
1
1
  # sonarjs/file-permissions
2
2
 
3
- 📝 Setting loose POSIX file permissions is security-sensitive.
3
+ 📝 File permissions should not be set to world-accessible values.
4
4
 
5
5
  💼 This rule is enabled in the ✅ `recommended` config.
6
6
 
@@ -4,4 +4,6 @@
4
4
 
5
5
  💼 This rule is enabled in the ✅ `recommended` config.
6
6
 
7
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
8
+
7
9
  <!-- end auto-generated rule header -->
@@ -4,4 +4,6 @@
4
4
 
5
5
  🚫 This rule is _disabled_ in the ✅ `recommended` config.
6
6
 
7
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
8
+
7
9
  <!-- end auto-generated rule header -->
@@ -6,4 +6,6 @@
6
6
 
7
7
  🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
8
8
 
9
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
10
+
9
11
  <!-- end auto-generated rule header -->
@@ -4,4 +4,6 @@
4
4
 
5
5
  💼 This rule is enabled in the ✅ `recommended` config.
6
6
 
7
+ 💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
8
+
7
9
  <!-- end auto-generated rule header -->
package/package.json CHANGED
@@ -1 +1,39 @@
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"}}
1
+ {
2
+ "author": "SonarSource",
3
+ "bugs": {
4
+ "url": "https://community.sonarsource.com/"
5
+ },
6
+ "description": "SonarJS rules for ESLint",
7
+ "homepage": "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md",
8
+ "keywords": [
9
+ "sonarjs",
10
+ "eslint",
11
+ "eslintplugin"
12
+ ],
13
+ "license": "LGPL-3.0-only",
14
+ "main": "./cjs/plugin.js",
15
+ "peerDependencies": {
16
+ "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/SonarSource/SonarJS.git"
21
+ },
22
+ "types": "./types/plugin.d.ts",
23
+ "name": "eslint-plugin-sonarjs",
24
+ "version": "4.0.2",
25
+ "dependencies": {
26
+ "typescript": ">=5",
27
+ "jsx-ast-utils-x": "^0.1.0",
28
+ "lodash.merge": "^4.6.2",
29
+ "functional-red-black-tree": "^1.0.1",
30
+ "@eslint-community/regexpp": "^4.12.2",
31
+ "minimatch": "^10.2.4",
32
+ "semver": "^7.7.4",
33
+ "ts-api-utils": "^2.4.0",
34
+ "scslre": "^0.3.0",
35
+ "bytes": "^3.1.2",
36
+ "builtin-modules": "^3.3.0",
37
+ "globals": "^17.4.0"
38
+ }
39
+ }
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,3 +1,3 @@
1
- import { Rule, Scope } from 'eslint';
1
+ import type { Rule, Scope } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
3
3
  export declare function isParameterProperty(variable: Scope.Variable): boolean;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: "code";
11
11
  deprecated: false;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -0,0 +1,17 @@
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 = "S1523";
15
+ export declare const scope = "Main";
16
+ export declare const languages: ('js' | 'ts')[];
17
+ export declare const requiredDependency: never[];
@@ -0,0 +1 @@
1
+ export { rule } from './rule.js';
@@ -0,0 +1,2 @@
1
+ export declare const implementation = "original";
2
+ export declare const eslintId = "code-eval";
@@ -0,0 +1,2 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: undefined;
11
11
  deprecated: false;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: undefined;
11
11
  deprecated: false;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,4 +1,4 @@
1
- import { Rule, Scope } from 'eslint';
1
+ import type { Rule, Scope } from 'eslint';
2
2
  import type estree from 'estree';
3
3
  export declare const rule: Rule.RuleModule;
4
4
  /**
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: undefined;
11
11
  deprecated: false;
@@ -1,4 +1,4 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  /**
3
3
  * We assume that the user is using a single assertion library per file,
4
4
  * this is why we are not saving if an assertion has been performed for
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: undefined;
11
11
  deprecated: false;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -7,5 +7,5 @@ export declare const fields: [[{
7
7
  readonly description: "Minimum shannon entropy threshold of the secret";
8
8
  readonly default: 5;
9
9
  readonly customDefault: "5.0";
10
- readonly customForConfiguration: "Double.parseDouble(randomnessSensibility)";
10
+ readonly customForConfiguration: NumberConstructor;
11
11
  }]];
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -5,7 +5,7 @@ export declare const meta: {
5
5
  description: string;
6
6
  recommended: boolean;
7
7
  url: string;
8
- requiresTypeChecking: false;
8
+ requiresTypeChecking: true;
9
9
  };
10
10
  fixable: undefined;
11
11
  deprecated: false;
@@ -12,6 +12,6 @@ export declare const meta: {
12
12
  defaultOptions: never[];
13
13
  };
14
14
  export declare const sonarKey = "S7639";
15
- export declare const scope = "All";
15
+ export declare const scope = "Main";
16
16
  export declare const languages: ('js' | 'ts')[];
17
17
  export declare const requiredDependency: never[];
@@ -12,6 +12,6 @@ export declare const meta: {
12
12
  defaultOptions: never[];
13
13
  };
14
14
  export declare const sonarKey = "S7790";
15
- export declare const scope = "All";
15
+ export declare const scope = "Main";
16
16
  export declare const languages: ('js' | 'ts')[];
17
17
  export declare const requiredDependency: never[];
@@ -12,6 +12,6 @@ export declare const meta: {
12
12
  defaultOptions: never[];
13
13
  };
14
14
  export declare const sonarKey = "S8441";
15
- export declare const scope = "All";
15
+ export declare const scope = "Main";
16
16
  export declare const languages: ('js' | 'ts')[];
17
17
  export declare const requiredDependency: never[];
@@ -1,2 +1,2 @@
1
- import { Rule } from 'eslint';
1
+ import type { Rule } from 'eslint';
2
2
  export declare const rule: Rule.RuleModule;
@@ -1,12 +1,12 @@
1
1
  import type { TSESTree } from '@typescript-eslint/utils';
2
- import { Rule, SourceCode } from 'eslint';
2
+ import type { Rule, SourceCode } from 'eslint';
3
3
  import type { Node } from 'estree';
4
- import ts from 'typescript';
4
+ import type ts from 'typescript';
5
5
  export declare function findFirstMatchingLocalAncestor(node: TSESTree.Node, predicate: (node: TSESTree.Node) => boolean): TSESTree.Node | undefined;
6
6
  export declare function findFirstMatchingAncestor(node: TSESTree.Node, predicate: (node: TSESTree.Node) => boolean): TSESTree.Node | undefined;
7
7
  export declare function localAncestorsChain(node: TSESTree.Node): TSESTree.Node[];
8
8
  export declare function ancestorsChain(node: TSESTree.Node, boundaryTypes: Set<string>): TSESTree.Node[];
9
- export declare function getParent(context: Rule.RuleContext, node: Node): import("estree-jsx").JSXAttribute | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").BigIntLiteral | import("estree-jsx").JSXOpeningElement | import("estree-jsx").JSXSpreadAttribute | import("estree-jsx").JSXIdentifier | import("estree-jsx").JSXNamespacedName | import("estree-jsx").JSXExpressionContainer | import("estree-jsx").JSXElement | import("estree-jsx").JSXFragment | import("estree-jsx").JSXMemberExpression | import("estree-jsx").JSXOpeningFragment | import("estree").Property | import("estree").CatchClause | import("estree").ClassDeclaration | import("estree").ClassExpression | import("estree").ClassBody | import("estree").Identifier | import("estree").ArrayExpression | import("estree").ArrowFunctionExpression | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").ChainExpression | import("estree").ConditionalExpression | import("estree").FunctionExpression | import("estree").ImportExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").MetaProperty | import("estree").ObjectExpression | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | import("estree").TemplateLiteral | import("estree").ThisExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").YieldExpression | import("estree").FunctionDeclaration | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").PrivateIdentifier | import("estree").Program | import("estree").PropertyDefinition | import("estree").SpreadElement | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").StaticBlock | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").Super | import("estree").SwitchCase | import("estree").TemplateElement | import("estree").VariableDeclarator | import("estree-jsx").JSXEmptyExpression | import("estree-jsx").JSXClosingElement | import("estree-jsx").JSXClosingFragment | import("estree-jsx").JSXText | undefined;
9
+ export declare function getParent(context: Rule.RuleContext, node: Node): import("estree").MethodDefinition | import("estree").Property | import("estree").CatchClause | import("estree").ClassDeclaration | import("estree").ClassExpression | import("estree").ClassBody | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").BigIntLiteral | import("estree-jsx").JSXElement | import("estree-jsx").JSXFragment | import("estree").ArrayExpression | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").ChainExpression | import("estree").ConditionalExpression | import("estree").ImportExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").MetaProperty | import("estree").ObjectExpression | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | import("estree").TemplateLiteral | import("estree").ThisExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").YieldExpression | import("estree").FunctionDeclaration | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").PrivateIdentifier | import("estree").Program | import("estree").PropertyDefinition | import("estree").SpreadElement | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").StaticBlock | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").Super | import("estree").SwitchCase | import("estree").TemplateElement | import("estree").VariableDeclarator | import("estree-jsx").JSXIdentifier | import("estree-jsx").JSXNamespacedName | import("estree-jsx").JSXMemberExpression | import("estree-jsx").JSXEmptyExpression | import("estree-jsx").JSXExpressionContainer | import("estree-jsx").JSXSpreadAttribute | import("estree-jsx").JSXAttribute | import("estree-jsx").JSXOpeningElement | import("estree-jsx").JSXOpeningFragment | import("estree-jsx").JSXClosingElement | import("estree-jsx").JSXClosingFragment | import("estree-jsx").JSXText | undefined;
10
10
  /**
11
11
  * Returns the parent of an ESLint node
12
12
  *
@@ -1,5 +1,5 @@
1
1
  import type { TSESTree } from '@typescript-eslint/utils';
2
- import { Rule, Scope } from 'eslint';
2
+ import type { Rule, Scope } from 'eslint';
3
3
  import type estree from 'estree';
4
4
  export type Node = estree.Node | TSESTree.Node;
5
5
  export type LoopLike = estree.WhileStatement | estree.DoWhileStatement | estree.ForStatement | estree.ForOfStatement | estree.ForInStatement;
@@ -1,7 +1,7 @@
1
1
  import type { Node } from 'estree';
2
2
  import type { Rule } from 'eslint';
3
- import { Result } from '../result.js';
4
- import { StringLiteral } from '../ast.js';
3
+ import { type Result } from '../result.js';
4
+ import { type StringLiteral } from '../ast.js';
5
5
  import type { RulesMeta } from '@eslint/core';
6
6
  export interface PolicyCheckerOptions {
7
7
  effect: {
@@ -1,6 +1,6 @@
1
1
  import type { Rule } from 'eslint';
2
2
  import type estree from 'estree';
3
- import { IssueLocation } from '../index.js';
3
+ import { type IssueLocation } from '../location.js';
4
4
  import type { RulesMeta } from '@eslint/core';
5
5
  /**
6
6
  * A rule template for AWS S3 Buckets
@@ -2,8 +2,6 @@ import type { Rule } from 'eslint';
2
2
  import type estree from 'estree';
3
3
  import type { ParserServicesWithTypeInformation } from '@typescript-eslint/utils';
4
4
  import ts from 'typescript';
5
- export declare namespace Chai {
6
- function isImported(context: Rule.RuleContext): boolean;
7
- function isTSAssertion(services: ParserServicesWithTypeInformation, node: ts.Node): boolean;
8
- function isAssertion(context: Rule.RuleContext, node: estree.Node): boolean;
9
- }
5
+ export declare function isImported(context: Rule.RuleContext): boolean;
6
+ export declare function isTSAssertion(services: ParserServicesWithTypeInformation, node: ts.Node): boolean;
7
+ export declare function isAssertion(context: Rule.RuleContext, node: estree.Node): boolean;
@@ -19,7 +19,7 @@ export type ESLintConfigurationSQProperty = ESLintConfigurationDefaultProperty &
19
19
  type: 'string' | 'integer';
20
20
  };
21
21
  fieldType?: 'TEXT';
22
- customForConfiguration?: string;
22
+ customForConfiguration?: (value: unknown) => unknown;
23
23
  };
24
24
  export type ESLintConfigurationProperty = ESLintConfigurationDefaultProperty | ESLintConfigurationSQProperty;
25
25
  type ESLintConfigurationNamedProperty = ESLintConfigurationProperty & {
@@ -28,4 +28,42 @@ type ESLintConfigurationNamedProperty = ESLintConfigurationProperty & {
28
28
  type ESLintConfigurationElement = ESLintConfigurationNamedProperty[] | ESLintConfigurationProperty;
29
29
  export type ESLintConfiguration = ESLintConfigurationElement[];
30
30
  export declare function defaultOptions(configuration?: ESLintConfiguration): Default[] | undefined;
31
+ /**
32
+ * Applies `customForConfiguration` transformations to merged configuration values.
33
+ *
34
+ * When SonarQube sends rule parameters, the values may not match what the underlying
35
+ * ESLint rule expects. For example, S1441 (quotes) exposes a boolean `singleQuotes`
36
+ * property in SonarQube, but the ESLint rule expects the string `"single"` or `"double"`.
37
+ * The `customForConfiguration` function on a field definition bridges this gap.
38
+ *
39
+ * This function walks the `mergedValues` array (the result of merging default options
40
+ * with user-provided configurations) and applies any `customForConfiguration` transform
41
+ * found in the corresponding `fields` element. It handles both configuration patterns:
42
+ *
43
+ * - **Primitive elements** (e.g., S1441's boolean → string mapping): the transform is
44
+ * called directly on the merged value.
45
+ * - **Object elements** (e.g., S6418's `randomnessSensibility` string → number): each
46
+ * named property within the object is checked individually, and only properties that
47
+ * define `customForConfiguration` are transformed.
48
+ *
49
+ * Values without a corresponding field definition or without `customForConfiguration`
50
+ * are passed through unchanged.
51
+ *
52
+ * @param fields - The rule's field definitions from its `config.ts` (may contain transforms)
53
+ * @param mergedValues - The merged configuration array (defaults + user overrides)
54
+ * @returns A new array with transformed values ready to pass to the ESLint rule
55
+ *
56
+ * @example
57
+ * // S1441: primitive transform (boolean → string)
58
+ * // fields[0] has customForConfiguration: (v) => v ? 'single' : 'double'
59
+ * applyTransformations(fields, [true, {avoidEscape: true}])
60
+ * // → ['single', {avoidEscape: true}]
61
+ *
62
+ * @example
63
+ * // S6418: object property transform (string → number)
64
+ * // fields[0][1] has customForConfiguration: (v) => Number(v)
65
+ * applyTransformations(fields, [{secretWords: 'api_key', randomnessSensibility: '5.0'}])
66
+ * // → [{secretWords: 'api_key', randomnessSensibility: 5}]
67
+ */
68
+ export declare function applyTransformations(fields: ESLintConfiguration | undefined, mergedValues: unknown[] | undefined): unknown[];
31
69
  export {};
@@ -0,0 +1 @@
1
+ export declare function shannonEntropy(str: string): number;
@@ -1,5 +1,5 @@
1
1
  import { type Node } from './ast.js';
2
- import { SourceCode } from 'eslint';
2
+ import type { SourceCode } from 'eslint';
3
3
  /**
4
4
  * Equivalence is implemented by comparing node types and their tokens.
5
5
  * Classic implementation would recursively compare children,