eslint-plugin-runtime-cleanup 1.2.8
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 +7 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/_internal/ast-node.d.ts +19 -0
- package/dist/_internal/ast-node.d.ts.map +1 -0
- package/dist/_internal/ast-node.js +42 -0
- package/dist/_internal/ast-node.js.map +1 -0
- package/dist/_internal/bounded-cache.d.ts +37 -0
- package/dist/_internal/bounded-cache.d.ts.map +1 -0
- package/dist/_internal/bounded-cache.js +63 -0
- package/dist/_internal/bounded-cache.js.map +1 -0
- package/dist/_internal/cycle-safe-linked-search.d.ts +48 -0
- package/dist/_internal/cycle-safe-linked-search.d.ts.map +1 -0
- package/dist/_internal/cycle-safe-linked-search.js +70 -0
- package/dist/_internal/cycle-safe-linked-search.js.map +1 -0
- package/dist/_internal/expression-boolean-memoizer.d.ts +17 -0
- package/dist/_internal/expression-boolean-memoizer.d.ts.map +1 -0
- package/dist/_internal/expression-boolean-memoizer.js +22 -0
- package/dist/_internal/expression-boolean-memoizer.js.map +1 -0
- package/dist/_internal/filter-callback.d.ts +52 -0
- package/dist/_internal/filter-callback.d.ts.map +1 -0
- package/dist/_internal/filter-callback.js +108 -0
- package/dist/_internal/filter-callback.js.map +1 -0
- package/dist/_internal/floating-resource.d.ts +29 -0
- package/dist/_internal/floating-resource.d.ts.map +1 -0
- package/dist/_internal/floating-resource.js +114 -0
- package/dist/_internal/floating-resource.js.map +1 -0
- package/dist/_internal/member-call.d.ts +53 -0
- package/dist/_internal/member-call.d.ts.map +1 -0
- package/dist/_internal/member-call.js +61 -0
- package/dist/_internal/member-call.js.map +1 -0
- package/dist/_internal/normalize-expression-text.d.ts +21 -0
- package/dist/_internal/normalize-expression-text.d.ts.map +1 -0
- package/dist/_internal/normalize-expression-text.js +186 -0
- package/dist/_internal/normalize-expression-text.js.map +1 -0
- package/dist/_internal/nullish-comparison.d.ts +44 -0
- package/dist/_internal/nullish-comparison.d.ts.map +1 -0
- package/dist/_internal/nullish-comparison.js +162 -0
- package/dist/_internal/nullish-comparison.js.map +1 -0
- package/dist/_internal/plugin-settings.d.ts +30 -0
- package/dist/_internal/plugin-settings.d.ts.map +1 -0
- package/dist/_internal/plugin-settings.js +90 -0
- package/dist/_internal/plugin-settings.js.map +1 -0
- package/dist/_internal/report-adapter.d.ts +24 -0
- package/dist/_internal/report-adapter.d.ts.map +1 -0
- package/dist/_internal/report-adapter.js +35 -0
- package/dist/_internal/report-adapter.js.map +1 -0
- package/dist/_internal/rule-catalog.d.ts +47 -0
- package/dist/_internal/rule-catalog.d.ts.map +1 -0
- package/dist/_internal/rule-catalog.js +97 -0
- package/dist/_internal/rule-catalog.js.map +1 -0
- package/dist/_internal/rule-docs-metadata.d.ts +35 -0
- package/dist/_internal/rule-docs-metadata.d.ts.map +1 -0
- package/dist/_internal/rule-docs-metadata.js +172 -0
- package/dist/_internal/rule-docs-metadata.js.map +1 -0
- package/dist/_internal/rule-docs-url.d.ts +15 -0
- package/dist/_internal/rule-docs-url.d.ts.map +1 -0
- package/dist/_internal/rule-docs-url.js +15 -0
- package/dist/_internal/rule-docs-url.js.map +1 -0
- package/dist/_internal/rules-registry.d.ts +11 -0
- package/dist/_internal/rules-registry.d.ts.map +1 -0
- package/dist/_internal/rules-registry.js +53 -0
- package/dist/_internal/rules-registry.js.map +1 -0
- package/dist/_internal/runtime-cleanup-config-references.d.ts +38 -0
- package/dist/_internal/runtime-cleanup-config-references.d.ts.map +1 -0
- package/dist/_internal/runtime-cleanup-config-references.js +78 -0
- package/dist/_internal/runtime-cleanup-config-references.js.map +1 -0
- package/dist/_internal/safe-type-operation.d.ts +89 -0
- package/dist/_internal/safe-type-operation.d.ts.map +1 -0
- package/dist/_internal/safe-type-operation.js +147 -0
- package/dist/_internal/safe-type-operation.js.map +1 -0
- package/dist/_internal/scope-variable.d.ts +17 -0
- package/dist/_internal/scope-variable.d.ts.map +1 -0
- package/dist/_internal/scope-variable.js +30 -0
- package/dist/_internal/scope-variable.js.map +1 -0
- package/dist/_internal/type-checker.d.ts +11 -0
- package/dist/_internal/type-checker.d.ts.map +1 -0
- package/dist/_internal/type-checker.js +25 -0
- package/dist/_internal/type-checker.js.map +1 -0
- package/dist/_internal/type-predicate-autofix-safety.d.ts +16 -0
- package/dist/_internal/type-predicate-autofix-safety.d.ts.map +1 -0
- package/dist/_internal/type-predicate-autofix-safety.js +54 -0
- package/dist/_internal/type-predicate-autofix-safety.js.map +1 -0
- package/dist/_internal/type-reference-node.d.ts +23 -0
- package/dist/_internal/type-reference-node.d.ts.map +1 -0
- package/dist/_internal/type-reference-node.js +41 -0
- package/dist/_internal/type-reference-node.js.map +1 -0
- package/dist/_internal/typed-rule.d.ts +91 -0
- package/dist/_internal/typed-rule.d.ts.map +1 -0
- package/dist/_internal/typed-rule.js +121 -0
- package/dist/_internal/typed-rule.js.map +1 -0
- package/dist/_internal/value-rewrite-autofix-safety.d.ts +29 -0
- package/dist/_internal/value-rewrite-autofix-safety.d.ts.map +1 -0
- package/dist/_internal/value-rewrite-autofix-safety.js +108 -0
- package/dist/_internal/value-rewrite-autofix-safety.js.map +1 -0
- package/dist/plugin.cjs +3693 -0
- package/dist/plugin.cjs.map +7 -0
- package/dist/plugin.d.cts +75 -0
- package/dist/plugin.d.ts +75 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +223 -0
- package/dist/plugin.js.map +1 -0
- package/dist/rules/no-floating-abort-controllers.d.ts +9 -0
- package/dist/rules/no-floating-abort-controllers.d.ts.map +1 -0
- package/dist/rules/no-floating-abort-controllers.js +144 -0
- package/dist/rules/no-floating-abort-controllers.js.map +1 -0
- package/dist/rules/no-floating-audio-contexts.d.ts +9 -0
- package/dist/rules/no-floating-audio-contexts.d.ts.map +1 -0
- package/dist/rules/no-floating-audio-contexts.js +95 -0
- package/dist/rules/no-floating-audio-contexts.js.map +1 -0
- package/dist/rules/no-floating-broadcast-channels.d.ts +9 -0
- package/dist/rules/no-floating-broadcast-channels.d.ts.map +1 -0
- package/dist/rules/no-floating-broadcast-channels.js +151 -0
- package/dist/rules/no-floating-broadcast-channels.js.map +1 -0
- package/dist/rules/no-floating-child-processes.d.ts +9 -0
- package/dist/rules/no-floating-child-processes.d.ts.map +1 -0
- package/dist/rules/no-floating-child-processes.js +259 -0
- package/dist/rules/no-floating-child-processes.js.map +1 -0
- package/dist/rules/no-floating-disposable-stacks.d.ts +9 -0
- package/dist/rules/no-floating-disposable-stacks.d.ts.map +1 -0
- package/dist/rules/no-floating-disposable-stacks.js +177 -0
- package/dist/rules/no-floating-disposable-stacks.js.map +1 -0
- package/dist/rules/no-floating-file-watchers.d.ts +9 -0
- package/dist/rules/no-floating-file-watchers.d.ts.map +1 -0
- package/dist/rules/no-floating-file-watchers.js +241 -0
- package/dist/rules/no-floating-file-watchers.js.map +1 -0
- package/dist/rules/no-floating-geolocation-watches.d.ts +9 -0
- package/dist/rules/no-floating-geolocation-watches.d.ts.map +1 -0
- package/dist/rules/no-floating-geolocation-watches.js +156 -0
- package/dist/rules/no-floating-geolocation-watches.js.map +1 -0
- package/dist/rules/no-floating-infinite-animations.d.ts +9 -0
- package/dist/rules/no-floating-infinite-animations.d.ts.map +1 -0
- package/dist/rules/no-floating-infinite-animations.js +131 -0
- package/dist/rules/no-floating-infinite-animations.js.map +1 -0
- package/dist/rules/no-floating-media-streams.d.ts +9 -0
- package/dist/rules/no-floating-media-streams.d.ts.map +1 -0
- package/dist/rules/no-floating-media-streams.js +175 -0
- package/dist/rules/no-floating-media-streams.js.map +1 -0
- package/dist/rules/no-floating-message-channels.d.ts +9 -0
- package/dist/rules/no-floating-message-channels.d.ts.map +1 -0
- package/dist/rules/no-floating-message-channels.js +150 -0
- package/dist/rules/no-floating-message-channels.js.map +1 -0
- package/dist/rules/no-floating-network-connections.d.ts +9 -0
- package/dist/rules/no-floating-network-connections.d.ts.map +1 -0
- package/dist/rules/no-floating-network-connections.js +170 -0
- package/dist/rules/no-floating-network-connections.js.map +1 -0
- package/dist/rules/no-floating-object-urls.d.ts +9 -0
- package/dist/rules/no-floating-object-urls.d.ts.map +1 -0
- package/dist/rules/no-floating-object-urls.js +83 -0
- package/dist/rules/no-floating-object-urls.js.map +1 -0
- package/dist/rules/no-floating-observers.d.ts +9 -0
- package/dist/rules/no-floating-observers.d.ts.map +1 -0
- package/dist/rules/no-floating-observers.js +160 -0
- package/dist/rules/no-floating-observers.js.map +1 -0
- package/dist/rules/no-floating-servers.d.ts +9 -0
- package/dist/rules/no-floating-servers.d.ts.map +1 -0
- package/dist/rules/no-floating-servers.js +282 -0
- package/dist/rules/no-floating-servers.js.map +1 -0
- package/dist/rules/no-floating-streams.d.ts +9 -0
- package/dist/rules/no-floating-streams.d.ts.map +1 -0
- package/dist/rules/no-floating-streams.js +222 -0
- package/dist/rules/no-floating-streams.js.map +1 -0
- package/dist/rules/no-floating-timers.d.ts +9 -0
- package/dist/rules/no-floating-timers.d.ts.map +1 -0
- package/dist/rules/no-floating-timers.js +145 -0
- package/dist/rules/no-floating-timers.js.map +1 -0
- package/dist/rules/no-floating-wake-locks.d.ts +9 -0
- package/dist/rules/no-floating-wake-locks.d.ts.map +1 -0
- package/dist/rules/no-floating-wake-locks.js +159 -0
- package/dist/rules/no-floating-wake-locks.js.map +1 -0
- package/dist/rules/no-floating-web-stream-locks.d.ts +9 -0
- package/dist/rules/no-floating-web-stream-locks.d.ts.map +1 -0
- package/dist/rules/no-floating-web-stream-locks.js +87 -0
- package/dist/rules/no-floating-web-stream-locks.js.map +1 -0
- package/dist/rules/no-floating-workers.d.ts +9 -0
- package/dist/rules/no-floating-workers.d.ts.map +1 -0
- package/dist/rules/no-floating-workers.js +185 -0
- package/dist/rules/no-floating-workers.js.map +1 -0
- package/dist/rules/no-unmanaged-event-listeners.d.ts +9 -0
- package/dist/rules/no-unmanaged-event-listeners.d.ts.map +1 -0
- package/dist/rules/no-unmanaged-event-listeners.js +210 -0
- package/dist/rules/no-unmanaged-event-listeners.js.map +1 -0
- package/docs/rules/getting-started.md +29 -0
- package/docs/rules/guides/adoption-checklist.md +31 -0
- package/docs/rules/guides/preset-selection-strategy.md +24 -0
- package/docs/rules/guides/rollout-and-fix-safety.md +42 -0
- package/docs/rules/guides/snapshot-testing.md +20 -0
- package/docs/rules/guides/type-aware-linting-readiness.md +20 -0
- package/docs/rules/no-floating-abort-controllers.md +126 -0
- package/docs/rules/no-floating-audio-contexts.md +104 -0
- package/docs/rules/no-floating-broadcast-channels.md +105 -0
- package/docs/rules/no-floating-child-processes.md +123 -0
- package/docs/rules/no-floating-disposable-stacks.md +118 -0
- package/docs/rules/no-floating-file-watchers.md +111 -0
- package/docs/rules/no-floating-geolocation-watches.md +95 -0
- package/docs/rules/no-floating-infinite-animations.md +110 -0
- package/docs/rules/no-floating-media-streams.md +113 -0
- package/docs/rules/no-floating-message-channels.md +114 -0
- package/docs/rules/no-floating-network-connections.md +116 -0
- package/docs/rules/no-floating-object-urls.md +102 -0
- package/docs/rules/no-floating-observers.md +108 -0
- package/docs/rules/no-floating-servers.md +127 -0
- package/docs/rules/no-floating-streams.md +120 -0
- package/docs/rules/no-floating-timers.md +120 -0
- package/docs/rules/no-floating-wake-locks.md +109 -0
- package/docs/rules/no-floating-web-stream-locks.md +105 -0
- package/docs/rules/no-floating-workers.md +123 -0
- package/docs/rules/no-unmanaged-event-listeners.md +143 -0
- package/docs/rules/overview.md +44 -0
- package/docs/rules/presets/all.md +35 -0
- package/docs/rules/presets/experimental.md +44 -0
- package/docs/rules/presets/index.md +54 -0
- package/docs/rules/presets/minimal.md +17 -0
- package/docs/rules/presets/recommended-type-checked.md +43 -0
- package/docs/rules/presets/recommended.md +34 -0
- package/docs/rules/presets/strict.md +36 -0
- package/package.json +323 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Structured error handling for best-effort typed AST operations.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Shared observer set for operation failures across rule modules.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Observers are intentionally process-local and opt-in; they exist for
|
|
10
|
+
* diagnostics and test instrumentation only.
|
|
11
|
+
*/
|
|
12
|
+
const safeTypeOperationFailureObservers = new Set();
|
|
13
|
+
/**
|
|
14
|
+
* Shared observer set for local/global observer failures.
|
|
15
|
+
*/
|
|
16
|
+
const safeTypeOperationObserverFailureObservers = new Set();
|
|
17
|
+
/**
|
|
18
|
+
* Notify all registered observer-failure observers.
|
|
19
|
+
*
|
|
20
|
+
* @param failure - Observer-failure payload.
|
|
21
|
+
*/
|
|
22
|
+
const notifySafeTypeOperationObserverFailureObservers = (failure) => {
|
|
23
|
+
for (const observer of safeTypeOperationObserverFailureObservers) {
|
|
24
|
+
try {
|
|
25
|
+
observer(failure);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Observer-failure observers are diagnostics only; never rethrow.
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Notify all registered global failure observers.
|
|
34
|
+
*
|
|
35
|
+
* @param failure - Failure payload emitted by a typed operation.
|
|
36
|
+
*/
|
|
37
|
+
const notifySafeTypeOperationFailureObservers = (failure) => {
|
|
38
|
+
for (const observer of safeTypeOperationFailureObservers) {
|
|
39
|
+
try {
|
|
40
|
+
observer(failure);
|
|
41
|
+
}
|
|
42
|
+
catch (observerError) {
|
|
43
|
+
notifySafeTypeOperationObserverFailureObservers({
|
|
44
|
+
failure,
|
|
45
|
+
observerError,
|
|
46
|
+
observerKind: "global",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Register a process-local observer for observer failures.
|
|
53
|
+
*
|
|
54
|
+
* @param observer - Callback invoked when a local/global failure observer
|
|
55
|
+
* throws.
|
|
56
|
+
*
|
|
57
|
+
* @returns Unsubscribe callback to remove the observer.
|
|
58
|
+
*/
|
|
59
|
+
export const registerSafeTypeOperationObserverFailureObserver = (observer) => {
|
|
60
|
+
safeTypeOperationObserverFailureObservers.add(observer);
|
|
61
|
+
return () => {
|
|
62
|
+
safeTypeOperationObserverFailureObservers.delete(observer);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Register a process-local failure observer for typed operations.
|
|
67
|
+
*
|
|
68
|
+
* @param observer - Callback invoked for each operation failure.
|
|
69
|
+
*
|
|
70
|
+
* @returns Unsubscribe callback to remove the observer.
|
|
71
|
+
*/
|
|
72
|
+
export const registerSafeTypeOperationFailureObserver = (observer) => {
|
|
73
|
+
safeTypeOperationFailureObservers.add(observer);
|
|
74
|
+
return () => {
|
|
75
|
+
safeTypeOperationFailureObservers.delete(observer);
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Run one operation with a scoped failure observer that is always cleaned up.
|
|
80
|
+
*
|
|
81
|
+
* @param observer - Observer registered for the operation scope.
|
|
82
|
+
* @param operation - Synchronous operation to execute while observing failures.
|
|
83
|
+
*
|
|
84
|
+
* @returns Return value produced by `operation`.
|
|
85
|
+
*/
|
|
86
|
+
export const withSafeTypeOperationFailureObserver = (observer, operation) => {
|
|
87
|
+
const unsubscribe = registerSafeTypeOperationFailureObserver(observer);
|
|
88
|
+
try {
|
|
89
|
+
return operation();
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
unsubscribe();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Execute a typed operation with structured failure output instead of throws.
|
|
97
|
+
*/
|
|
98
|
+
export const safeTypeOperation = ({ onFailure, operation, reason, }) => {
|
|
99
|
+
try {
|
|
100
|
+
return {
|
|
101
|
+
ok: true,
|
|
102
|
+
value: operation(),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const failure = {
|
|
107
|
+
error,
|
|
108
|
+
reason,
|
|
109
|
+
};
|
|
110
|
+
try {
|
|
111
|
+
onFailure?.(failure);
|
|
112
|
+
}
|
|
113
|
+
catch (observerError) {
|
|
114
|
+
notifySafeTypeOperationObserverFailureObservers({
|
|
115
|
+
failure,
|
|
116
|
+
observerError,
|
|
117
|
+
observerKind: "local",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
notifySafeTypeOperationFailureObservers(failure);
|
|
121
|
+
return {
|
|
122
|
+
failure,
|
|
123
|
+
ok: false,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Build a lightweight reason counter for debugging operation failures in tests.
|
|
129
|
+
*
|
|
130
|
+
* @param reasonsForTypeInference - Optional typed reason literals used to infer
|
|
131
|
+
* the `Reason` generic without requiring explicit type parameters.
|
|
132
|
+
*/
|
|
133
|
+
export const createSafeTypeOperationCounter = (reasonsForTypeInference = []) => {
|
|
134
|
+
const counts = new Map();
|
|
135
|
+
for (const reason of reasonsForTypeInference) {
|
|
136
|
+
counts.set(reason, counts.get(reason) ?? 0);
|
|
137
|
+
}
|
|
138
|
+
const onFailure = (failure) => {
|
|
139
|
+
const previousCount = counts.get(failure.reason) ?? 0;
|
|
140
|
+
counts.set(failure.reason, previousCount + 1);
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
getSnapshot: () => new Map(counts),
|
|
144
|
+
onFailure,
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=safe-type-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-type-operation.js","sourceRoot":"","sources":["../../src/_internal/safe-type-operation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH;;;;;;GAMG;AACH,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAE9C,CAAC;AAEJ;;GAEG;AACH,MAAM,yCAAyC,GAAG,IAAI,GAAG,EAEtD,CAAC;AAEJ;;;;G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,CAAC,MAAM,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,OAAO;QACH,WAAW,EAAE,GAAgC,EAAE,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC;QAC/D,SAAS;KACZ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Scope-chain helpers for reliable variable-resolution checks.
|
|
4
|
+
*/
|
|
5
|
+
import type { TSESLint } from "@typescript-eslint/utils";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a variable binding by walking the current scope and all parent
|
|
8
|
+
* scopes.
|
|
9
|
+
*
|
|
10
|
+
* @param scope - Initial scope to inspect.
|
|
11
|
+
* @param variableName - Identifier name to resolve.
|
|
12
|
+
*
|
|
13
|
+
* @returns Matched variable binding from the nearest scope chain; otherwise
|
|
14
|
+
* `null`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getVariableInScopeChain: (scope: Readonly<null | Readonly<TSESLint.Scope.Scope>>, variableName: string) => null | TSESLint.Scope.Variable;
|
|
17
|
+
//# sourceMappingURL=scope-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-variable.d.ts","sourceRoot":"","sources":["../../src/_internal/scope-variable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAChC,OAAO,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACtD,cAAc,MAAM,KACrB,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,QAwBxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveFirstValueInLinkedStructure } from "./cycle-safe-linked-search.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a variable binding by walking the current scope and all parent
|
|
4
|
+
* scopes.
|
|
5
|
+
*
|
|
6
|
+
* @param scope - Initial scope to inspect.
|
|
7
|
+
* @param variableName - Identifier name to resolve.
|
|
8
|
+
*
|
|
9
|
+
* @returns Matched variable binding from the nearest scope chain; otherwise
|
|
10
|
+
* `null`.
|
|
11
|
+
*/
|
|
12
|
+
export const getVariableInScopeChain = (scope, variableName) => {
|
|
13
|
+
const lookupResult = resolveFirstValueInLinkedStructure({
|
|
14
|
+
getNextNode: (currentScope) => currentScope.upper,
|
|
15
|
+
resolveValue: (currentScope) => {
|
|
16
|
+
const variable = currentScope.set.get(variableName);
|
|
17
|
+
return variable === undefined
|
|
18
|
+
? {
|
|
19
|
+
found: false,
|
|
20
|
+
}
|
|
21
|
+
: {
|
|
22
|
+
found: true,
|
|
23
|
+
value: variable,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
startNode: scope,
|
|
27
|
+
});
|
|
28
|
+
return lookupResult.found ? lookupResult.value : null;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=scope-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-variable.js","sourceRoot":"","sources":["../../src/_internal/scope-variable.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kCAAkC,EAAE,MAAM,+BAA+B,CAAC;AAEnF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,KAAsD,EACtD,YAAoB,EACU,EAAE;IAChC,MAAM,YAAY,GAAG,kCAAkC,CAGrD;QACE,WAAW,EAAE,CACT,YAA4C,EACP,EAAE,CAAC,YAAY,CAAC,KAAK;QAC9D,YAAY,EAAE,CAAC,YAA4C,EAAE,EAAE;YAC3D,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAEpD,OAAO,QAAQ,KAAK,SAAS;gBACzB,CAAC,CAAC;oBACI,KAAK,EAAE,KAAK;iBACf;gBACH,CAAC,CAAC;oBACI,KAAK,EAAE,IAAI;oBACX,KAAK,EAAE,QAAQ;iBAClB,CAAC;QACZ,CAAC;QACD,SAAS,EAAE,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Shared TypeScript checker helpers for low-noise type-aware rules.
|
|
4
|
+
*/
|
|
5
|
+
import type ts from "typescript";
|
|
6
|
+
/**
|
|
7
|
+
* Check whether a type or any type in its base hierarchy has a given symbol
|
|
8
|
+
* name.
|
|
9
|
+
*/
|
|
10
|
+
export declare const hasTypeNameInHierarchy: (checker: ts.TypeChecker, type: ts.Type, expectedTypeName: string, seenTypes?: ReadonlySet<ts.Type>) => boolean;
|
|
11
|
+
//# sourceMappingURL=type-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-checker.d.ts","sourceRoot":"","sources":["../../src/_internal/type-checker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAC/B,SAAS,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,CAAC,IAAI,EACb,kBAAkB,MAAM,EACxB,YAAW,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,KAC5C,OAwCF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether a type or any type in its base hierarchy has a given symbol
|
|
3
|
+
* name.
|
|
4
|
+
*/
|
|
5
|
+
export const hasTypeNameInHierarchy = (checker, type, expectedTypeName, seenTypes = new Set()) => {
|
|
6
|
+
if (seenTypes.has(type)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const nextSeenTypes = new Set(seenTypes);
|
|
10
|
+
nextSeenTypes.add(type);
|
|
11
|
+
if (type.isUnionOrIntersection()) {
|
|
12
|
+
return type.types.some((entry) => hasTypeNameInHierarchy(checker, entry, expectedTypeName, nextSeenTypes));
|
|
13
|
+
}
|
|
14
|
+
const apparentType = checker.getApparentType(type);
|
|
15
|
+
const typeName = apparentType.symbol.getName();
|
|
16
|
+
if (typeName === expectedTypeName) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (!apparentType.isClassOrInterface()) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const baseTypes = checker.getBaseTypes(apparentType);
|
|
23
|
+
return baseTypes.some((baseType) => hasTypeNameInHierarchy(checker, baseType, expectedTypeName, nextSeenTypes));
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=type-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-checker.js","sourceRoot":"","sources":["../../src/_internal/type-checker.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,OAAuB,EACvB,IAAa,EACb,gBAAwB,EACxB,YAAkC,IAAI,GAAG,EAAE,EACpC,EAAE;IACT,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACzC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAExB,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,sBAAsB,CAClB,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,aAAa,CAChB,CACJ,CAAC;IACN,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAE/C,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC/B,sBAAsB,CAClB,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,aAAa,CAChB,CACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
/**
|
|
3
|
+
* Determine whether a call-expression replacement to a type-predicate helper is
|
|
4
|
+
* safe to apply as an autofix.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Type-predicate helpers (for example `setHas`) can change control-flow
|
|
8
|
+
* narrowing in boolean guard expressions. This check intentionally disables
|
|
9
|
+
* autofix in those contexts and leaves a diagnostic for manual review.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isTypePredicateExpressionAutofixSafe: (node: Readonly<TSESTree.Expression>) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Backward-compatible alias for call-expression-based callers.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isTypePredicateAutofixSafe: (node: Readonly<TSESTree.CallExpression>) => boolean;
|
|
16
|
+
//# sourceMappingURL=type-predicate-autofix-safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-predicate-autofix-safety.d.ts","sourceRoot":"","sources":["../../src/_internal/type-predicate-autofix-safety.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA4DzD;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC7C,MAAM,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KACpC,OAiBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACnC,MAAM,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,KACxC,OAAqD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Conservative safety checks for autofixes that introduce type predicates.
|
|
4
|
+
*/
|
|
5
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
6
|
+
import { getParentNode } from "./ast-node.js";
|
|
7
|
+
import { isTransparentExpressionWrapper } from "./value-rewrite-autofix-safety.js";
|
|
8
|
+
const isLogicalExpressionOperand = (parentNode, currentNode) => parentNode.type === AST_NODE_TYPES.LogicalExpression &&
|
|
9
|
+
(parentNode.left === currentNode || parentNode.right === currentNode);
|
|
10
|
+
const isConditionalTest = (parentNode, currentNode) => parentNode.type === AST_NODE_TYPES.ConditionalExpression &&
|
|
11
|
+
parentNode.test === currentNode;
|
|
12
|
+
const isLoopOrIfTest = (parentNode, currentNode) => (parentNode.type === AST_NODE_TYPES.DoWhileStatement ||
|
|
13
|
+
parentNode.type === AST_NODE_TYPES.ForStatement ||
|
|
14
|
+
parentNode.type === AST_NODE_TYPES.IfStatement ||
|
|
15
|
+
parentNode.type === AST_NODE_TYPES.WhileStatement) &&
|
|
16
|
+
parentNode.test === currentNode;
|
|
17
|
+
const isSwitchCaseTest = (parentNode, currentNode) => parentNode.type === AST_NODE_TYPES.SwitchCase &&
|
|
18
|
+
parentNode.test === currentNode;
|
|
19
|
+
const isUnaryNotArgument = (parentNode, currentNode) => parentNode.type === AST_NODE_TYPES.UnaryExpression &&
|
|
20
|
+
parentNode.operator === "!" &&
|
|
21
|
+
parentNode.argument === currentNode;
|
|
22
|
+
const isBooleanGuardContext = (parentNode, currentNode) => isUnaryNotArgument(parentNode, currentNode) ||
|
|
23
|
+
isLogicalExpressionOperand(parentNode, currentNode) ||
|
|
24
|
+
isConditionalTest(parentNode, currentNode) ||
|
|
25
|
+
isLoopOrIfTest(parentNode, currentNode) ||
|
|
26
|
+
isSwitchCaseTest(parentNode, currentNode);
|
|
27
|
+
/**
|
|
28
|
+
* Determine whether a call-expression replacement to a type-predicate helper is
|
|
29
|
+
* safe to apply as an autofix.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Type-predicate helpers (for example `setHas`) can change control-flow
|
|
33
|
+
* narrowing in boolean guard expressions. This check intentionally disables
|
|
34
|
+
* autofix in those contexts and leaves a diagnostic for manual review.
|
|
35
|
+
*/
|
|
36
|
+
export const isTypePredicateExpressionAutofixSafe = (node) => {
|
|
37
|
+
let currentNode = node;
|
|
38
|
+
while (true) {
|
|
39
|
+
const parentNode = getParentNode(currentNode);
|
|
40
|
+
if (parentNode === undefined) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (isTransparentExpressionWrapper(parentNode, currentNode)) {
|
|
44
|
+
currentNode = parentNode;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
return !isBooleanGuardContext(parentNode, currentNode);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Backward-compatible alias for call-expression-based callers.
|
|
52
|
+
*/
|
|
53
|
+
export const isTypePredicateAutofixSafe = (node) => isTypePredicateExpressionAutofixSafe(node);
|
|
54
|
+
//# sourceMappingURL=type-predicate-autofix-safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-predicate-autofix-safety.js","sourceRoot":"","sources":["../../src/_internal/type-predicate-autofix-safety.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,EAAE,cAA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AE,CACT,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC;IAC3C,0BAA0B,CAAC,UAAU,EAAE,WAAW,CAAC;IACnD,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC;IAC1C,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC;IACvC,gBAAgB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAChD,IAAmC,EAC5B,EAAE;IACT,IAAI,WAAW,GAA4B,IAAI,CAAC;IAEhD,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;QAE9C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,8BAA8B,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC;YAC1D,WAAW,GAAG,UAAU,CAAC;YACzB,SAAS;QACb,CAAC;QAED,OAAO,CAAC,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,IAAuC,EAChC,EAAE,CAAC,oCAAoC,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether a type node is an identifier-based type reference with a
|
|
4
|
+
* specific symbol name.
|
|
5
|
+
*
|
|
6
|
+
* @param node - Type node candidate.
|
|
7
|
+
* @param identifierName - Expected referenced identifier name.
|
|
8
|
+
*
|
|
9
|
+
* @returns `true` when the node is `TSTypeReference` and the referenced
|
|
10
|
+
* `typeName` identifier matches exactly.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isIdentifierTypeReference: (node: Readonly<TSESTree.TypeNode>, identifierName: string) => node is TSESTree.TSTypeReference & {
|
|
13
|
+
typeName: TSESTree.Identifier;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Unwrap transparent parenthesized type nodes.
|
|
17
|
+
*
|
|
18
|
+
* @param node - Type node to normalize.
|
|
19
|
+
*
|
|
20
|
+
* @returns The innermost non-parenthesized type node.
|
|
21
|
+
*/
|
|
22
|
+
export declare const unwrapParenthesizedTypeNode: (node: Readonly<TSESTree.TypeNode>) => Readonly<TSESTree.TypeNode>;
|
|
23
|
+
//# sourceMappingURL=type-reference-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-reference-node.d.ts","sourceRoot":"","sources":["../../src/_internal/type-reference-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAezD;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GAClC,MAAM,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACjC,gBAAgB,MAAM,KACvB,IAAI,IAAI,QAAQ,CAAC,eAAe,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAA;CAG5B,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACpC,MAAM,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAClC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAa5B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Predicate helpers for narrowing `TSTypeReference` nodes by identifier name.
|
|
4
|
+
*/
|
|
5
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
6
|
+
const TS_PARENTHESIZED_TYPE = "TSParenthesizedType";
|
|
7
|
+
const isTypeNodeLike = (value) => typeof value === "object" &&
|
|
8
|
+
value !== null &&
|
|
9
|
+
typeof Reflect.get(value, "type") === "string";
|
|
10
|
+
/**
|
|
11
|
+
* Checks whether a type node is an identifier-based type reference with a
|
|
12
|
+
* specific symbol name.
|
|
13
|
+
*
|
|
14
|
+
* @param node - Type node candidate.
|
|
15
|
+
* @param identifierName - Expected referenced identifier name.
|
|
16
|
+
*
|
|
17
|
+
* @returns `true` when the node is `TSTypeReference` and the referenced
|
|
18
|
+
* `typeName` identifier matches exactly.
|
|
19
|
+
*/
|
|
20
|
+
export const isIdentifierTypeReference = (node, identifierName) => node.type === AST_NODE_TYPES.TSTypeReference &&
|
|
21
|
+
node.typeName.type === AST_NODE_TYPES.Identifier &&
|
|
22
|
+
node.typeName.name === identifierName;
|
|
23
|
+
/**
|
|
24
|
+
* Unwrap transparent parenthesized type nodes.
|
|
25
|
+
*
|
|
26
|
+
* @param node - Type node to normalize.
|
|
27
|
+
*
|
|
28
|
+
* @returns The innermost non-parenthesized type node.
|
|
29
|
+
*/
|
|
30
|
+
export const unwrapParenthesizedTypeNode = (node) => {
|
|
31
|
+
const nodeObject = node;
|
|
32
|
+
const nodeType = Reflect.get(nodeObject, "type");
|
|
33
|
+
if (nodeType !== TS_PARENTHESIZED_TYPE) {
|
|
34
|
+
return node;
|
|
35
|
+
}
|
|
36
|
+
const typeAnnotation = Reflect.get(nodeObject, "typeAnnotation");
|
|
37
|
+
return isTypeNodeLike(typeAnnotation)
|
|
38
|
+
? unwrapParenthesizedTypeNode(typeAnnotation)
|
|
39
|
+
: node;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=type-reference-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-reference-node.js","sourceRoot":"","sources":["../../src/_internal/type-reference-node.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,CAAC,KAAc,EAAwC,EAAE,CAC5E,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,QAAQ,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACrC,IAAiC,EACjC,cAAsB,EAC8C,EAAE,CACtE,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe;IAC5C,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;IAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACvC,IAAiC,EACN,EAAE;IAC7B,MAAM,UAAU,GAAW,IAAI,CAAC;IAChC,MAAM,QAAQ,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE1D,IAAI,QAAQ,KAAK,qBAAqB,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,cAAc,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAE1E,OAAO,cAAc,CAAC,cAAc,CAAC;QACjC,CAAC,CAAC,2BAA2B,CAAC,cAAc,CAAC;QAC7C,CAAC,CAAC,IAAI,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Internal shared utilities used by eslint-plugin-runtime-cleanup rule modules
|
|
4
|
+
* and plugin wiring.
|
|
5
|
+
*/
|
|
6
|
+
import type ts from "typescript";
|
|
7
|
+
import { ESLintUtils, type TSESLint } from "@typescript-eslint/utils";
|
|
8
|
+
import type { RuntimeCleanupConfigReference } from "./runtime-cleanup-config-references.js";
|
|
9
|
+
/**
|
|
10
|
+
* Parser services and type checker bundle used by typed rules.
|
|
11
|
+
*/
|
|
12
|
+
export interface TypedRuleServices {
|
|
13
|
+
checker: ts.TypeChecker;
|
|
14
|
+
parserServices: ReturnType<typeof ESLintUtils.getParserServices>;
|
|
15
|
+
}
|
|
16
|
+
type RuntimeCleanupRuleCreator = ReturnType<typeof ESLintUtils.RuleCreator<RuntimeCleanupRuleDocs>>;
|
|
17
|
+
/**
|
|
18
|
+
* Plugin-specific metadata extensions for `meta.docs`.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* `eslint-plugin/require-meta-docs-recommended` expects
|
|
22
|
+
* `meta.docs.recommended` to be boolean. Preset membership is tracked
|
|
23
|
+
* separately via `meta.docs.runtimeCleanupConfigs`.
|
|
24
|
+
*/
|
|
25
|
+
interface RuntimeCleanupRuleDocs {
|
|
26
|
+
recommended?: boolean;
|
|
27
|
+
requiresTypeChecking?: boolean;
|
|
28
|
+
ruleId?: string;
|
|
29
|
+
ruleNumber?: number;
|
|
30
|
+
runtimeCleanupConfigs?: readonly RuntimeCleanupConfigReference[] | RuntimeCleanupConfigReference;
|
|
31
|
+
}
|
|
32
|
+
/** Shared typed-rule context contract used by helper utilities. */
|
|
33
|
+
type TypedRuleContext = Readonly<TSESLint.RuleContext<string, readonly unknown[]>>;
|
|
34
|
+
export type { TypedRuleContext };
|
|
35
|
+
/**
|
|
36
|
+
* Rule-creator wrapper used by plugin rules.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This wrapper automatically registers per-program plugin settings and injects
|
|
40
|
+
* canonical `meta.docs.ruleId` / `meta.docs.ruleNumber` values for cataloged
|
|
41
|
+
* public rules.
|
|
42
|
+
*
|
|
43
|
+
* @param ruleDefinition - Rule module definition passed to
|
|
44
|
+
* `ESLintUtils.RuleCreator`.
|
|
45
|
+
*
|
|
46
|
+
* @returns Rule module factory output that auto-registers program settings and
|
|
47
|
+
* preserves the authored rule contract.
|
|
48
|
+
*/
|
|
49
|
+
export declare const createTypedRule: RuntimeCleanupRuleCreator;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieve parser services and type checker for typed rules.
|
|
52
|
+
*
|
|
53
|
+
* @param context - Rule context from the current lint evaluation.
|
|
54
|
+
*
|
|
55
|
+
* @returns Parser services and type checker references bound to the current
|
|
56
|
+
* program.
|
|
57
|
+
*
|
|
58
|
+
* @throws Throws when `parserServices.program` is unavailable, which indicates
|
|
59
|
+
* the current lint run is not configured for type-aware analysis.
|
|
60
|
+
*/
|
|
61
|
+
export declare const getTypedRuleServices: (context: TypedRuleContext) => TypedRuleServices;
|
|
62
|
+
/**
|
|
63
|
+
* Determine whether the current lint context has full type information.
|
|
64
|
+
*
|
|
65
|
+
* @param context - Rule context from the current lint evaluation.
|
|
66
|
+
*
|
|
67
|
+
* @returns `true` when parser services and `program` are available.
|
|
68
|
+
*/
|
|
69
|
+
export declare const hasTypeServices: (context: TypedRuleContext) => boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieve typed services when available, otherwise return `undefined`.
|
|
72
|
+
*
|
|
73
|
+
* @param context - Rule context from the current lint evaluation.
|
|
74
|
+
*
|
|
75
|
+
* @returns Typed services when parser services include a TypeScript program.
|
|
76
|
+
*/
|
|
77
|
+
export declare const getTypedRuleServicesOrUndefined: (context: TypedRuleContext) => TypedRuleServices | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Resolve the type of a signature parameter by index.
|
|
80
|
+
*
|
|
81
|
+
* @param options - Signature parameter lookup options.
|
|
82
|
+
*
|
|
83
|
+
* @returns Parameter type when available; otherwise `undefined`.
|
|
84
|
+
*/
|
|
85
|
+
export declare const getSignatureParameterTypeAt: (options: Readonly<{
|
|
86
|
+
checker: ts.TypeChecker;
|
|
87
|
+
index: number;
|
|
88
|
+
location: ts.Node;
|
|
89
|
+
signature: null | ts.Signature | undefined;
|
|
90
|
+
}>) => ts.Type | undefined;
|
|
91
|
+
//# sourceMappingURL=typed-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-rule.d.ts","sourceRoot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GAAG,SACiD,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACpC,SAAS,QAAQ,CAAC;IACd,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC;IAClB,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;CAC9C,CAAC,KACH,EAAE,CAAC,IAAI,GAAG,SASZ,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
import { registerProgramSettingsForContext } from "./plugin-settings.js";
|
|
3
|
+
import { getRuleCatalogEntryForRuleNameOrNull } from "./rule-catalog.js";
|
|
4
|
+
import { createRuleDocsUrl } from "./rule-docs-url.js";
|
|
5
|
+
import { safeTypeOperation } from "./safe-type-operation.js";
|
|
6
|
+
/**
|
|
7
|
+
* Rule-creator wrapper used by plugin rules.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This wrapper automatically registers per-program plugin settings and injects
|
|
11
|
+
* canonical `meta.docs.ruleId` / `meta.docs.ruleNumber` values for cataloged
|
|
12
|
+
* public rules.
|
|
13
|
+
*
|
|
14
|
+
* @param ruleDefinition - Rule module definition passed to
|
|
15
|
+
* `ESLintUtils.RuleCreator`.
|
|
16
|
+
*
|
|
17
|
+
* @returns Rule module factory output that auto-registers program settings and
|
|
18
|
+
* preserves the authored rule contract.
|
|
19
|
+
*/
|
|
20
|
+
export const createTypedRule = (ruleDefinition) => {
|
|
21
|
+
const catalogEntry = getRuleCatalogEntryForRuleNameOrNull(ruleDefinition.name);
|
|
22
|
+
const createdRule = ESLintUtils.RuleCreator.withoutDocs(ruleDefinition);
|
|
23
|
+
const ruleDocs = createdRule.meta.docs;
|
|
24
|
+
if (ruleDocs === undefined) {
|
|
25
|
+
throw new TypeError(`Rule '${ruleDefinition.name}' must declare meta.docs.`);
|
|
26
|
+
}
|
|
27
|
+
const canonicalDocsUrl = createRuleDocsUrl(ruleDefinition.name);
|
|
28
|
+
if (typeof ruleDocs.url === "string" && ruleDocs.url !== canonicalDocsUrl) {
|
|
29
|
+
throw new TypeError(`Rule '${ruleDefinition.name}' has non-canonical docs.url '${ruleDocs.url}'. Expected '${canonicalDocsUrl}'.`);
|
|
30
|
+
}
|
|
31
|
+
if (catalogEntry === null && ruleDefinition.name.startsWith("require-")) {
|
|
32
|
+
throw new TypeError(`Rule '${ruleDefinition.name}' is missing from the stable rule catalog.`);
|
|
33
|
+
}
|
|
34
|
+
const docsWithCatalog = catalogEntry === null
|
|
35
|
+
? {
|
|
36
|
+
...ruleDocs,
|
|
37
|
+
url: canonicalDocsUrl,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
...ruleDocs,
|
|
41
|
+
ruleId: catalogEntry.ruleId,
|
|
42
|
+
ruleNumber: catalogEntry.ruleNumber,
|
|
43
|
+
url: canonicalDocsUrl,
|
|
44
|
+
};
|
|
45
|
+
const metaDefaultOptions = createdRule.meta.defaultOptions;
|
|
46
|
+
return {
|
|
47
|
+
...createdRule,
|
|
48
|
+
create(context) {
|
|
49
|
+
registerProgramSettingsForContext(context);
|
|
50
|
+
return createdRule.create(context);
|
|
51
|
+
},
|
|
52
|
+
meta: {
|
|
53
|
+
...createdRule.meta,
|
|
54
|
+
...(metaDefaultOptions === undefined
|
|
55
|
+
? {}
|
|
56
|
+
: { defaultOptions: metaDefaultOptions }),
|
|
57
|
+
docs: docsWithCatalog,
|
|
58
|
+
},
|
|
59
|
+
name: ruleDefinition.name,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Retrieve parser services and type checker for typed rules.
|
|
64
|
+
*
|
|
65
|
+
* @param context - Rule context from the current lint evaluation.
|
|
66
|
+
*
|
|
67
|
+
* @returns Parser services and type checker references bound to the current
|
|
68
|
+
* program.
|
|
69
|
+
*
|
|
70
|
+
* @throws Throws when `parserServices.program` is unavailable, which indicates
|
|
71
|
+
* the current lint run is not configured for type-aware analysis.
|
|
72
|
+
*/
|
|
73
|
+
export const getTypedRuleServices = (context) => {
|
|
74
|
+
const parserServices = ESLintUtils.getParserServices(context, true);
|
|
75
|
+
const program = parserServices.program;
|
|
76
|
+
if (program === null) {
|
|
77
|
+
throw new Error("Typed rule requires parserServices.program; ensure projectService is enabled for this lint run.");
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
checker: program.getTypeChecker(),
|
|
81
|
+
parserServices,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Determine whether the current lint context has full type information.
|
|
86
|
+
*
|
|
87
|
+
* @param context - Rule context from the current lint evaluation.
|
|
88
|
+
*
|
|
89
|
+
* @returns `true` when parser services and `program` are available.
|
|
90
|
+
*/
|
|
91
|
+
export const hasTypeServices = (context) => {
|
|
92
|
+
const parserServicesResult = safeTypeOperation({
|
|
93
|
+
operation: () => ESLintUtils.getParserServices(context, true),
|
|
94
|
+
reason: "typed-rule-services-check-failed",
|
|
95
|
+
});
|
|
96
|
+
return (parserServicesResult.ok && parserServicesResult.value.program !== null);
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Retrieve typed services when available, otherwise return `undefined`.
|
|
100
|
+
*
|
|
101
|
+
* @param context - Rule context from the current lint evaluation.
|
|
102
|
+
*
|
|
103
|
+
* @returns Typed services when parser services include a TypeScript program.
|
|
104
|
+
*/
|
|
105
|
+
export const getTypedRuleServicesOrUndefined = (context) => hasTypeServices(context) ? getTypedRuleServices(context) : undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the type of a signature parameter by index.
|
|
108
|
+
*
|
|
109
|
+
* @param options - Signature parameter lookup options.
|
|
110
|
+
*
|
|
111
|
+
* @returns Parameter type when available; otherwise `undefined`.
|
|
112
|
+
*/
|
|
113
|
+
export const getSignatureParameterTypeAt = (options) => {
|
|
114
|
+
const { checker, index, location, signature } = options;
|
|
115
|
+
const symbol = signature?.parameters[index];
|
|
116
|
+
if (symbol === undefined) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
return checker.getTypeOfSymbolAtLocation(symbol, location);
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=typed-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-rule.js","sourceRoot":"","sources":["../../src/_internal/typed-rule.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAItE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAuC7D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAA8B,CAAC,cAAc,EAAE,EAAE;IACzE,MAAM,YAAY,GAAG,oCAAoC,CACrD,cAAc,CAAC,IAAI,CACtB,CAAC;IACF,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;IACvC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,SAAS,CACf,SAAS,cAAc,CAAC,IAAI,2BAA2B,CAC1D,CAAC;IACN,CAAC;IAED,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAEhE,IAAI,OAAO,QAAQ,CAAC,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,KAAK,gBAAgB,EAAE,CAAC;QACxE,MAAM,IAAI,SAAS,CACf,SAAS,cAAc,CAAC,IAAI,iCAAi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