@thethracian/oxlint-config 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +125 -19
  3. package/dist/codemod-fix/cli.d.ts +3 -0
  4. package/dist/codemod-fix/cli.d.ts.map +1 -0
  5. package/dist/codemod-fix/cli.js +22 -0
  6. package/dist/codemod-fix/cli.js.map +1 -0
  7. package/dist/codemod-fix/index.d.ts +44 -0
  8. package/dist/codemod-fix/index.d.ts.map +1 -0
  9. package/dist/codemod-fix/index.js +110 -0
  10. package/dist/codemod-fix/index.js.map +1 -0
  11. package/dist/codemods/arrow-body-style.d.ts +7 -0
  12. package/dist/codemods/arrow-body-style.d.ts.map +1 -0
  13. package/dist/codemods/arrow-body-style.js +106 -0
  14. package/dist/codemods/arrow-body-style.js.map +1 -0
  15. package/dist/codemods/comment-format.d.ts +24 -0
  16. package/dist/codemods/comment-format.d.ts.map +1 -0
  17. package/dist/codemods/comment-format.js +100 -0
  18. package/dist/codemods/comment-format.js.map +1 -0
  19. package/dist/codemods/explicit-return-types.d.ts +7 -0
  20. package/dist/codemods/explicit-return-types.d.ts.map +1 -0
  21. package/dist/codemods/explicit-return-types.js +350 -0
  22. package/dist/codemods/explicit-return-types.js.map +1 -0
  23. package/dist/codemods/format-file-header.d.ts +7 -0
  24. package/dist/codemods/format-file-header.d.ts.map +1 -0
  25. package/dist/codemods/format-file-header.js +163 -0
  26. package/dist/codemods/format-file-header.js.map +1 -0
  27. package/dist/codemods/format-jsdoc-comments.d.ts +7 -0
  28. package/dist/codemods/format-jsdoc-comments.d.ts.map +1 -0
  29. package/dist/codemods/format-jsdoc-comments.js +129 -0
  30. package/dist/codemods/format-jsdoc-comments.js.map +1 -0
  31. package/dist/codemods/function-declarations.d.ts +7 -0
  32. package/dist/codemods/function-declarations.d.ts.map +1 -0
  33. package/dist/codemods/function-declarations.js +202 -0
  34. package/dist/codemods/function-declarations.js.map +1 -0
  35. package/dist/codemods/inline-export-lists.d.ts +7 -0
  36. package/dist/codemods/inline-export-lists.d.ts.map +1 -0
  37. package/dist/codemods/inline-export-lists.js +168 -0
  38. package/dist/codemods/inline-export-lists.js.map +1 -0
  39. package/dist/codemods/internal-export-docs.d.ts +7 -0
  40. package/dist/codemods/internal-export-docs.d.ts.map +1 -0
  41. package/dist/codemods/internal-export-docs.js +93 -0
  42. package/dist/codemods/internal-export-docs.js.map +1 -0
  43. package/dist/codemods/no-ternary-branch-initializers.d.ts +14 -0
  44. package/dist/codemods/no-ternary-branch-initializers.d.ts.map +1 -0
  45. package/dist/codemods/no-ternary-branch-initializers.js +240 -0
  46. package/dist/codemods/no-ternary-branch-initializers.js.map +1 -0
  47. package/dist/codemods/no-ternary-variable-initializers.d.ts +14 -0
  48. package/dist/codemods/no-ternary-variable-initializers.d.ts.map +1 -0
  49. package/dist/codemods/no-ternary-variable-initializers.js +235 -0
  50. package/dist/codemods/no-ternary-variable-initializers.js.map +1 -0
  51. package/dist/codemods/no-ternary.d.ts +7 -0
  52. package/dist/codemods/no-ternary.d.ts.map +1 -0
  53. package/dist/codemods/no-ternary.js +215 -0
  54. package/dist/codemods/no-ternary.js.map +1 -0
  55. package/dist/codemods/rename-acronyms.d.ts +8 -0
  56. package/dist/codemods/rename-acronyms.d.ts.map +1 -0
  57. package/dist/codemods/rename-acronyms.js +193 -0
  58. package/dist/codemods/rename-acronyms.js.map +1 -0
  59. package/dist/codemods/run.d.ts +2 -0
  60. package/dist/codemods/run.d.ts.map +1 -0
  61. package/dist/codemods/run.js +14 -0
  62. package/dist/codemods/run.js.map +1 -0
  63. package/dist/codemods/sort-imports.d.ts +7 -0
  64. package/dist/codemods/sort-imports.d.ts.map +1 -0
  65. package/dist/codemods/sort-imports.js +235 -0
  66. package/dist/codemods/sort-imports.js.map +1 -0
  67. package/dist/index.d.ts +30 -96
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +157 -95
  70. package/dist/index.js.map +1 -1
  71. package/dist/rules/acronym-case.d.ts +7 -3
  72. package/dist/rules/acronym-case.d.ts.map +1 -1
  73. package/dist/rules/acronym-case.js +129 -120
  74. package/dist/rules/acronym-case.js.map +1 -1
  75. package/dist/rules/acronyms-1.d.ts +3 -0
  76. package/dist/rules/acronyms-1.d.ts.map +1 -0
  77. package/dist/rules/acronyms-1.js +407 -0
  78. package/dist/rules/acronyms-1.js.map +1 -0
  79. package/dist/rules/acronyms-2.d.ts +3 -0
  80. package/dist/rules/acronyms-2.d.ts.map +1 -0
  81. package/dist/rules/acronyms-2.js +407 -0
  82. package/dist/rules/acronyms-2.js.map +1 -0
  83. package/dist/rules/acronyms-3.d.ts +3 -0
  84. package/dist/rules/acronyms-3.d.ts.map +1 -0
  85. package/dist/rules/acronyms-3.js +407 -0
  86. package/dist/rules/acronyms-3.js.map +1 -0
  87. package/dist/rules/acronyms-4.d.ts +3 -0
  88. package/dist/rules/acronyms-4.d.ts.map +1 -0
  89. package/dist/rules/acronyms-4.js +377 -0
  90. package/dist/rules/acronyms-4.js.map +1 -0
  91. package/dist/rules/acronyms.d.ts +1 -8
  92. package/dist/rules/acronyms.d.ts.map +1 -1
  93. package/dist/rules/acronyms.js +14 -1578
  94. package/dist/rules/acronyms.js.map +1 -1
  95. package/dist/rules/boolean-prefix.d.ts +11 -2
  96. package/dist/rules/boolean-prefix.d.ts.map +1 -1
  97. package/dist/rules/boolean-prefix.js +95 -59
  98. package/dist/rules/boolean-prefix.js.map +1 -1
  99. package/dist/rules/camel-case-identifiers.d.ts +3 -4
  100. package/dist/rules/camel-case-identifiers.d.ts.map +1 -1
  101. package/dist/rules/camel-case-identifiers.js +59 -40
  102. package/dist/rules/camel-case-identifiers.js.map +1 -1
  103. package/dist/rules/char-class.d.ts +26 -13
  104. package/dist/rules/char-class.d.ts.map +1 -1
  105. package/dist/rules/char-class.js +56 -24
  106. package/dist/rules/char-class.js.map +1 -1
  107. package/dist/rules/diagnostic-guidance.d.ts +91 -0
  108. package/dist/rules/diagnostic-guidance.d.ts.map +1 -0
  109. package/dist/rules/diagnostic-guidance.js +243 -0
  110. package/dist/rules/diagnostic-guidance.js.map +1 -0
  111. package/dist/rules/effect-default-ast.d.ts +89 -0
  112. package/dist/rules/effect-default-ast.d.ts.map +1 -0
  113. package/dist/rules/effect-default-ast.js +208 -0
  114. package/dist/rules/effect-default-ast.js.map +1 -0
  115. package/dist/rules/effect-default-compat-rules.d.ts +76 -0
  116. package/dist/rules/effect-default-compat-rules.d.ts.map +1 -0
  117. package/dist/rules/effect-default-compat-rules.js +270 -0
  118. package/dist/rules/effect-default-compat-rules.js.map +1 -0
  119. package/dist/rules/effect-default-env-rules.d.ts +60 -0
  120. package/dist/rules/effect-default-env-rules.d.ts.map +1 -0
  121. package/dist/rules/effect-default-env-rules.js +259 -0
  122. package/dist/rules/effect-default-env-rules.js.map +1 -0
  123. package/dist/rules/effect-default-fiber-helpers.d.ts +13 -0
  124. package/dist/rules/effect-default-fiber-helpers.d.ts.map +1 -0
  125. package/dist/rules/effect-default-fiber-helpers.js +76 -0
  126. package/dist/rules/effect-default-fiber-helpers.js.map +1 -0
  127. package/dist/rules/effect-default-floating-helpers.d.ts +7 -0
  128. package/dist/rules/effect-default-floating-helpers.d.ts.map +1 -0
  129. package/dist/rules/effect-default-floating-helpers.js +113 -0
  130. package/dist/rules/effect-default-floating-helpers.js.map +1 -0
  131. package/dist/rules/effect-default-helpers.d.ts +8 -32
  132. package/dist/rules/effect-default-helpers.d.ts.map +1 -1
  133. package/dist/rules/effect-default-helpers.js +11 -458
  134. package/dist/rules/effect-default-helpers.js.map +1 -1
  135. package/dist/rules/effect-default-resource-helpers.d.ts +18 -4
  136. package/dist/rules/effect-default-resource-helpers.d.ts.map +1 -1
  137. package/dist/rules/effect-default-resource-helpers.js +30 -13
  138. package/dist/rules/effect-default-resource-helpers.js.map +1 -1
  139. package/dist/rules/effect-default-safety-helpers.d.ts +43 -0
  140. package/dist/rules/effect-default-safety-helpers.d.ts.map +1 -0
  141. package/dist/rules/effect-default-safety-helpers.js +126 -0
  142. package/dist/rules/effect-default-safety-helpers.js.map +1 -0
  143. package/dist/rules/effect-default-scan-helpers.d.ts +43 -0
  144. package/dist/rules/effect-default-scan-helpers.d.ts.map +1 -0
  145. package/dist/rules/effect-default-scan-helpers.js +141 -0
  146. package/dist/rules/effect-default-scan-helpers.js.map +1 -0
  147. package/dist/rules/effect-default-schema-helpers.d.ts +37 -0
  148. package/dist/rules/effect-default-schema-helpers.d.ts.map +1 -0
  149. package/dist/rules/effect-default-schema-helpers.js +104 -0
  150. package/dist/rules/effect-default-schema-helpers.js.map +1 -0
  151. package/dist/rules/effect-default-test-helpers.d.ts +18 -4
  152. package/dist/rules/effect-default-test-helpers.d.ts.map +1 -1
  153. package/dist/rules/effect-default-test-helpers.js +41 -20
  154. package/dist/rules/effect-default-test-helpers.js.map +1 -1
  155. package/dist/rules/effect-default-workflow-helpers.d.ts +91 -0
  156. package/dist/rules/effect-default-workflow-helpers.d.ts.map +1 -0
  157. package/dist/rules/effect-default-workflow-helpers.js +247 -0
  158. package/dist/rules/effect-default-workflow-helpers.js.map +1 -0
  159. package/dist/rules/effect-default.d.ts +1 -1
  160. package/dist/rules/effect-default.d.ts.map +1 -1
  161. package/dist/rules/effect-default.js +198 -637
  162. package/dist/rules/effect-default.js.map +1 -1
  163. package/dist/rules/effect-exported-declarations.d.ts +19 -0
  164. package/dist/rules/effect-exported-declarations.d.ts.map +1 -0
  165. package/dist/rules/effect-exported-declarations.js +237 -0
  166. package/dist/rules/effect-exported-declarations.js.map +1 -0
  167. package/dist/rules/effect-path-options.d.ts +49 -11
  168. package/dist/rules/effect-path-options.d.ts.map +1 -1
  169. package/dist/rules/effect-path-options.js +85 -52
  170. package/dist/rules/effect-path-options.js.map +1 -1
  171. package/dist/rules/effect-rule-aliases.d.ts +55 -0
  172. package/dist/rules/effect-rule-aliases.d.ts.map +1 -0
  173. package/dist/rules/effect-rule-aliases.js +278 -0
  174. package/dist/rules/effect-rule-aliases.js.map +1 -0
  175. package/dist/rules/effect-rule-core.d.ts +46 -24
  176. package/dist/rules/effect-rule-core.d.ts.map +1 -1
  177. package/dist/rules/effect-rule-core.js +263 -303
  178. package/dist/rules/effect-rule-core.js.map +1 -1
  179. package/dist/rules/effect-rule-names.d.ts +12 -3
  180. package/dist/rules/effect-rule-names.d.ts.map +1 -1
  181. package/dist/rules/effect-rule-names.js +15 -3
  182. package/dist/rules/effect-rule-names.js.map +1 -1
  183. package/dist/rules/effect-source-comments.d.ts +7 -0
  184. package/dist/rules/effect-source-comments.d.ts.map +1 -0
  185. package/dist/rules/effect-source-comments.js +227 -0
  186. package/dist/rules/effect-source-comments.js.map +1 -0
  187. package/dist/rules/effect-source-helpers.d.ts +4 -9
  188. package/dist/rules/effect-source-helpers.d.ts.map +1 -1
  189. package/dist/rules/effect-source-helpers.js +7 -333
  190. package/dist/rules/effect-source-helpers.js.map +1 -1
  191. package/dist/rules/effect-source-navigation.d.ts +25 -0
  192. package/dist/rules/effect-source-navigation.d.ts.map +1 -0
  193. package/dist/rules/effect-source-navigation.js +244 -0
  194. package/dist/rules/effect-source-navigation.js.map +1 -0
  195. package/dist/rules/effect-source-scan.d.ts +30 -7
  196. package/dist/rules/effect-source-scan.d.ts.map +1 -1
  197. package/dist/rules/effect-source-scan.js +377 -297
  198. package/dist/rules/effect-source-scan.js.map +1 -1
  199. package/dist/rules/effect-strict-ast-specs.d.ts +8 -0
  200. package/dist/rules/effect-strict-ast-specs.d.ts.map +1 -0
  201. package/dist/rules/effect-strict-ast-specs.js +166 -0
  202. package/dist/rules/effect-strict-ast-specs.js.map +1 -0
  203. package/dist/rules/effect-strict-boundary-helpers.d.ts +25 -0
  204. package/dist/rules/effect-strict-boundary-helpers.d.ts.map +1 -0
  205. package/dist/rules/effect-strict-boundary-helpers.js +127 -0
  206. package/dist/rules/effect-strict-boundary-helpers.js.map +1 -0
  207. package/dist/rules/effect-strict-core-specs.d.ts +8 -0
  208. package/dist/rules/effect-strict-core-specs.d.ts.map +1 -0
  209. package/dist/rules/effect-strict-core-specs.js +334 -0
  210. package/dist/rules/effect-strict-core-specs.js.map +1 -0
  211. package/dist/rules/effect-strict-external-helpers.d.ts +25 -0
  212. package/dist/rules/effect-strict-external-helpers.d.ts.map +1 -0
  213. package/dist/rules/effect-strict-external-helpers.js +87 -0
  214. package/dist/rules/effect-strict-external-helpers.js.map +1 -0
  215. package/dist/rules/effect-strict-helpers.d.ts +75 -33
  216. package/dist/rules/effect-strict-helpers.d.ts.map +1 -1
  217. package/dist/rules/effect-strict-helpers.js +124 -246
  218. package/dist/rules/effect-strict-helpers.js.map +1 -1
  219. package/dist/rules/effect-strict-internals.d.ts +198 -0
  220. package/dist/rules/effect-strict-internals.d.ts.map +1 -0
  221. package/dist/rules/effect-strict-internals.js +477 -0
  222. package/dist/rules/effect-strict-internals.js.map +1 -0
  223. package/dist/rules/effect-strict-segment-helpers.d.ts +79 -0
  224. package/dist/rules/effect-strict-segment-helpers.d.ts.map +1 -0
  225. package/dist/rules/effect-strict-segment-helpers.js +308 -0
  226. package/dist/rules/effect-strict-segment-helpers.js.map +1 -0
  227. package/dist/rules/effect-strict.d.ts +1 -1
  228. package/dist/rules/effect-strict.d.ts.map +1 -1
  229. package/dist/rules/effect-strict.js +10 -661
  230. package/dist/rules/effect-strict.js.map +1 -1
  231. package/dist/rules/max-import-depth.d.ts +2 -2
  232. package/dist/rules/max-import-depth.d.ts.map +1 -1
  233. package/dist/rules/max-import-depth.js +52 -17
  234. package/dist/rules/max-import-depth.js.map +1 -1
  235. package/dist/rules/max-line-length.d.ts +9 -2
  236. package/dist/rules/max-line-length.d.ts.map +1 -1
  237. package/dist/rules/max-line-length.js +62 -7
  238. package/dist/rules/max-line-length.js.map +1 -1
  239. package/dist/rules/no-commented-out-code.d.ts +3 -7
  240. package/dist/rules/no-commented-out-code.d.ts.map +1 -1
  241. package/dist/rules/no-commented-out-code.js +157 -102
  242. package/dist/rules/no-commented-out-code.js.map +1 -1
  243. package/dist/rules/pascal-case-types.d.ts +1 -1
  244. package/dist/rules/pascal-case-types.d.ts.map +1 -1
  245. package/dist/rules/pascal-case-types.js +65 -46
  246. package/dist/rules/pascal-case-types.js.map +1 -1
  247. package/dist/rules/plugin-commented-out-code-rule.d.ts +32 -0
  248. package/dist/rules/plugin-commented-out-code-rule.d.ts.map +1 -0
  249. package/dist/rules/plugin-commented-out-code-rule.js +135 -0
  250. package/dist/rules/plugin-commented-out-code-rule.js.map +1 -0
  251. package/dist/rules/plugin.d.ts +3 -121
  252. package/dist/rules/plugin.d.ts.map +1 -1
  253. package/dist/rules/plugin.js +195 -201
  254. package/dist/rules/plugin.js.map +1 -1
  255. package/dist/rules/private-underscore.d.ts +1 -1
  256. package/dist/rules/private-underscore.d.ts.map +1 -1
  257. package/dist/rules/private-underscore.js +11 -4
  258. package/dist/rules/private-underscore.js.map +1 -1
  259. package/dist/rules/require-file-doc.d.ts +5 -6
  260. package/dist/rules/require-file-doc.d.ts.map +1 -1
  261. package/dist/rules/require-file-doc.js +127 -78
  262. package/dist/rules/require-file-doc.js.map +1 -1
  263. package/dist/rules/require-function-doc-ignored-text.d.ts +7 -0
  264. package/dist/rules/require-function-doc-ignored-text.d.ts.map +1 -0
  265. package/dist/rules/require-function-doc-ignored-text.js +67 -0
  266. package/dist/rules/require-function-doc-ignored-text.js.map +1 -0
  267. package/dist/rules/require-function-doc-local-exports.d.ts +7 -0
  268. package/dist/rules/require-function-doc-local-exports.d.ts.map +1 -0
  269. package/dist/rules/require-function-doc-local-exports.js +114 -0
  270. package/dist/rules/require-function-doc-local-exports.js.map +1 -0
  271. package/dist/rules/require-function-doc.d.ts +3 -18
  272. package/dist/rules/require-function-doc.d.ts.map +1 -1
  273. package/dist/rules/require-function-doc.js +404 -218
  274. package/dist/rules/require-function-doc.js.map +1 -1
  275. package/dist/rules/source-cache.d.ts +19 -0
  276. package/dist/rules/source-cache.d.ts.map +1 -0
  277. package/dist/rules/source-cache.js +63 -0
  278. package/dist/rules/source-cache.js.map +1 -0
  279. package/package.json +15 -10
@@ -0,0 +1,198 @@
1
+ export { hasEffectSignal, hasRuntimeCall } from './effect-rule-core';
2
+ interface RuleContext {
3
+ filename?: string;
4
+ options?: object[];
5
+ report: (descriptor: {
6
+ loc?: {
7
+ column: number;
8
+ line: number;
9
+ };
10
+ message: string;
11
+ node: object;
12
+ }) => void;
13
+ }
14
+ type ASTValue = boolean | null | number | object | string | undefined;
15
+ /**
16
+ * Internal helper exported for package-local composition.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare const reportAST: (context: RuleContext, message: string, node: object) => void;
21
+ /**
22
+ * Internal helper exported for package-local composition.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare const objectValue: (node: ASTValue, key: string) => ASTValue;
27
+ /**
28
+ * Internal helper exported for package-local composition.
29
+ *
30
+ * @internal
31
+ */
32
+ export declare const arrayValue: (node: ASTValue) => ASTValue[];
33
+ /**
34
+ * Internal helper exported for package-local composition.
35
+ *
36
+ * @internal
37
+ */
38
+ export declare const nodeType: (node: ASTValue) => string | undefined;
39
+ /**
40
+ * Internal helper exported for package-local composition.
41
+ *
42
+ * @internal
43
+ */
44
+ export declare const identifierName: (node: ASTValue) => string | undefined;
45
+ /**
46
+ * Internal helper exported for package-local composition.
47
+ *
48
+ * @internal
49
+ */
50
+ export declare const literalValue: (node: ASTValue) => ASTValue;
51
+ /**
52
+ * Internal helper exported for package-local composition.
53
+ *
54
+ * @internal
55
+ */
56
+ export declare const isVoidZero: (node: ASTValue) => boolean;
57
+ /**
58
+ * Internal helper exported for package-local composition.
59
+ *
60
+ * @internal
61
+ */
62
+ export declare const isMember: (node: ASTValue, objectName: string, propertyName: string) => boolean;
63
+ /**
64
+ * Internal helper exported for package-local composition.
65
+ *
66
+ * @internal
67
+ */
68
+ export declare const isSchemaMember: (node: ASTValue, source: string, propertyName: string) => boolean;
69
+ /**
70
+ * Internal helper exported for package-local composition.
71
+ *
72
+ * @internal
73
+ */
74
+ export declare const effectCallPredicate: (source: string, names: readonly string[]) => ((callee: ASTValue) => boolean);
75
+ /**
76
+ * Internal helper exported for package-local composition.
77
+ *
78
+ * @internal
79
+ */
80
+ export declare const serviceKeyFromClass: (node: ASTValue, source: string) => {
81
+ className?: string;
82
+ key?: string;
83
+ };
84
+ /**
85
+ * Internal helper exported for package-local composition.
86
+ *
87
+ * @internal
88
+ */
89
+ export declare const hasRetryScheduleWithoutJitter: (source: string) => boolean;
90
+ /**
91
+ * Internal helper exported for package-local composition.
92
+ *
93
+ * @internal
94
+ */
95
+ export declare const publicAPIDeclarationSignature: (declaration: string) => string;
96
+ /**
97
+ * Internal helper exported for package-local composition.
98
+ *
99
+ * @internal
100
+ */
101
+ export declare const hasPromiseReturningPublicAPI: (source: string) => boolean;
102
+ /**
103
+ * Internal helper exported for package-local composition.
104
+ *
105
+ * @internal
106
+ */
107
+ export declare const hasExportedRunPromiseAPI: (source: string) => boolean;
108
+ /**
109
+ * Internal helper exported for package-local composition.
110
+ *
111
+ * @internal
112
+ */
113
+ export declare const hasRunSyncInServerRequestHandler: (source: string) => boolean;
114
+ /**
115
+ * Internal helper exported for package-local composition.
116
+ *
117
+ * @internal
118
+ */
119
+ export declare const hasCryptoRandomUUID: (source: string) => number | false;
120
+ /**
121
+ * Internal helper exported for package-local composition.
122
+ *
123
+ * @internal
124
+ */
125
+ export declare const hasSchemaInstanceof: (source: string) => number | false;
126
+ /**
127
+ * Internal helper exported for package-local composition.
128
+ *
129
+ * @internal
130
+ */
131
+ export declare const hasSchemaStructWithTag: (source: string) => number | false;
132
+ /**
133
+ * Internal helper exported for package-local composition.
134
+ *
135
+ * @internal
136
+ */
137
+ export declare const hasSchemaUnionOfLiterals: (source: string) => number | false;
138
+ /**
139
+ * Internal helper exported for package-local composition.
140
+ *
141
+ * @internal
142
+ */
143
+ export declare const hasNonDeterministicServiceKey: (source: string) => number | false;
144
+ /**
145
+ * Internal helper exported for package-local composition.
146
+ *
147
+ * @internal
148
+ */
149
+ export declare const hasMultipleProvideChain: (source: string) => number | false;
150
+ /**
151
+ * Internal helper exported for package-local composition.
152
+ *
153
+ * @internal
154
+ */
155
+ export declare const hasLayerEffectWithScope: (source: string) => number | false;
156
+ /**
157
+ * Internal helper exported for package-local composition.
158
+ *
159
+ * @internal
160
+ */
161
+ export declare const hasNodeBuiltinImport: (source: string) => number | false;
162
+ /**
163
+ * Internal helper exported for package-local composition.
164
+ *
165
+ * @internal
166
+ */
167
+ export declare const hasGlobalFetch: (source: string, context: RuleContext) => number | false;
168
+ /**
169
+ * Internal helper exported for package-local composition.
170
+ *
171
+ * @internal
172
+ */
173
+ export declare const hasEffectSucceedWithVoid: (source: string) => number | false;
174
+ /**
175
+ * Internal helper exported for package-local composition.
176
+ *
177
+ * @internal
178
+ */
179
+ export declare const hasMapToVoid: (source: string) => number | false;
180
+ /**
181
+ * Internal helper exported for package-local composition.
182
+ *
183
+ * @internal
184
+ */
185
+ export declare const hasMapFlatten: (source: string) => number | false;
186
+ /**
187
+ * Internal helper exported for package-local composition.
188
+ *
189
+ * @internal
190
+ */
191
+ export declare const effectWrapperStatement: (source: string, targetIndex: number) => string | undefined;
192
+ /**
193
+ * Internal helper exported for package-local composition.
194
+ *
195
+ * @internal
196
+ */
197
+ export declare const hasDirectPlatformAccess: (source: string, context: RuleContext) => boolean;
198
+ //# sourceMappingURL=effect-strict-internals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-strict-internals.d.ts","sourceRoot":"","sources":["../../src/rules/effect-strict-internals.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,477 @@
1
+ /* -------------------------------------------------------------------------- */
2
+ /* AST and source predicates for opt-in strict Effect lint rules. */
3
+ /* -------------------------------------------------------------------------- */
4
+ import { effectAPIAliases, effectFunctionAliases, effectImportAliases } from './effect-rule-core.js';
5
+ import { exportedDeclarationTexts, findBalancedCallEnd, findMatchingBrace, findStatementEnd, stripComments, stripCommentsAndStrings, } from './effect-source-helpers.js';
6
+ import { isConfiguredPath } from './effect-path-options.js';
7
+ export { hasEffectSignal, hasRuntimeCall } from './effect-rule-core.js';
8
+ /**
9
+ * Internal helper exported for package-local composition.
10
+ *
11
+ * @internal
12
+ */
13
+ export const reportAST = (context, message, node) => {
14
+ context.report({ message, node });
15
+ };
16
+ const isASTValue = (value) => value === undefined ||
17
+ value === null ||
18
+ ['boolean', 'number', 'object', 'string'].includes(typeof value);
19
+ /**
20
+ * Internal helper exported for package-local composition.
21
+ *
22
+ * @internal
23
+ */
24
+ export const objectValue = (node, key) => {
25
+ if (typeof node !== 'object' || node === null) {
26
+ return undefined;
27
+ }
28
+ const value = Reflect.get(node, key);
29
+ if (isASTValue(value)) {
30
+ return value;
31
+ }
32
+ return undefined;
33
+ };
34
+ /**
35
+ * Internal helper exported for package-local composition.
36
+ *
37
+ * @internal
38
+ */
39
+ export const arrayValue = (node) => {
40
+ if (Array.isArray(node)) {
41
+ return node.filter(isASTValue);
42
+ }
43
+ return [];
44
+ };
45
+ /**
46
+ * Internal helper exported for package-local composition.
47
+ *
48
+ * @internal
49
+ */
50
+ export const nodeType = (node) => {
51
+ const type = objectValue(node, 'type');
52
+ if (typeof type === 'string') {
53
+ return type;
54
+ }
55
+ return undefined;
56
+ };
57
+ /**
58
+ * Internal helper exported for package-local composition.
59
+ *
60
+ * @internal
61
+ */
62
+ export const identifierName = (node) => {
63
+ if (nodeType(node) === 'Identifier') {
64
+ const name = objectValue(node, 'name');
65
+ if (typeof name === 'string') {
66
+ return name;
67
+ }
68
+ return undefined;
69
+ }
70
+ return undefined;
71
+ };
72
+ /**
73
+ * Internal helper exported for package-local composition.
74
+ *
75
+ * @internal
76
+ */
77
+ export const literalValue = (node) => {
78
+ if (nodeType(node) === 'Literal') {
79
+ return objectValue(node, 'value');
80
+ }
81
+ return undefined;
82
+ };
83
+ /**
84
+ * Internal helper exported for package-local composition.
85
+ *
86
+ * @internal
87
+ */
88
+ export const isVoidZero = (node) => {
89
+ if (nodeType(node) !== 'UnaryExpression') {
90
+ return false;
91
+ }
92
+ return (objectValue(node, 'operator') === 'void' && literalValue(objectValue(node, 'argument')) === 0);
93
+ };
94
+ const memberParts = (node) => {
95
+ if (nodeType(node) !== 'MemberExpression') {
96
+ return {};
97
+ }
98
+ return {
99
+ objectName: identifierName(objectValue(node, 'object')),
100
+ propertyName: identifierName(objectValue(node, 'property')),
101
+ };
102
+ };
103
+ /**
104
+ * Internal helper exported for package-local composition.
105
+ *
106
+ * @internal
107
+ */
108
+ export const isMember = (node, objectName, propertyName) => {
109
+ const parts = memberParts(node);
110
+ return parts.objectName === objectName && parts.propertyName === propertyName;
111
+ };
112
+ /**
113
+ * Internal helper exported for package-local composition.
114
+ *
115
+ * @internal
116
+ */
117
+ export const isSchemaMember = (node, source, propertyName) => {
118
+ const parts = memberParts(node);
119
+ return Boolean(parts.objectName &&
120
+ parts.propertyName === propertyName &&
121
+ effectAPIAliases(source, 'Schema').includes(parts.objectName));
122
+ };
123
+ /**
124
+ * Internal helper exported for package-local composition.
125
+ *
126
+ * @internal
127
+ */
128
+ export const effectCallPredicate = (source, names) => {
129
+ const memberNames = new Set(names);
130
+ const importAliases = new Set(effectImportAliases(source));
131
+ const functionAliases = new Set(names.flatMap((name) => effectFunctionAliases(source, 'Effect', name)));
132
+ return (callee) => {
133
+ const { objectName, propertyName } = memberParts(callee);
134
+ if (objectName && propertyName) {
135
+ return importAliases.has(objectName) && memberNames.has(propertyName);
136
+ }
137
+ const calleeName = identifierName(callee);
138
+ return Boolean(calleeName && functionAliases.has(calleeName));
139
+ };
140
+ };
141
+ const literalStringValue = (node) => {
142
+ const value = literalValue(node);
143
+ if (typeof value === 'string') {
144
+ return value;
145
+ }
146
+ return undefined;
147
+ };
148
+ const contextTagServiceKey = (innerArguments) => {
149
+ const [firstInnerArgument] = arrayValue(innerArguments);
150
+ return literalStringValue(firstInnerArgument);
151
+ };
152
+ const effectServiceKey = (outerArguments) => {
153
+ const [firstOuterArgument] = arrayValue(outerArguments);
154
+ return literalStringValue(firstOuterArgument);
155
+ };
156
+ const contextTagKeyFromMember = (member, innerArguments) => {
157
+ if (member.objectName === 'Context' &&
158
+ (member.propertyName === 'Tag' || member.propertyName === 'GenericTag')) {
159
+ return contextTagServiceKey(innerArguments);
160
+ }
161
+ return undefined;
162
+ };
163
+ const effectServiceKeyFromMember = (source, member, outerArguments) => {
164
+ if (member.objectName &&
165
+ effectImportAliases(source).includes(member.objectName) &&
166
+ member.propertyName === 'Service') {
167
+ return effectServiceKey(outerArguments);
168
+ }
169
+ return undefined;
170
+ };
171
+ const serviceClassSuperCallParts = (node) => {
172
+ const superClass = objectValue(node, 'superClass');
173
+ const className = identifierName(objectValue(node, 'id'));
174
+ if (nodeType(superClass) !== 'CallExpression') {
175
+ return undefined;
176
+ }
177
+ const inner = objectValue(superClass, 'callee');
178
+ if (!inner || nodeType(inner) !== 'CallExpression') {
179
+ return undefined;
180
+ }
181
+ return { className, inner, outerArguments: objectValue(superClass, 'arguments') };
182
+ };
183
+ /**
184
+ * Internal helper exported for package-local composition.
185
+ *
186
+ * @internal
187
+ */
188
+ export const serviceKeyFromClass = (node, source) => {
189
+ const className = identifierName(objectValue(node, 'id'));
190
+ const parts = serviceClassSuperCallParts(node);
191
+ if (!parts) {
192
+ return { className };
193
+ }
194
+ const innerArguments = objectValue(parts.inner, 'arguments');
195
+ const member = memberParts(objectValue(parts.inner, 'callee'));
196
+ const key = contextTagKeyFromMember(member, innerArguments) ??
197
+ effectServiceKeyFromMember(source, member, parts.outerArguments);
198
+ if (key) {
199
+ return { className, key };
200
+ }
201
+ return { className };
202
+ };
203
+ /**
204
+ * Internal helper exported for package-local composition.
205
+ *
206
+ * @internal
207
+ */
208
+ export const hasRetryScheduleWithoutJitter = (source) => {
209
+ for (const match of source.matchAll(/\bEffect\.retry\s*\(/g)) {
210
+ const openParenIndex = source.indexOf('(', match.index);
211
+ const callBody = source.slice(openParenIndex + 1, findBalancedCallEnd(source, openParenIndex));
212
+ if (/\bSchedule\./.test(callBody) && !/\bjitter(?:ed)?\b/.test(callBody)) {
213
+ return true;
214
+ }
215
+ }
216
+ return false;
217
+ };
218
+ const declarationBeforeBody = (declaration) => {
219
+ const bodyStart = declaration.indexOf('{');
220
+ if (bodyStart === -1) {
221
+ return declaration;
222
+ }
223
+ return declaration.slice(0, bodyStart);
224
+ };
225
+ /**
226
+ * Internal helper exported for package-local composition.
227
+ *
228
+ * @internal
229
+ */
230
+ export const publicAPIDeclarationSignature = (declaration) => {
231
+ if (/^\s*(?:export\s+)?(?:async\s+)?function\b/.test(declaration)) {
232
+ return declarationBeforeBody(declaration);
233
+ }
234
+ if (/^\s*(?:export\s+)?(?:const|let|var)\b/.test(declaration)) {
235
+ return declarationBeforeBody(declaration);
236
+ }
237
+ return declaration;
238
+ };
239
+ const hasClassPromiseReturningPublicMember = (declaration) => {
240
+ if (!/^\s*(?:export\s+)?(?:default\s+)?(?:abstract\s+)?class\b/.test(declaration)) {
241
+ return false;
242
+ }
243
+ const signatureSource = stripCommentsAndStrings(declaration);
244
+ const publicMemberPrefix = String.raw `(?!private\b|protected\b)(?:(?:public|static|abstract|override|declare|readonly)\s+)*`;
245
+ const memberName = String.raw `[A-Za-z_$][\w$]*`;
246
+ const memberStart = `(?:^|[{\\n;]\\s*)${publicMemberPrefix}${memberName}`;
247
+ const accessorStart = `(?:^|[{\\n;]\\s*)${publicMemberPrefix}`;
248
+ return (new RegExp(`${memberStart}\\s*\\([^)]*\\)\\s*:\\s*Promise\\s*<`).test(signatureSource) ||
249
+ new RegExp(`(?:^|[{\\n;]\\s*)${publicMemberPrefix}async\\s+${memberName}\\s*\\([^)]*\\)`).test(signatureSource) ||
250
+ new RegExp(`${memberStart}\\s*=\\s*async\\b`).test(signatureSource) ||
251
+ new RegExp(`${memberStart}\\s*=\\s*\\([^)]*\\)\\s*:\\s*Promise\\s*<`).test(signatureSource) ||
252
+ new RegExp(`${memberStart}\\s*:\\s*[^;\\n=]*Promise\\s*<`).test(signatureSource) ||
253
+ new RegExp(`${accessorStart}get\\s+${memberName}\\s*\\([^)]*\\)\\s*:\\s*Promise\\s*<`).test(signatureSource) ||
254
+ new RegExp(`${accessorStart}accessor\\s+${memberName}\\s*:\\s*[^;\\n=]*Promise\\s*<`).test(signatureSource));
255
+ };
256
+ /**
257
+ * Internal helper exported for package-local composition.
258
+ *
259
+ * @internal
260
+ */
261
+ export const hasPromiseReturningPublicAPI = (source) => exportedDeclarationTexts(source).some((declaration) => {
262
+ if (/^\s*(?:export\s+)?(?:default\s+)?(?:abstract\s+)?class\b/.test(declaration)) {
263
+ return hasClassPromiseReturningPublicMember(declaration);
264
+ }
265
+ const signature = stripCommentsAndStrings(publicAPIDeclarationSignature(declaration));
266
+ return (/\bPromise\s*</.test(signature) ||
267
+ /^\s*(?:export\s+)?async\s+function\b/.test(signature) ||
268
+ /=\s*async\b/.test(signature));
269
+ });
270
+ /**
271
+ * Internal helper exported for package-local composition.
272
+ *
273
+ * @internal
274
+ */
275
+ export const hasExportedRunPromiseAPI = (source) => exportedDeclarationTexts(source).some((declaration) => /\bEffect\.runPromise\s*\(/.test(stripCommentsAndStrings(declaration)));
276
+ const functionBodySegment = (code, matchIndex) => {
277
+ const bodyStart = code.indexOf('{', matchIndex);
278
+ if (bodyStart === -1) {
279
+ return undefined;
280
+ }
281
+ const bodyEnd = findMatchingBrace(code, bodyStart);
282
+ if (bodyEnd === -1) {
283
+ return undefined;
284
+ }
285
+ return code.slice(bodyStart, bodyEnd + 1);
286
+ };
287
+ /**
288
+ * Internal helper exported for package-local composition.
289
+ *
290
+ * @internal
291
+ */
292
+ export const hasRunSyncInServerRequestHandler = (source) => {
293
+ const code = stripCommentsAndStrings(source);
294
+ for (const match of code.matchAll(/\b(?:handler|route|loader|action)\s*=/g)) {
295
+ const segment = code.slice(match.index, findStatementEnd(code, match.index) + 1);
296
+ if (/\bEffect\.runSync\s*\(/.test(segment)) {
297
+ return true;
298
+ }
299
+ }
300
+ for (const match of code.matchAll(/\bfunction\s+(?:handler|route|loader|action)\s*\(/g)) {
301
+ const body = functionBodySegment(code, match.index);
302
+ if (body && /\bEffect\.runSync\s*\(/.test(body)) {
303
+ return true;
304
+ }
305
+ }
306
+ return false;
307
+ };
308
+ /**
309
+ * Internal helper exported for package-local composition.
310
+ *
311
+ * @internal
312
+ */
313
+ export const hasCryptoRandomUUID = (source) => {
314
+ const match = /\bcrypto\.randomUUID\s*\(/.exec(stripCommentsAndStrings(source));
315
+ return match?.index ?? false;
316
+ };
317
+ /**
318
+ * Internal helper exported for package-local composition.
319
+ *
320
+ * @internal
321
+ */
322
+ export const hasSchemaInstanceof = (source) => {
323
+ const code = stripCommentsAndStrings(source);
324
+ const match = /\binstanceof\s+[A-Z][\w$]*(?:Schema|Request)\b/.exec(code);
325
+ return match?.index ?? false;
326
+ };
327
+ /**
328
+ * Internal helper exported for package-local composition.
329
+ *
330
+ * @internal
331
+ */
332
+ export const hasSchemaStructWithTag = (source) => {
333
+ const match = /\bSchema\.Struct\s*\(\s*{[\s\S]*?_tag\s*:\s*Schema\.Literal\s*\(/.exec(stripCommentsAndStrings(source));
334
+ return match?.index ?? false;
335
+ };
336
+ /**
337
+ * Internal helper exported for package-local composition.
338
+ *
339
+ * @internal
340
+ */
341
+ export const hasSchemaUnionOfLiterals = (source) => {
342
+ const match = /\bSchema\.Union\s*\(\s*Schema\.Literal\s*\([^)]*\)\s*,\s*Schema\.Literal\s*\(/.exec(stripCommentsAndStrings(source));
343
+ return match?.index ?? false;
344
+ };
345
+ const nonDeterministicServiceKeyIndex = (code, pattern) => {
346
+ for (const match of code.matchAll(pattern)) {
347
+ const [, className, key] = match;
348
+ if (className !== key && !key.endsWith(`/${className}`)) {
349
+ return match.index;
350
+ }
351
+ }
352
+ return undefined;
353
+ };
354
+ /**
355
+ * Internal helper exported for package-local composition.
356
+ *
357
+ * @internal
358
+ */
359
+ export const hasNonDeterministicServiceKey = (source) => {
360
+ const code = stripComments(source);
361
+ const legacyPattern = /\bclass\s+([A-Z][\w$]*)\s+extends\s+(?:Context\.Tag|Effect\.Service|Effect\.Tag)\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
362
+ const legacyIndex = nonDeterministicServiceKeyIndex(code, legacyPattern);
363
+ if (legacyIndex !== undefined) {
364
+ return legacyIndex;
365
+ }
366
+ const servicePattern = /\bclass\s+([A-Z][\w$]*)\s+extends\s+Effect\.Service\s*<\s*[A-Z][\w$]*\s*>\s*\(\s*\)\s*\(\s*['"`]([^'"`]+)['"`]/g;
367
+ return nonDeterministicServiceKeyIndex(code, servicePattern) ?? false;
368
+ };
369
+ /**
370
+ * Internal helper exported for package-local composition.
371
+ *
372
+ * @internal
373
+ */
374
+ export const hasMultipleProvideChain = (source) => {
375
+ const code = stripCommentsAndStrings(source);
376
+ const match = /\.pipe\s*\([\s\S]*?Effect\.provide\s*\([\s\S]*?Effect\.provide\s*\(/.exec(code);
377
+ return match?.index ?? false;
378
+ };
379
+ /**
380
+ * Internal helper exported for package-local composition.
381
+ *
382
+ * @internal
383
+ */
384
+ export const hasLayerEffectWithScope = (source) => {
385
+ const code = stripCommentsAndStrings(source);
386
+ const match = /\bLayer\.effect\s*\([\s\S]*?\b(?:Scope\.Scope|Scope)\b/.exec(code);
387
+ return match?.index ?? false;
388
+ };
389
+ /**
390
+ * Internal helper exported for package-local composition.
391
+ *
392
+ * @internal
393
+ */
394
+ export const hasNodeBuiltinImport = (source) => {
395
+ const match = /\bfrom\s+['"]node:(?:fs|fs\/promises|path|child_process|crypto|stream|http|https)['"]/.exec(stripComments(source));
396
+ return match?.index ?? false;
397
+ };
398
+ /**
399
+ * Internal helper exported for package-local composition.
400
+ *
401
+ * @internal
402
+ */
403
+ export const hasGlobalFetch = (source, context) => {
404
+ const code = stripCommentsAndStrings(source);
405
+ if (isConfiguredPath(context, 'adapterLayers')) {
406
+ return false;
407
+ }
408
+ for (const match of code.matchAll(/\bfetch\s*\(/g)) {
409
+ const wrappedFetch = Boolean(effectWrapperStatement(code, match.index));
410
+ if (wrappedFetch) {
411
+ return match.index;
412
+ }
413
+ }
414
+ return false;
415
+ };
416
+ /**
417
+ * Internal helper exported for package-local composition.
418
+ *
419
+ * @internal
420
+ */
421
+ export const hasEffectSucceedWithVoid = (source) => {
422
+ const match = /\bEffect\.succeed\s*\(\s*(?:undefined|void\s+0)?\s*\)/.exec(stripCommentsAndStrings(source));
423
+ return match?.index ?? false;
424
+ };
425
+ /**
426
+ * Internal helper exported for package-local composition.
427
+ *
428
+ * @internal
429
+ */
430
+ export const hasMapToVoid = (source) => {
431
+ const match = /\bEffect\.map\s*\(\s*\(\s*\)\s*=>\s*(?:undefined|void\s+0|\{\s*\})\s*\)/.exec(stripCommentsAndStrings(source));
432
+ return match?.index ?? false;
433
+ };
434
+ /**
435
+ * Internal helper exported for package-local composition.
436
+ *
437
+ * @internal
438
+ */
439
+ export const hasMapFlatten = (source) => {
440
+ const match = /\bEffect\.map\s*\([\s\S]*?\)\s*,\s*Effect\.flatten\b|\bEffect\.map\s*\([\s\S]*?\)\.pipe\s*\(\s*Effect\.flatten\b/.exec(stripCommentsAndStrings(source));
441
+ return match?.index ?? false;
442
+ };
443
+ /**
444
+ * Internal helper exported for package-local composition.
445
+ *
446
+ * @internal
447
+ */
448
+ export const effectWrapperStatement = (source, targetIndex) => {
449
+ const statementStart = Math.max(source.lastIndexOf(';', targetIndex) + 1, source.lastIndexOf('\n', targetIndex) + 1);
450
+ const statementEnd = findStatementEnd(source, statementStart);
451
+ const statement = source.slice(statementStart, statementEnd + 1);
452
+ if (/\bEffect\.(?:promise|tryPromise)\s*\(/.test(statement)) {
453
+ return statement;
454
+ }
455
+ return undefined;
456
+ };
457
+ /**
458
+ * Internal helper exported for package-local composition.
459
+ *
460
+ * @internal
461
+ */
462
+ export const hasDirectPlatformAccess = (source, context) => {
463
+ if (isConfiguredPath(context, 'adapterLayers')) {
464
+ return false;
465
+ }
466
+ const code = stripCommentsAndStrings(source);
467
+ for (const match of code.matchAll(/\b(?:fetch|readFileSync|writeFileSync|createReadStream)\s*\(/g)) {
468
+ if (!match[0].startsWith('fetch')) {
469
+ return true;
470
+ }
471
+ if (!effectWrapperStatement(code, match.index)) {
472
+ return true;
473
+ }
474
+ }
475
+ return false;
476
+ };
477
+ //# sourceMappingURL=effect-strict-internals.js.map