@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.
- package/CHANGELOG.md +13 -0
- package/README.md +125 -19
- package/dist/codemod-fix/cli.d.ts +3 -0
- package/dist/codemod-fix/cli.d.ts.map +1 -0
- package/dist/codemod-fix/cli.js +22 -0
- package/dist/codemod-fix/cli.js.map +1 -0
- package/dist/codemod-fix/index.d.ts +44 -0
- package/dist/codemod-fix/index.d.ts.map +1 -0
- package/dist/codemod-fix/index.js +110 -0
- package/dist/codemod-fix/index.js.map +1 -0
- package/dist/codemods/arrow-body-style.d.ts +7 -0
- package/dist/codemods/arrow-body-style.d.ts.map +1 -0
- package/dist/codemods/arrow-body-style.js +106 -0
- package/dist/codemods/arrow-body-style.js.map +1 -0
- package/dist/codemods/comment-format.d.ts +24 -0
- package/dist/codemods/comment-format.d.ts.map +1 -0
- package/dist/codemods/comment-format.js +100 -0
- package/dist/codemods/comment-format.js.map +1 -0
- package/dist/codemods/explicit-return-types.d.ts +7 -0
- package/dist/codemods/explicit-return-types.d.ts.map +1 -0
- package/dist/codemods/explicit-return-types.js +350 -0
- package/dist/codemods/explicit-return-types.js.map +1 -0
- package/dist/codemods/format-file-header.d.ts +7 -0
- package/dist/codemods/format-file-header.d.ts.map +1 -0
- package/dist/codemods/format-file-header.js +163 -0
- package/dist/codemods/format-file-header.js.map +1 -0
- package/dist/codemods/format-jsdoc-comments.d.ts +7 -0
- package/dist/codemods/format-jsdoc-comments.d.ts.map +1 -0
- package/dist/codemods/format-jsdoc-comments.js +129 -0
- package/dist/codemods/format-jsdoc-comments.js.map +1 -0
- package/dist/codemods/function-declarations.d.ts +7 -0
- package/dist/codemods/function-declarations.d.ts.map +1 -0
- package/dist/codemods/function-declarations.js +202 -0
- package/dist/codemods/function-declarations.js.map +1 -0
- package/dist/codemods/inline-export-lists.d.ts +7 -0
- package/dist/codemods/inline-export-lists.d.ts.map +1 -0
- package/dist/codemods/inline-export-lists.js +168 -0
- package/dist/codemods/inline-export-lists.js.map +1 -0
- package/dist/codemods/internal-export-docs.d.ts +7 -0
- package/dist/codemods/internal-export-docs.d.ts.map +1 -0
- package/dist/codemods/internal-export-docs.js +93 -0
- package/dist/codemods/internal-export-docs.js.map +1 -0
- package/dist/codemods/no-ternary-branch-initializers.d.ts +14 -0
- package/dist/codemods/no-ternary-branch-initializers.d.ts.map +1 -0
- package/dist/codemods/no-ternary-branch-initializers.js +240 -0
- package/dist/codemods/no-ternary-branch-initializers.js.map +1 -0
- package/dist/codemods/no-ternary-variable-initializers.d.ts +14 -0
- package/dist/codemods/no-ternary-variable-initializers.d.ts.map +1 -0
- package/dist/codemods/no-ternary-variable-initializers.js +235 -0
- package/dist/codemods/no-ternary-variable-initializers.js.map +1 -0
- package/dist/codemods/no-ternary.d.ts +7 -0
- package/dist/codemods/no-ternary.d.ts.map +1 -0
- package/dist/codemods/no-ternary.js +215 -0
- package/dist/codemods/no-ternary.js.map +1 -0
- package/dist/codemods/rename-acronyms.d.ts +8 -0
- package/dist/codemods/rename-acronyms.d.ts.map +1 -0
- package/dist/codemods/rename-acronyms.js +193 -0
- package/dist/codemods/rename-acronyms.js.map +1 -0
- package/dist/codemods/run.d.ts +2 -0
- package/dist/codemods/run.d.ts.map +1 -0
- package/dist/codemods/run.js +14 -0
- package/dist/codemods/run.js.map +1 -0
- package/dist/codemods/sort-imports.d.ts +7 -0
- package/dist/codemods/sort-imports.d.ts.map +1 -0
- package/dist/codemods/sort-imports.js +235 -0
- package/dist/codemods/sort-imports.js.map +1 -0
- package/dist/index.d.ts +30 -96
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +157 -95
- package/dist/index.js.map +1 -1
- package/dist/rules/acronym-case.d.ts +7 -3
- package/dist/rules/acronym-case.d.ts.map +1 -1
- package/dist/rules/acronym-case.js +129 -120
- package/dist/rules/acronym-case.js.map +1 -1
- package/dist/rules/acronyms-1.d.ts +3 -0
- package/dist/rules/acronyms-1.d.ts.map +1 -0
- package/dist/rules/acronyms-1.js +407 -0
- package/dist/rules/acronyms-1.js.map +1 -0
- package/dist/rules/acronyms-2.d.ts +3 -0
- package/dist/rules/acronyms-2.d.ts.map +1 -0
- package/dist/rules/acronyms-2.js +407 -0
- package/dist/rules/acronyms-2.js.map +1 -0
- package/dist/rules/acronyms-3.d.ts +3 -0
- package/dist/rules/acronyms-3.d.ts.map +1 -0
- package/dist/rules/acronyms-3.js +407 -0
- package/dist/rules/acronyms-3.js.map +1 -0
- package/dist/rules/acronyms-4.d.ts +3 -0
- package/dist/rules/acronyms-4.d.ts.map +1 -0
- package/dist/rules/acronyms-4.js +377 -0
- package/dist/rules/acronyms-4.js.map +1 -0
- package/dist/rules/acronyms.d.ts +1 -8
- package/dist/rules/acronyms.d.ts.map +1 -1
- package/dist/rules/acronyms.js +14 -1578
- package/dist/rules/acronyms.js.map +1 -1
- package/dist/rules/boolean-prefix.d.ts +11 -2
- package/dist/rules/boolean-prefix.d.ts.map +1 -1
- package/dist/rules/boolean-prefix.js +95 -59
- package/dist/rules/boolean-prefix.js.map +1 -1
- package/dist/rules/camel-case-identifiers.d.ts +3 -4
- package/dist/rules/camel-case-identifiers.d.ts.map +1 -1
- package/dist/rules/camel-case-identifiers.js +59 -40
- package/dist/rules/camel-case-identifiers.js.map +1 -1
- package/dist/rules/char-class.d.ts +26 -13
- package/dist/rules/char-class.d.ts.map +1 -1
- package/dist/rules/char-class.js +56 -24
- package/dist/rules/char-class.js.map +1 -1
- package/dist/rules/diagnostic-guidance.d.ts +91 -0
- package/dist/rules/diagnostic-guidance.d.ts.map +1 -0
- package/dist/rules/diagnostic-guidance.js +243 -0
- package/dist/rules/diagnostic-guidance.js.map +1 -0
- package/dist/rules/effect-default-ast.d.ts +89 -0
- package/dist/rules/effect-default-ast.d.ts.map +1 -0
- package/dist/rules/effect-default-ast.js +208 -0
- package/dist/rules/effect-default-ast.js.map +1 -0
- package/dist/rules/effect-default-compat-rules.d.ts +76 -0
- package/dist/rules/effect-default-compat-rules.d.ts.map +1 -0
- package/dist/rules/effect-default-compat-rules.js +270 -0
- package/dist/rules/effect-default-compat-rules.js.map +1 -0
- package/dist/rules/effect-default-env-rules.d.ts +60 -0
- package/dist/rules/effect-default-env-rules.d.ts.map +1 -0
- package/dist/rules/effect-default-env-rules.js +259 -0
- package/dist/rules/effect-default-env-rules.js.map +1 -0
- package/dist/rules/effect-default-fiber-helpers.d.ts +13 -0
- package/dist/rules/effect-default-fiber-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-fiber-helpers.js +76 -0
- package/dist/rules/effect-default-fiber-helpers.js.map +1 -0
- package/dist/rules/effect-default-floating-helpers.d.ts +7 -0
- package/dist/rules/effect-default-floating-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-floating-helpers.js +113 -0
- package/dist/rules/effect-default-floating-helpers.js.map +1 -0
- package/dist/rules/effect-default-helpers.d.ts +8 -32
- package/dist/rules/effect-default-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-helpers.js +11 -458
- package/dist/rules/effect-default-helpers.js.map +1 -1
- package/dist/rules/effect-default-resource-helpers.d.ts +18 -4
- package/dist/rules/effect-default-resource-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-resource-helpers.js +30 -13
- package/dist/rules/effect-default-resource-helpers.js.map +1 -1
- package/dist/rules/effect-default-safety-helpers.d.ts +43 -0
- package/dist/rules/effect-default-safety-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-safety-helpers.js +126 -0
- package/dist/rules/effect-default-safety-helpers.js.map +1 -0
- package/dist/rules/effect-default-scan-helpers.d.ts +43 -0
- package/dist/rules/effect-default-scan-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-scan-helpers.js +141 -0
- package/dist/rules/effect-default-scan-helpers.js.map +1 -0
- package/dist/rules/effect-default-schema-helpers.d.ts +37 -0
- package/dist/rules/effect-default-schema-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-schema-helpers.js +104 -0
- package/dist/rules/effect-default-schema-helpers.js.map +1 -0
- package/dist/rules/effect-default-test-helpers.d.ts +18 -4
- package/dist/rules/effect-default-test-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-test-helpers.js +41 -20
- package/dist/rules/effect-default-test-helpers.js.map +1 -1
- package/dist/rules/effect-default-workflow-helpers.d.ts +91 -0
- package/dist/rules/effect-default-workflow-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-workflow-helpers.js +247 -0
- package/dist/rules/effect-default-workflow-helpers.js.map +1 -0
- package/dist/rules/effect-default.d.ts +1 -1
- package/dist/rules/effect-default.d.ts.map +1 -1
- package/dist/rules/effect-default.js +198 -637
- package/dist/rules/effect-default.js.map +1 -1
- package/dist/rules/effect-exported-declarations.d.ts +19 -0
- package/dist/rules/effect-exported-declarations.d.ts.map +1 -0
- package/dist/rules/effect-exported-declarations.js +237 -0
- package/dist/rules/effect-exported-declarations.js.map +1 -0
- package/dist/rules/effect-path-options.d.ts +49 -11
- package/dist/rules/effect-path-options.d.ts.map +1 -1
- package/dist/rules/effect-path-options.js +85 -52
- package/dist/rules/effect-path-options.js.map +1 -1
- package/dist/rules/effect-rule-aliases.d.ts +55 -0
- package/dist/rules/effect-rule-aliases.d.ts.map +1 -0
- package/dist/rules/effect-rule-aliases.js +278 -0
- package/dist/rules/effect-rule-aliases.js.map +1 -0
- package/dist/rules/effect-rule-core.d.ts +46 -24
- package/dist/rules/effect-rule-core.d.ts.map +1 -1
- package/dist/rules/effect-rule-core.js +263 -303
- package/dist/rules/effect-rule-core.js.map +1 -1
- package/dist/rules/effect-rule-names.d.ts +12 -3
- package/dist/rules/effect-rule-names.d.ts.map +1 -1
- package/dist/rules/effect-rule-names.js +15 -3
- package/dist/rules/effect-rule-names.js.map +1 -1
- package/dist/rules/effect-source-comments.d.ts +7 -0
- package/dist/rules/effect-source-comments.d.ts.map +1 -0
- package/dist/rules/effect-source-comments.js +227 -0
- package/dist/rules/effect-source-comments.js.map +1 -0
- package/dist/rules/effect-source-helpers.d.ts +4 -9
- package/dist/rules/effect-source-helpers.d.ts.map +1 -1
- package/dist/rules/effect-source-helpers.js +7 -333
- package/dist/rules/effect-source-helpers.js.map +1 -1
- package/dist/rules/effect-source-navigation.d.ts +25 -0
- package/dist/rules/effect-source-navigation.d.ts.map +1 -0
- package/dist/rules/effect-source-navigation.js +244 -0
- package/dist/rules/effect-source-navigation.js.map +1 -0
- package/dist/rules/effect-source-scan.d.ts +30 -7
- package/dist/rules/effect-source-scan.d.ts.map +1 -1
- package/dist/rules/effect-source-scan.js +377 -297
- package/dist/rules/effect-source-scan.js.map +1 -1
- package/dist/rules/effect-strict-ast-specs.d.ts +8 -0
- package/dist/rules/effect-strict-ast-specs.d.ts.map +1 -0
- package/dist/rules/effect-strict-ast-specs.js +166 -0
- package/dist/rules/effect-strict-ast-specs.js.map +1 -0
- package/dist/rules/effect-strict-boundary-helpers.d.ts +25 -0
- package/dist/rules/effect-strict-boundary-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-boundary-helpers.js +127 -0
- package/dist/rules/effect-strict-boundary-helpers.js.map +1 -0
- package/dist/rules/effect-strict-core-specs.d.ts +8 -0
- package/dist/rules/effect-strict-core-specs.d.ts.map +1 -0
- package/dist/rules/effect-strict-core-specs.js +334 -0
- package/dist/rules/effect-strict-core-specs.js.map +1 -0
- package/dist/rules/effect-strict-external-helpers.d.ts +25 -0
- package/dist/rules/effect-strict-external-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-external-helpers.js +87 -0
- package/dist/rules/effect-strict-external-helpers.js.map +1 -0
- package/dist/rules/effect-strict-helpers.d.ts +75 -33
- package/dist/rules/effect-strict-helpers.d.ts.map +1 -1
- package/dist/rules/effect-strict-helpers.js +124 -246
- package/dist/rules/effect-strict-helpers.js.map +1 -1
- package/dist/rules/effect-strict-internals.d.ts +198 -0
- package/dist/rules/effect-strict-internals.d.ts.map +1 -0
- package/dist/rules/effect-strict-internals.js +477 -0
- package/dist/rules/effect-strict-internals.js.map +1 -0
- package/dist/rules/effect-strict-segment-helpers.d.ts +79 -0
- package/dist/rules/effect-strict-segment-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-segment-helpers.js +308 -0
- package/dist/rules/effect-strict-segment-helpers.js.map +1 -0
- package/dist/rules/effect-strict.d.ts +1 -1
- package/dist/rules/effect-strict.d.ts.map +1 -1
- package/dist/rules/effect-strict.js +10 -661
- package/dist/rules/effect-strict.js.map +1 -1
- package/dist/rules/max-import-depth.d.ts +2 -2
- package/dist/rules/max-import-depth.d.ts.map +1 -1
- package/dist/rules/max-import-depth.js +52 -17
- package/dist/rules/max-import-depth.js.map +1 -1
- package/dist/rules/max-line-length.d.ts +9 -2
- package/dist/rules/max-line-length.d.ts.map +1 -1
- package/dist/rules/max-line-length.js +62 -7
- package/dist/rules/max-line-length.js.map +1 -1
- package/dist/rules/no-commented-out-code.d.ts +3 -7
- package/dist/rules/no-commented-out-code.d.ts.map +1 -1
- package/dist/rules/no-commented-out-code.js +157 -102
- package/dist/rules/no-commented-out-code.js.map +1 -1
- package/dist/rules/pascal-case-types.d.ts +1 -1
- package/dist/rules/pascal-case-types.d.ts.map +1 -1
- package/dist/rules/pascal-case-types.js +65 -46
- package/dist/rules/pascal-case-types.js.map +1 -1
- package/dist/rules/plugin-commented-out-code-rule.d.ts +32 -0
- package/dist/rules/plugin-commented-out-code-rule.d.ts.map +1 -0
- package/dist/rules/plugin-commented-out-code-rule.js +135 -0
- package/dist/rules/plugin-commented-out-code-rule.js.map +1 -0
- package/dist/rules/plugin.d.ts +3 -121
- package/dist/rules/plugin.d.ts.map +1 -1
- package/dist/rules/plugin.js +195 -201
- package/dist/rules/plugin.js.map +1 -1
- package/dist/rules/private-underscore.d.ts +1 -1
- package/dist/rules/private-underscore.d.ts.map +1 -1
- package/dist/rules/private-underscore.js +11 -4
- package/dist/rules/private-underscore.js.map +1 -1
- package/dist/rules/require-file-doc.d.ts +5 -6
- package/dist/rules/require-file-doc.d.ts.map +1 -1
- package/dist/rules/require-file-doc.js +127 -78
- package/dist/rules/require-file-doc.js.map +1 -1
- package/dist/rules/require-function-doc-ignored-text.d.ts +7 -0
- package/dist/rules/require-function-doc-ignored-text.d.ts.map +1 -0
- package/dist/rules/require-function-doc-ignored-text.js +67 -0
- package/dist/rules/require-function-doc-ignored-text.js.map +1 -0
- package/dist/rules/require-function-doc-local-exports.d.ts +7 -0
- package/dist/rules/require-function-doc-local-exports.d.ts.map +1 -0
- package/dist/rules/require-function-doc-local-exports.js +114 -0
- package/dist/rules/require-function-doc-local-exports.js.map +1 -0
- package/dist/rules/require-function-doc.d.ts +3 -18
- package/dist/rules/require-function-doc.d.ts.map +1 -1
- package/dist/rules/require-function-doc.js +404 -218
- package/dist/rules/require-function-doc.js.map +1 -1
- package/dist/rules/source-cache.d.ts +19 -0
- package/dist/rules/source-cache.d.ts.map +1 -0
- package/dist/rules/source-cache.js +63 -0
- package/dist/rules/source-cache.js.map +1 -0
- 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
|