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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Require observer instances to be retained so they can be disconnected.
|
|
4
|
+
*/
|
|
5
|
+
import { type TSESLint } from "@typescript-eslint/utils";
|
|
6
|
+
/** Rule implementation for `runtime-cleanup/no-floating-observers`. */
|
|
7
|
+
declare const noFloatingObservers: TSESLint.RuleModule<"floatingObserver", readonly []>;
|
|
8
|
+
export default noFloatingObservers;
|
|
9
|
+
//# sourceMappingURL=no-floating-observers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-floating-observers.d.ts","sourceRoot":"","sources":["../../src/rules/no-floating-observers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEH,KAAK,QAAQ,EAEhB,MAAM,0BAA0B,CAAC;AA8LlC,uEAAuE;AACvE,QAAA,MAAM,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAC1C,kBAAkB,EAClB,SAAS,EAAE,CAiDb,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Require observer instances to be retained so they can be disconnected.
|
|
4
|
+
*/
|
|
5
|
+
import { AST_NODE_TYPES, } from "@typescript-eslint/utils";
|
|
6
|
+
import { getParentNode } from "../_internal/ast-node.js";
|
|
7
|
+
import { createRuleDocsUrl } from "../_internal/rule-docs-url.js";
|
|
8
|
+
import { getVariableInScopeChain } from "../_internal/scope-variable.js";
|
|
9
|
+
import { createTypedRule, } from "../_internal/typed-rule.js";
|
|
10
|
+
const observerConstructorNames = [
|
|
11
|
+
"IntersectionObserver",
|
|
12
|
+
"MutationObserver",
|
|
13
|
+
"PerformanceObserver",
|
|
14
|
+
"ReportingObserver",
|
|
15
|
+
"ResizeObserver",
|
|
16
|
+
];
|
|
17
|
+
const globalReceiverNames = [
|
|
18
|
+
"globalThis",
|
|
19
|
+
"self",
|
|
20
|
+
"window",
|
|
21
|
+
];
|
|
22
|
+
const globalReceiverNameSet = new Set(globalReceiverNames);
|
|
23
|
+
const observerConstructorNameSet = new Set(observerConstructorNames);
|
|
24
|
+
const isGlobalReceiverName = (name) => globalReceiverNameSet.has(name);
|
|
25
|
+
const isObserverConstructorName = (name) => observerConstructorNameSet.has(name);
|
|
26
|
+
const getTransparentWrappedExpression = (node) => {
|
|
27
|
+
if (node.type === AST_NODE_TYPES.ChainExpression) {
|
|
28
|
+
return node.expression;
|
|
29
|
+
}
|
|
30
|
+
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
31
|
+
return node.expression;
|
|
32
|
+
}
|
|
33
|
+
if (node.type === AST_NODE_TYPES.TSNonNullExpression) {
|
|
34
|
+
return node.expression;
|
|
35
|
+
}
|
|
36
|
+
if (node.type === AST_NODE_TYPES.TSSatisfiesExpression) {
|
|
37
|
+
return node.expression;
|
|
38
|
+
}
|
|
39
|
+
if (node.type === AST_NODE_TYPES.TSTypeAssertion) {
|
|
40
|
+
return node.expression;
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
};
|
|
44
|
+
const isShadowedIdentifier = (context, identifier) => {
|
|
45
|
+
const scope = context.sourceCode.getScope(identifier);
|
|
46
|
+
const variable = getVariableInScopeChain(scope, identifier.name);
|
|
47
|
+
return variable !== null && variable.defs.length > 0;
|
|
48
|
+
};
|
|
49
|
+
const getDirectObserverConstructorName = (context, callee) => {
|
|
50
|
+
if (callee.type !== AST_NODE_TYPES.Identifier ||
|
|
51
|
+
!isObserverConstructorName(callee.name) ||
|
|
52
|
+
isShadowedIdentifier(context, callee)) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return callee.name;
|
|
56
|
+
};
|
|
57
|
+
const getMemberObserverConstructorName = (callee) => {
|
|
58
|
+
if (callee.type !== AST_NODE_TYPES.MemberExpression ||
|
|
59
|
+
callee.computed ||
|
|
60
|
+
callee.optional ||
|
|
61
|
+
callee.object.type !== AST_NODE_TYPES.Identifier ||
|
|
62
|
+
callee.property.type !== AST_NODE_TYPES.Identifier ||
|
|
63
|
+
!isGlobalReceiverName(callee.object.name) ||
|
|
64
|
+
!isObserverConstructorName(callee.property.name)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return callee.property.name;
|
|
68
|
+
};
|
|
69
|
+
const getObserverConstructorName = (context, callee) => getDirectObserverConstructorName(context, callee) ??
|
|
70
|
+
getMemberObserverConstructorName(callee);
|
|
71
|
+
const isObserveMethodCallReceiver = (node) => {
|
|
72
|
+
let current = node;
|
|
73
|
+
let parent = getParentNode(current);
|
|
74
|
+
while (parent !== undefined) {
|
|
75
|
+
const wrappedExpression = getTransparentWrappedExpression(parent);
|
|
76
|
+
if (wrappedExpression === current) {
|
|
77
|
+
current = parent;
|
|
78
|
+
parent = getParentNode(current);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (parent.type !== AST_NODE_TYPES.MemberExpression ||
|
|
82
|
+
parent.object !== current ||
|
|
83
|
+
parent.computed ||
|
|
84
|
+
parent.property.type !== AST_NODE_TYPES.Identifier ||
|
|
85
|
+
parent.property.name !== "observe") {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const callExpression = getParentNode(parent);
|
|
89
|
+
return (callExpression?.type === AST_NODE_TYPES.CallExpression &&
|
|
90
|
+
callExpression.callee === parent);
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
const isDiscardedObserverInstance = (node) => {
|
|
95
|
+
let current = node;
|
|
96
|
+
let parent = getParentNode(current);
|
|
97
|
+
while (parent !== undefined) {
|
|
98
|
+
const wrappedExpression = getTransparentWrappedExpression(parent);
|
|
99
|
+
if (wrappedExpression === current) {
|
|
100
|
+
current = parent;
|
|
101
|
+
parent = getParentNode(current);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (parent.type === AST_NODE_TYPES.ExpressionStatement &&
|
|
105
|
+
parent.expression === current) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (parent.type === AST_NODE_TYPES.UnaryExpression &&
|
|
109
|
+
parent.operator === "void" &&
|
|
110
|
+
parent.argument === current) {
|
|
111
|
+
const unaryParent = getParentNode(parent);
|
|
112
|
+
return unaryParent?.type === AST_NODE_TYPES.ExpressionStatement;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
/** Rule implementation for `runtime-cleanup/no-floating-observers`. */
|
|
119
|
+
const noFloatingObservers = createTypedRule({
|
|
120
|
+
create(context) {
|
|
121
|
+
return {
|
|
122
|
+
NewExpression(node) {
|
|
123
|
+
const observerName = getObserverConstructorName(context, node.callee);
|
|
124
|
+
if (observerName === undefined ||
|
|
125
|
+
(!isDiscardedObserverInstance(node) &&
|
|
126
|
+
!isObserveMethodCallReceiver(node))) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
context.report({
|
|
130
|
+
data: { observerName },
|
|
131
|
+
messageId: "floatingObserver",
|
|
132
|
+
node,
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
defaultOptions: [],
|
|
138
|
+
meta: {
|
|
139
|
+
docs: {
|
|
140
|
+
description: "require observer instances to be retained so they can be disconnected during cleanup.",
|
|
141
|
+
recommended: true,
|
|
142
|
+
requiresTypeChecking: false,
|
|
143
|
+
runtimeCleanupConfigs: [
|
|
144
|
+
"runtime-cleanup.configs.recommended",
|
|
145
|
+
"runtime-cleanup.configs.recommended-type-checked",
|
|
146
|
+
"runtime-cleanup.configs.strict",
|
|
147
|
+
"runtime-cleanup.configs.all",
|
|
148
|
+
],
|
|
149
|
+
url: createRuleDocsUrl("no-floating-observers"),
|
|
150
|
+
},
|
|
151
|
+
messages: {
|
|
152
|
+
floatingObserver: "Store or return the {{observerName}} instance so it can be disconnected during cleanup.",
|
|
153
|
+
},
|
|
154
|
+
schema: [],
|
|
155
|
+
type: "problem",
|
|
156
|
+
},
|
|
157
|
+
name: "no-floating-observers",
|
|
158
|
+
});
|
|
159
|
+
export default noFloatingObservers;
|
|
160
|
+
//# sourceMappingURL=no-floating-observers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-floating-observers.js","sourceRoot":"","sources":["../../src/rules/no-floating-observers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACH,cAAc,GAGjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EACH,eAAe,GAElB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,wBAAwB,GAAG;IAC7B,sBAAsB;IACtB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,gBAAgB;CACV,CAAC;AAEX,MAAM,mBAAmB,GAAG;IACxB,YAAY;IACZ,MAAM;IACN,QAAQ;CACF,CAAC;AAIX,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CACtD,mBAAmB,CACtB,CAAC;AACF,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAC3D,wBAAwB,CAC3B,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE,CACnD,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAEpC,MAAM,yBAAyB,GAAG,CAC9B,IAAY,EACmB,EAAE,CAAC,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAE3E,MAAM,+BAA+B,GAAG,CACpC,IAA6B,EACM,EAAE;IACrC,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAA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CAAC,2BAA2B,CAAC,IAAI,CAAC;wBAC/B,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,EACzC,CAAC;oBACC,OAAO;gBACX,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI,EAAE,EAAE,YAAY,EAAE;oBACtB,SAAS,EAAE,kBAAkB;oBAC7B,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EACP,uFAAuF;YAC3F,WAAW,EAAE,IAAI;YACjB,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE;gBACnB,qCAAqC;gBACrC,kDAAkD;gBAClD,gCAAgC;gBAChC,6BAA6B;aAChC;YACD,GAAG,EAAE,iBAAiB,CAAC,uBAAuB,CAAC;SAClD;QACD,QAAQ,EAAE;YACN,gBAAgB,EACZ,yFAAyF;SAChG;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,uBAAuB;CAChC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Require Node.js server handles to be retained so they can be closed.
|
|
4
|
+
*/
|
|
5
|
+
import { type TSESLint } from "@typescript-eslint/utils";
|
|
6
|
+
/** Rule implementation for `runtime-cleanup/no-floating-servers`. */
|
|
7
|
+
declare const noFloatingServers: TSESLint.RuleModule<"floatingServer", readonly []>;
|
|
8
|
+
export default noFloatingServers;
|
|
9
|
+
//# sourceMappingURL=no-floating-servers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-floating-servers.d.ts","sourceRoot":"","sources":["../../src/rules/no-floating-servers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEH,KAAK,QAAQ,EAEhB,MAAM,0BAA0B,CAAC;AA0YlC,qEAAqE;AACrE,QAAA,MAAM,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CACxC,gBAAgB,EAChB,SAAS,EAAE,CA6Cb,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Require Node.js server handles to be retained so they can be closed.
|
|
4
|
+
*/
|
|
5
|
+
import { AST_NODE_TYPES, } from "@typescript-eslint/utils";
|
|
6
|
+
import { getParentNode } from "../_internal/ast-node.js";
|
|
7
|
+
import { createRuleDocsUrl } from "../_internal/rule-docs-url.js";
|
|
8
|
+
import { getVariableInScopeChain } from "../_internal/scope-variable.js";
|
|
9
|
+
import { createTypedRule, } from "../_internal/typed-rule.js";
|
|
10
|
+
const serverFactoryNames = [
|
|
11
|
+
"createSecureServer",
|
|
12
|
+
"createServer",
|
|
13
|
+
];
|
|
14
|
+
const http2OnlyServerFactoryNames = ["createSecureServer"];
|
|
15
|
+
const serverModuleNames = [
|
|
16
|
+
"http",
|
|
17
|
+
"http2",
|
|
18
|
+
"https",
|
|
19
|
+
"net",
|
|
20
|
+
"node:http",
|
|
21
|
+
"node:http2",
|
|
22
|
+
"node:https",
|
|
23
|
+
"node:net",
|
|
24
|
+
];
|
|
25
|
+
const http2ServerModuleNames = ["http2", "node:http2"];
|
|
26
|
+
const immediateCleanupMethodNames = ["close"];
|
|
27
|
+
const serverFactoryNameSet = new Set(serverFactoryNames);
|
|
28
|
+
const http2OnlyServerFactoryNameSet = new Set(http2OnlyServerFactoryNames);
|
|
29
|
+
const serverModuleNameSet = new Set(serverModuleNames);
|
|
30
|
+
const http2ServerModuleNameSet = new Set(http2ServerModuleNames);
|
|
31
|
+
const immediateCleanupMethodNameSet = new Set(immediateCleanupMethodNames);
|
|
32
|
+
const isServerFactoryName = (name) => serverFactoryNameSet.has(name);
|
|
33
|
+
const isHttp2OnlyServerFactoryName = (name) => http2OnlyServerFactoryNameSet.has(name);
|
|
34
|
+
const isServerModuleSource = (source) => source !== undefined && serverModuleNameSet.has(source);
|
|
35
|
+
const isHttp2ServerModuleSource = (source) => source !== undefined && http2ServerModuleNameSet.has(source);
|
|
36
|
+
const isImmediateCleanupMethodName = (name) => immediateCleanupMethodNameSet.has(name);
|
|
37
|
+
const isValidServerFactoryForSource = (source, factoryName) => isServerModuleSource(source) &&
|
|
38
|
+
isServerFactoryName(factoryName) &&
|
|
39
|
+
(!isHttp2OnlyServerFactoryName(factoryName) ||
|
|
40
|
+
isHttp2ServerModuleSource(source));
|
|
41
|
+
const getTransparentWrappedExpression = (node) => {
|
|
42
|
+
if (node.type === AST_NODE_TYPES.ChainExpression) {
|
|
43
|
+
return node.expression;
|
|
44
|
+
}
|
|
45
|
+
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
46
|
+
return node.expression;
|
|
47
|
+
}
|
|
48
|
+
if (node.type === AST_NODE_TYPES.TSNonNullExpression) {
|
|
49
|
+
return node.expression;
|
|
50
|
+
}
|
|
51
|
+
if (node.type === AST_NODE_TYPES.TSSatisfiesExpression) {
|
|
52
|
+
return node.expression;
|
|
53
|
+
}
|
|
54
|
+
if (node.type === AST_NODE_TYPES.TSTypeAssertion) {
|
|
55
|
+
return node.expression;
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
};
|
|
59
|
+
const getStaticPropertyName = (node) => {
|
|
60
|
+
if (node.type === AST_NODE_TYPES.Identifier) {
|
|
61
|
+
return node.name;
|
|
62
|
+
}
|
|
63
|
+
if (node.type === AST_NODE_TYPES.Literal &&
|
|
64
|
+
typeof node.value === "string") {
|
|
65
|
+
return node.value;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
const getImportSourceValue = (node) => {
|
|
70
|
+
const parent = getParentNode(node);
|
|
71
|
+
if (parent?.type === AST_NODE_TYPES.ImportDeclaration &&
|
|
72
|
+
typeof parent.source.value === "string") {
|
|
73
|
+
return parent.source.value;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
const getRequireSourceValue = (expression) => {
|
|
78
|
+
if (expression?.type !== AST_NODE_TYPES.CallExpression ||
|
|
79
|
+
expression.callee.type !== AST_NODE_TYPES.Identifier ||
|
|
80
|
+
expression.callee.name !== "require") {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const [source] = expression.arguments;
|
|
84
|
+
return source?.type === AST_NODE_TYPES.Literal &&
|
|
85
|
+
typeof source.value === "string"
|
|
86
|
+
? source.value
|
|
87
|
+
: undefined;
|
|
88
|
+
};
|
|
89
|
+
const getDefinitionModuleSource = (node) => {
|
|
90
|
+
if (node.type === AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
91
|
+
node.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||
|
|
92
|
+
node.type === AST_NODE_TYPES.ImportSpecifier) {
|
|
93
|
+
return getImportSourceValue(node);
|
|
94
|
+
}
|
|
95
|
+
if (node.type === AST_NODE_TYPES.VariableDeclarator) {
|
|
96
|
+
return getRequireSourceValue(node.init);
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
};
|
|
100
|
+
const getDefinitionForIdentifier = (context, identifier) => {
|
|
101
|
+
const scope = context.sourceCode.getScope(identifier);
|
|
102
|
+
const variable = getVariableInScopeChain(scope, identifier.name);
|
|
103
|
+
return variable?.defs[0];
|
|
104
|
+
};
|
|
105
|
+
const getImportedSpecifierName = (node) => getStaticPropertyName(node.imported);
|
|
106
|
+
const getObjectPatternPropertyNameForIdentifier = (objectPattern, identifierName) => {
|
|
107
|
+
for (const property of objectPattern.properties) {
|
|
108
|
+
if (property.type !== AST_NODE_TYPES.Property ||
|
|
109
|
+
property.value.type !== AST_NODE_TYPES.Identifier ||
|
|
110
|
+
property.value.name !== identifierName) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
return getStaticPropertyName(property.key);
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
};
|
|
117
|
+
const getModuleSourceForBinding = (context, identifier) => {
|
|
118
|
+
const definition = getDefinitionForIdentifier(context, identifier);
|
|
119
|
+
return definition === undefined
|
|
120
|
+
? undefined
|
|
121
|
+
: getDefinitionModuleSource(definition.node);
|
|
122
|
+
};
|
|
123
|
+
const getNamedServerFactoryBindingName = (context, identifier) => {
|
|
124
|
+
const definition = getDefinitionForIdentifier(context, identifier);
|
|
125
|
+
if (definition === undefined) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
const source = getDefinitionModuleSource(definition.node);
|
|
129
|
+
if (definition.node.type === AST_NODE_TYPES.ImportSpecifier) {
|
|
130
|
+
const importedName = getImportedSpecifierName(definition.node);
|
|
131
|
+
return importedName !== undefined &&
|
|
132
|
+
isValidServerFactoryForSource(source, importedName)
|
|
133
|
+
? importedName
|
|
134
|
+
: undefined;
|
|
135
|
+
}
|
|
136
|
+
if (definition.node.type === AST_NODE_TYPES.VariableDeclarator &&
|
|
137
|
+
definition.node.id.type === AST_NODE_TYPES.ObjectPattern) {
|
|
138
|
+
const propertyName = getObjectPatternPropertyNameForIdentifier(definition.node.id, identifier.name);
|
|
139
|
+
return propertyName !== undefined &&
|
|
140
|
+
isValidServerFactoryForSource(source, propertyName)
|
|
141
|
+
? propertyName
|
|
142
|
+
: undefined;
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
};
|
|
146
|
+
const getRequireMemberFactoryName = (callee) => {
|
|
147
|
+
if (callee.type !== AST_NODE_TYPES.MemberExpression ||
|
|
148
|
+
callee.computed ||
|
|
149
|
+
callee.optional ||
|
|
150
|
+
callee.property.type !== AST_NODE_TYPES.Identifier ||
|
|
151
|
+
callee.object.type !== AST_NODE_TYPES.CallExpression) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
const source = getRequireSourceValue(callee.object);
|
|
155
|
+
const factoryName = callee.property.name;
|
|
156
|
+
return isValidServerFactoryForSource(source, factoryName)
|
|
157
|
+
? factoryName
|
|
158
|
+
: undefined;
|
|
159
|
+
};
|
|
160
|
+
const getModuleMemberFactoryName = (context, callee) => {
|
|
161
|
+
if (callee.type !== AST_NODE_TYPES.MemberExpression ||
|
|
162
|
+
callee.computed ||
|
|
163
|
+
callee.optional ||
|
|
164
|
+
callee.object.type !== AST_NODE_TYPES.Identifier ||
|
|
165
|
+
callee.property.type !== AST_NODE_TYPES.Identifier) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const source = getModuleSourceForBinding(context, callee.object);
|
|
169
|
+
const factoryName = callee.property.name;
|
|
170
|
+
return isValidServerFactoryForSource(source, factoryName)
|
|
171
|
+
? factoryName
|
|
172
|
+
: undefined;
|
|
173
|
+
};
|
|
174
|
+
const getServerFactoryName = (context, callee) => {
|
|
175
|
+
if (callee.type === AST_NODE_TYPES.Identifier) {
|
|
176
|
+
return getNamedServerFactoryBindingName(context, callee);
|
|
177
|
+
}
|
|
178
|
+
return (getModuleMemberFactoryName(context, callee) ??
|
|
179
|
+
getRequireMemberFactoryName(callee));
|
|
180
|
+
};
|
|
181
|
+
const isDiscardedExpression = (node) => {
|
|
182
|
+
let current = node;
|
|
183
|
+
let parent = getParentNode(current);
|
|
184
|
+
while (parent !== undefined) {
|
|
185
|
+
const wrappedExpression = getTransparentWrappedExpression(parent);
|
|
186
|
+
if (wrappedExpression === current) {
|
|
187
|
+
current = parent;
|
|
188
|
+
parent = getParentNode(current);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (parent.type === AST_NODE_TYPES.ExpressionStatement &&
|
|
192
|
+
parent.expression === current) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
if (parent.type === AST_NODE_TYPES.UnaryExpression &&
|
|
196
|
+
parent.operator === "void" &&
|
|
197
|
+
parent.argument === current) {
|
|
198
|
+
const unaryParent = getParentNode(parent);
|
|
199
|
+
return unaryParent?.type === AST_NODE_TYPES.ExpressionStatement;
|
|
200
|
+
}
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
};
|
|
205
|
+
const getImmediateServerMethodCall = (node) => {
|
|
206
|
+
let current = node;
|
|
207
|
+
let parent = getParentNode(current);
|
|
208
|
+
while (parent !== undefined) {
|
|
209
|
+
const wrappedExpression = getTransparentWrappedExpression(parent);
|
|
210
|
+
if (wrappedExpression === current) {
|
|
211
|
+
current = parent;
|
|
212
|
+
parent = getParentNode(current);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (parent.type !== AST_NODE_TYPES.MemberExpression ||
|
|
216
|
+
parent.object !== current ||
|
|
217
|
+
parent.computed ||
|
|
218
|
+
parent.property.type !== AST_NODE_TYPES.Identifier ||
|
|
219
|
+
isImmediateCleanupMethodName(parent.property.name)) {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
const callExpression = getParentNode(parent);
|
|
223
|
+
return callExpression?.type === AST_NODE_TYPES.CallExpression &&
|
|
224
|
+
callExpression.callee === parent
|
|
225
|
+
? callExpression
|
|
226
|
+
: undefined;
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
};
|
|
230
|
+
const isDiscardedImmediateServerMethodChain = (node) => {
|
|
231
|
+
let currentCall = getImmediateServerMethodCall(node);
|
|
232
|
+
while (currentCall !== undefined) {
|
|
233
|
+
if (isDiscardedExpression(currentCall)) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
currentCall = getImmediateServerMethodCall(currentCall);
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
};
|
|
240
|
+
const isDiscardedServerHandle = (node) => isDiscardedExpression(node) || isDiscardedImmediateServerMethodChain(node);
|
|
241
|
+
/** Rule implementation for `runtime-cleanup/no-floating-servers`. */
|
|
242
|
+
const noFloatingServers = createTypedRule({
|
|
243
|
+
create(context) {
|
|
244
|
+
return {
|
|
245
|
+
CallExpression(node) {
|
|
246
|
+
const factoryName = getServerFactoryName(context, node.callee);
|
|
247
|
+
if (factoryName === undefined ||
|
|
248
|
+
!isDiscardedServerHandle(node)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
context.report({
|
|
252
|
+
data: { factoryName },
|
|
253
|
+
messageId: "floatingServer",
|
|
254
|
+
node,
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
},
|
|
259
|
+
defaultOptions: [],
|
|
260
|
+
meta: {
|
|
261
|
+
docs: {
|
|
262
|
+
description: "require Node.js server handles to be retained so they can be closed.",
|
|
263
|
+
recommended: true,
|
|
264
|
+
requiresTypeChecking: false,
|
|
265
|
+
runtimeCleanupConfigs: [
|
|
266
|
+
"runtime-cleanup.configs.recommended",
|
|
267
|
+
"runtime-cleanup.configs.recommended-type-checked",
|
|
268
|
+
"runtime-cleanup.configs.strict",
|
|
269
|
+
"runtime-cleanup.configs.all",
|
|
270
|
+
],
|
|
271
|
+
url: createRuleDocsUrl("no-floating-servers"),
|
|
272
|
+
},
|
|
273
|
+
messages: {
|
|
274
|
+
floatingServer: "Store or return the server from {{factoryName}} so close() can stop it during cleanup.",
|
|
275
|
+
},
|
|
276
|
+
schema: [],
|
|
277
|
+
type: "problem",
|
|
278
|
+
},
|
|
279
|
+
name: "no-floating-servers",
|
|
280
|
+
});
|
|
281
|
+
export default noFloatingServers;
|
|
282
|
+
//# sourceMappingURL=no-floating-servers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-floating-servers.js","sourceRoot":"","sources":["../../src/rules/no-floating-servers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACH,cAAc,GAGjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCA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YACH,cAAc,CAAC,IAAuC;gBAClD,MAAM,WAAW,GAAG,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBAE/D,IACI,WAAW,KAAK,SAAS;oBACzB,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAChC,CAAC;oBACC,OAAO;gBACX,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI,EAAE,EAAE,WAAW,EAAE;oBACrB,SAAS,EAAE,gBAAgB;oBAC3B,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EACP,sEAAsE;YAC1E,WAAW,EAAE,IAAI;YACjB,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE;gBACnB,qCAAqC;gBACrC,kDAAkD;gBAClD,gCAAgC;gBAChC,6BAA6B;aAChC;YACD,GAAG,EAAE,iBAAiB,CAAC,qBAAqB,CAAC;SAChD;QACD,QAAQ,EAAE;YACN,cAAc,EACV,wFAAwF;SAC/F;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,qBAAqB;CAC9B,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Require Node.js file stream handles to be retained so they can be closed during cleanup.
|
|
4
|
+
*/
|
|
5
|
+
import { type TSESLint } from "@typescript-eslint/utils";
|
|
6
|
+
/** Rule implementation for `runtime-cleanup/no-floating-streams`. */
|
|
7
|
+
declare const noFloatingStreams: TSESLint.RuleModule<"floatingStream", readonly []>;
|
|
8
|
+
export default noFloatingStreams;
|
|
9
|
+
//# sourceMappingURL=no-floating-streams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-floating-streams.d.ts","sourceRoot":"","sources":["../../src/rules/no-floating-streams.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEH,KAAK,QAAQ,EAEhB,MAAM,0BAA0B,CAAC;AA6SlC,qEAAqE;AACrE,QAAA,MAAM,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAgDpE,CAAC;AAEP,eAAe,iBAAiB,CAAC"}
|