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,105 @@
|
|
|
1
|
+
# no-floating-web-stream-locks
|
|
2
|
+
|
|
3
|
+
Require Web Stream readers and writers to be retained so their locks can be
|
|
4
|
+
released.
|
|
5
|
+
|
|
6
|
+
> **Rule catalog ID:** R019
|
|
7
|
+
|
|
8
|
+
## Targeted pattern scope
|
|
9
|
+
|
|
10
|
+
This type-aware rule targets lock-producing Web Streams methods:
|
|
11
|
+
|
|
12
|
+
- `ReadableStream#getReader()`
|
|
13
|
+
- `WritableStream#getWriter()`
|
|
14
|
+
|
|
15
|
+
The rule uses TypeScript parser services to confirm that the receiver is a Web
|
|
16
|
+
`ReadableStream` or `WritableStream`. That avoids flagging project-local
|
|
17
|
+
objects that happen to expose methods named `getReader()` or `getWriter()`.
|
|
18
|
+
|
|
19
|
+
## What this rule reports
|
|
20
|
+
|
|
21
|
+
The rule reports:
|
|
22
|
+
|
|
23
|
+
- discarded stream readers
|
|
24
|
+
- discarded stream writers
|
|
25
|
+
- immediately chained reader or writer use where the reader/writer handle is
|
|
26
|
+
lost
|
|
27
|
+
|
|
28
|
+
Immediate `releaseLock()` calls are allowed. The rule focuses on cases where the
|
|
29
|
+
lock owner is obviously unavailable to cleanup code.
|
|
30
|
+
|
|
31
|
+
## Why this rule exists
|
|
32
|
+
|
|
33
|
+
`getReader()` and `getWriter()` lock the stream to the returned reader or writer.
|
|
34
|
+
The lock should be released with `releaseLock()` when the owner is done with the
|
|
35
|
+
stream. If the reader or writer is discarded, later cleanup code cannot release
|
|
36
|
+
that lock.
|
|
37
|
+
|
|
38
|
+
## Incorrect
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
new ReadableStream<Uint8Array>().getReader();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
stream.getReader().read();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
stream.getWriter().write(chunk);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Correct
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const reader = stream.getReader();
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
await reader.read();
|
|
59
|
+
} finally {
|
|
60
|
+
reader.releaseLock();
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
function createReader(stream: ReadableStream<Uint8Array>) {
|
|
66
|
+
return stream.getReader();
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
streamReaderRegistry.add(stream.getReader());
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Behavior and migration notes
|
|
75
|
+
|
|
76
|
+
This rule is type-aware and requires parser services. Enable it through a
|
|
77
|
+
type-checked preset or configure `parserOptions.projectService` yourself.
|
|
78
|
+
|
|
79
|
+
This rule does not autofix. Rewriting `stream.getReader().read()` into a
|
|
80
|
+
retained reader requires a surrounding `try`/`finally` cleanup shape, which is
|
|
81
|
+
too context-dependent for a safe automatic fix.
|
|
82
|
+
|
|
83
|
+
## ESLint flat config example
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import runtimeCleanup from "eslint-plugin-runtime-cleanup";
|
|
87
|
+
|
|
88
|
+
export default [
|
|
89
|
+
runtimeCleanup.configs["recommended-type-checked"],
|
|
90
|
+
];
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## When not to use it
|
|
94
|
+
|
|
95
|
+
Do not enable this rule in JavaScript-only projects without TypeScript parser
|
|
96
|
+
services. For code that intentionally locks a stream for the entire process
|
|
97
|
+
lifetime, use a narrow disable comment and document that ownership boundary.
|
|
98
|
+
|
|
99
|
+
## Further reading
|
|
100
|
+
|
|
101
|
+
- [MDN: `ReadableStream.getReader()`](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
|
|
102
|
+
- [MDN: `ReadableStreamDefaultReader.releaseLock()`](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)
|
|
103
|
+
- [MDN: `WritableStream.getWriter()`](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
|
|
104
|
+
- [MDN: `WritableStreamDefaultWriter.releaseLock()`](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)
|
|
105
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# no-floating-workers
|
|
2
|
+
|
|
3
|
+
Require worker handles to be retained so they can be terminated during cleanup.
|
|
4
|
+
|
|
5
|
+
> **Rule catalog ID:** R004
|
|
6
|
+
|
|
7
|
+
## Targeted pattern scope
|
|
8
|
+
|
|
9
|
+
This rule targets worker constructors whose active thread or shared worker
|
|
10
|
+
connection should have an explicit lifecycle owner:
|
|
11
|
+
|
|
12
|
+
- `Worker`
|
|
13
|
+
- `SharedWorker`
|
|
14
|
+
- `window.Worker`, `self.Worker`, and `globalThis.Worker`
|
|
15
|
+
- `window.SharedWorker`, `self.SharedWorker`, and `globalThis.SharedWorker`
|
|
16
|
+
- `Worker` imported from `node:worker_threads` or `worker_threads`
|
|
17
|
+
|
|
18
|
+
The rule reports worker instances that are immediately discarded or chained
|
|
19
|
+
directly into a method call other than `.terminate()`. In both cases there is no
|
|
20
|
+
remaining worker handle available for teardown.
|
|
21
|
+
|
|
22
|
+
## What this rule reports
|
|
23
|
+
|
|
24
|
+
The rule reports:
|
|
25
|
+
|
|
26
|
+
- standalone worker construction expressions such as `new Worker("./worker.js");`
|
|
27
|
+
- voided worker construction such as `void new SharedWorker("./worker.js");`
|
|
28
|
+
- immediate worker method chains such as
|
|
29
|
+
`new Worker("./worker.js").postMessage("start");`
|
|
30
|
+
- discarded Node.js `worker_threads` workers imported as `Worker`
|
|
31
|
+
|
|
32
|
+
It intentionally does not require same-function `terminate()` calls. Ownership
|
|
33
|
+
can be transferred to a component instance, resource manager, returned
|
|
34
|
+
disposable, `using` declaration, or longer-lived runtime owner.
|
|
35
|
+
|
|
36
|
+
## Why this rule exists
|
|
37
|
+
|
|
38
|
+
Workers run independently from the creating script. Browser `Worker` instances
|
|
39
|
+
can be stopped with `terminate()`, and Node.js `worker_threads.Worker`
|
|
40
|
+
instances expose `terminate()` and `Symbol.asyncDispose`. If the worker handle is
|
|
41
|
+
not retained, later cleanup cannot reliably stop the work or release the owning
|
|
42
|
+
runtime resource.
|
|
43
|
+
|
|
44
|
+
`SharedWorker` instances are intentionally shared across same-origin browsing
|
|
45
|
+
contexts, but the creating page still needs a retained handle for its port and
|
|
46
|
+
ownership bookkeeping. Discarding the handle makes that lifecycle implicit.
|
|
47
|
+
|
|
48
|
+
## Incorrect
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
new Worker("./worker.js");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
void new SharedWorker("./shared-worker.js");
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
new Worker("./worker.js").postMessage("start");
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { Worker } from "node:worker_threads";
|
|
64
|
+
|
|
65
|
+
new Worker("./worker.js");
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Correct
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const worker = new Worker("./worker.js");
|
|
72
|
+
|
|
73
|
+
worker.postMessage("start");
|
|
74
|
+
worker.terminate();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
return new Worker("./worker.js");
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
registerWorker(new SharedWorker("./shared-worker.js"));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { Worker } from "node:worker_threads";
|
|
87
|
+
|
|
88
|
+
await using worker = new Worker("./worker.js");
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Behavior and migration notes
|
|
92
|
+
|
|
93
|
+
Store worker instances in the lifecycle owner that will stop or dispose them.
|
|
94
|
+
For UI components, that is usually the component setup scope or a disposable
|
|
95
|
+
collection. For shared libraries, returning the worker or passing it to a
|
|
96
|
+
dedicated resource manager keeps ownership explicit.
|
|
97
|
+
|
|
98
|
+
This rule does not autofix. Choosing the owner and termination point is a
|
|
99
|
+
semantic decision, and inserting a variable without a matching `terminate()` or
|
|
100
|
+
disposal path would hide the lifecycle problem instead of fixing it.
|
|
101
|
+
|
|
102
|
+
## ESLint flat config example
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
import runtimeCleanup from "eslint-plugin-runtime-cleanup";
|
|
106
|
+
|
|
107
|
+
export default [
|
|
108
|
+
runtimeCleanup.configs.recommended,
|
|
109
|
+
];
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## When not to use it
|
|
113
|
+
|
|
114
|
+
Do not enable this rule for code that intentionally creates page-lifetime or
|
|
115
|
+
process-lifetime workers and does not need an explicit cleanup owner. Prefer a
|
|
116
|
+
narrow disable comment with a reason when a worker is meant to live for the
|
|
117
|
+
whole runtime.
|
|
118
|
+
|
|
119
|
+
## Further reading
|
|
120
|
+
|
|
121
|
+
- [MDN: `Worker.terminate()`](https://developer.mozilla.org/docs/Web/API/Worker/terminate)
|
|
122
|
+
- [MDN: `SharedWorker`](https://developer.mozilla.org/docs/Web/API/SharedWorker)
|
|
123
|
+
- [Node.js: `worker_threads.Worker`](https://nodejs.org/api/worker_threads.html#class-worker)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# no-unmanaged-event-listeners
|
|
2
|
+
|
|
3
|
+
Require event listeners to have an abort signal or a matching cleanup call.
|
|
4
|
+
|
|
5
|
+
> **Rule catalog ID:** R002
|
|
6
|
+
|
|
7
|
+
## Targeted pattern scope
|
|
8
|
+
|
|
9
|
+
This rule targets `EventTarget#addEventListener(...)` calls where the listener
|
|
10
|
+
registration has no visible cleanup path.
|
|
11
|
+
|
|
12
|
+
The rule accepts two cleanup models:
|
|
13
|
+
|
|
14
|
+
- passing an options object with a `signal` property, so an `AbortController`
|
|
15
|
+
owns listener teardown;
|
|
16
|
+
- or calling `removeEventListener(...)` with the same target, event type,
|
|
17
|
+
listener, and capture mode in the same function or program boundary.
|
|
18
|
+
|
|
19
|
+
## What this rule reports
|
|
20
|
+
|
|
21
|
+
The rule reports `addEventListener(...)` calls when both of these are true:
|
|
22
|
+
|
|
23
|
+
- the third argument does not resolve to an object with a `signal` property;
|
|
24
|
+
- and no matching `removeEventListener(...)` call exists in the same lexical
|
|
25
|
+
boundary.
|
|
26
|
+
|
|
27
|
+
The same-boundary requirement is intentional. Cleanup in a different function is
|
|
28
|
+
often real, but matching cross-function ownership without framework knowledge is
|
|
29
|
+
too noisy for a syntax-only rule.
|
|
30
|
+
|
|
31
|
+
## Capture matching
|
|
32
|
+
|
|
33
|
+
`removeEventListener(...)` only removes the original listener when the capture
|
|
34
|
+
mode matches. This rule tracks the common capture forms:
|
|
35
|
+
|
|
36
|
+
- no options argument, which is treated as `false`;
|
|
37
|
+
- boolean options such as `true`;
|
|
38
|
+
- object options such as `{ capture: true }`.
|
|
39
|
+
|
|
40
|
+
Opaque option values are only considered a match when the same option expression
|
|
41
|
+
is passed to both calls.
|
|
42
|
+
|
|
43
|
+
## Why this rule exists
|
|
44
|
+
|
|
45
|
+
Listeners keep callbacks and their captured state alive. In browser code, that
|
|
46
|
+
can retain component state after unmount. In long-lived services, repeated
|
|
47
|
+
registration without teardown creates duplicate work and memory leaks.
|
|
48
|
+
|
|
49
|
+
An abort signal is usually the clearest ownership model for modern event
|
|
50
|
+
targets. A matching `removeEventListener(...)` call is still valid when the
|
|
51
|
+
lifecycle boundary is small and obvious.
|
|
52
|
+
|
|
53
|
+
## Incorrect
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
button.addEventListener("click", handleClick);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
window.addEventListener("resize", () => layout());
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
target.addEventListener("scroll", onScroll, true);
|
|
65
|
+
target.removeEventListener("scroll", onScroll, false);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
function setup() {
|
|
70
|
+
window.addEventListener("resize", onResize);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function cleanup() {
|
|
74
|
+
window.removeEventListener("resize", onResize);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Correct
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const controller = new AbortController();
|
|
82
|
+
|
|
83
|
+
button.addEventListener("click", handleClick, {
|
|
84
|
+
signal: controller.signal,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
controller.abort();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
button.addEventListener("click", handleClick);
|
|
92
|
+
button.removeEventListener("click", handleClick);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
target.addEventListener("scroll", onScroll, { capture: true });
|
|
97
|
+
target.removeEventListener("scroll", onScroll, { capture: true });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
function setup() {
|
|
102
|
+
window.addEventListener("resize", onResize);
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
window.removeEventListener("resize", onResize);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Behavior and migration notes
|
|
111
|
+
|
|
112
|
+
Prefer an `AbortController` when listener ownership belongs to a component,
|
|
113
|
+
request, disposable object, or other lifecycle boundary that may later own
|
|
114
|
+
multiple resources.
|
|
115
|
+
|
|
116
|
+
Use `removeEventListener(...)` when the add/remove pair is intentionally local
|
|
117
|
+
and the same callback reference is available. Inline callbacks without a signal
|
|
118
|
+
are reported because there is no stable callback reference to remove later.
|
|
119
|
+
|
|
120
|
+
This rule does not autofix because choosing the right cleanup lifetime is a
|
|
121
|
+
semantic decision.
|
|
122
|
+
|
|
123
|
+
## ESLint flat config example
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
import runtimeCleanup from "eslint-plugin-runtime-cleanup";
|
|
127
|
+
|
|
128
|
+
export default [
|
|
129
|
+
runtimeCleanup.configs.recommended,
|
|
130
|
+
];
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## When not to use it
|
|
134
|
+
|
|
135
|
+
Do not enable this rule for code that intentionally registers process-lifetime
|
|
136
|
+
or page-lifetime listeners. Prefer a narrow disable comment with a reason when
|
|
137
|
+
the listener is meant to live for the whole runtime.
|
|
138
|
+
|
|
139
|
+
## Further reading
|
|
140
|
+
|
|
141
|
+
- [MDN: `addEventListener`](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
142
|
+
- [MDN: `removeEventListener`](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
143
|
+
- [MDN: `AbortController`](https://developer.mozilla.org/docs/Web/API/AbortController)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Rules overview
|
|
2
|
+
|
|
3
|
+
`eslint-plugin-runtime-cleanup` rules target runtime resource lifetimes that are
|
|
4
|
+
easy to leak when allocation and teardown drift apart.
|
|
5
|
+
|
|
6
|
+
## Stable rules
|
|
7
|
+
|
|
8
|
+
- [`no-floating-timers`](./no-floating-timers.md) requires timer handles to be
|
|
9
|
+
retained so they can be cleared during cleanup.
|
|
10
|
+
- [`no-unmanaged-event-listeners`](./no-unmanaged-event-listeners.md) requires
|
|
11
|
+
event listeners to use an `AbortSignal` option or a matching
|
|
12
|
+
`removeEventListener` cleanup call.
|
|
13
|
+
- [`no-floating-observers`](./no-floating-observers.md) requires native
|
|
14
|
+
observer instances to be retained so they can be disconnected during cleanup.
|
|
15
|
+
- [`no-floating-workers`](./no-floating-workers.md) requires worker handles to
|
|
16
|
+
be retained so they can be terminated during cleanup.
|
|
17
|
+
- [`no-floating-child-processes`](./no-floating-child-processes.md) requires
|
|
18
|
+
child process handles to be retained so they can be killed during cleanup.
|
|
19
|
+
|
|
20
|
+
Future rules should continue to target explicit runtime resource lifetimes,
|
|
21
|
+
including timers, listeners, observers, abort controllers, workers, streams,
|
|
22
|
+
child processes, and disposable handles.
|
|
23
|
+
|
|
24
|
+
## Rule authoring expectations
|
|
25
|
+
|
|
26
|
+
Runtime cleanup rules should be conservative:
|
|
27
|
+
|
|
28
|
+
- report only resource allocation patterns with a clear cleanup obligation
|
|
29
|
+
- avoid whole-file heuristics that create noisy false positives
|
|
30
|
+
- use type information only when it materially improves precision
|
|
31
|
+
- prefer suggestions over autofixes when cleanup placement is ambiguous
|
|
32
|
+
- document the exact lifecycle pattern the rule expects
|
|
33
|
+
|
|
34
|
+
## Presets
|
|
35
|
+
|
|
36
|
+
The preset pages describe the exported config keys and are ready for future
|
|
37
|
+
rules:
|
|
38
|
+
|
|
39
|
+
- [`minimal`](./presets/minimal.md)
|
|
40
|
+
- [`recommended`](./presets/recommended.md)
|
|
41
|
+
- [`recommended-type-checked`](./presets/recommended-type-checked.md)
|
|
42
|
+
- [`strict`](./presets/strict.md)
|
|
43
|
+
- [`all`](./presets/all.md)
|
|
44
|
+
- [`experimental`](./presets/experimental.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# all
|
|
2
|
+
|
|
3
|
+
`runtime-cleanup.configs.all` is reserved for every stable runtime-cleanup rule.
|
|
4
|
+
|
|
5
|
+
## Rules in this preset
|
|
6
|
+
|
|
7
|
+
This preset enables the following rules.
|
|
8
|
+
|
|
9
|
+
- `Fix` legend:
|
|
10
|
+
- `fix` = autofixable
|
|
11
|
+
- `suggest` = suggestions available
|
|
12
|
+
- `-` = report only
|
|
13
|
+
|
|
14
|
+
| Rule | Fix |
|
|
15
|
+
| --- | :-: |
|
|
16
|
+
| [`no-floating-abort-controllers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-abort-controllers) | - |
|
|
17
|
+
| [`no-floating-audio-contexts`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-audio-contexts) | - |
|
|
18
|
+
| [`no-floating-broadcast-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-broadcast-channels) | - |
|
|
19
|
+
| [`no-floating-child-processes`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-child-processes) | - |
|
|
20
|
+
| [`no-floating-disposable-stacks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-disposable-stacks) | - |
|
|
21
|
+
| [`no-floating-file-watchers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-file-watchers) | - |
|
|
22
|
+
| [`no-floating-geolocation-watches`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-geolocation-watches) | - |
|
|
23
|
+
| [`no-floating-infinite-animations`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-infinite-animations) | - |
|
|
24
|
+
| [`no-floating-media-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-media-streams) | - |
|
|
25
|
+
| [`no-floating-message-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-message-channels) | - |
|
|
26
|
+
| [`no-floating-network-connections`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-network-connections) | - |
|
|
27
|
+
| [`no-floating-object-urls`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-object-urls) | - |
|
|
28
|
+
| [`no-floating-observers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-observers) | - |
|
|
29
|
+
| [`no-floating-servers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-servers) | - |
|
|
30
|
+
| [`no-floating-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-streams) | - |
|
|
31
|
+
| [`no-floating-timers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-timers) | - |
|
|
32
|
+
| [`no-floating-wake-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-wake-locks) | - |
|
|
33
|
+
| [`no-floating-web-stream-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-web-stream-locks) | - |
|
|
34
|
+
| [`no-floating-workers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-workers) | - |
|
|
35
|
+
| [`no-unmanaged-event-listeners`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-unmanaged-event-listeners) | - |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# experimental
|
|
2
|
+
|
|
3
|
+
`runtime-cleanup.configs.experimental` is reserved for cleanup rules that still
|
|
4
|
+
need production feedback on precision, performance, or fix safety.
|
|
5
|
+
|
|
6
|
+
## Rules in this preset
|
|
7
|
+
|
|
8
|
+
No experimental rules are currently enabled by this preset.
|
|
9
|
+
|
|
10
|
+
- `Fix` legend:
|
|
11
|
+
- `fix` = autofixable
|
|
12
|
+
- `suggest` = suggestions available
|
|
13
|
+
- `-` = report only
|
|
14
|
+
|
|
15
|
+
### Experimental additions over `all`
|
|
16
|
+
|
|
17
|
+
| Rule | Fix |
|
|
18
|
+
| --- | :-: |
|
|
19
|
+
| - | - |
|
|
20
|
+
|
|
21
|
+
### Baseline rules inherited from `all`
|
|
22
|
+
|
|
23
|
+
| Rule | Fix |
|
|
24
|
+
| --- | :-: |
|
|
25
|
+
| [`no-floating-abort-controllers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-abort-controllers) | - |
|
|
26
|
+
| [`no-floating-audio-contexts`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-audio-contexts) | - |
|
|
27
|
+
| [`no-floating-broadcast-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-broadcast-channels) | - |
|
|
28
|
+
| [`no-floating-child-processes`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-child-processes) | - |
|
|
29
|
+
| [`no-floating-disposable-stacks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-disposable-stacks) | - |
|
|
30
|
+
| [`no-floating-file-watchers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-file-watchers) | - |
|
|
31
|
+
| [`no-floating-geolocation-watches`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-geolocation-watches) | - |
|
|
32
|
+
| [`no-floating-infinite-animations`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-infinite-animations) | - |
|
|
33
|
+
| [`no-floating-media-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-media-streams) | - |
|
|
34
|
+
| [`no-floating-message-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-message-channels) | - |
|
|
35
|
+
| [`no-floating-network-connections`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-network-connections) | - |
|
|
36
|
+
| [`no-floating-object-urls`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-object-urls) | - |
|
|
37
|
+
| [`no-floating-observers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-observers) | - |
|
|
38
|
+
| [`no-floating-servers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-servers) | - |
|
|
39
|
+
| [`no-floating-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-streams) | - |
|
|
40
|
+
| [`no-floating-timers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-timers) | - |
|
|
41
|
+
| [`no-floating-wake-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-wake-locks) | - |
|
|
42
|
+
| [`no-floating-web-stream-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-web-stream-locks) | - |
|
|
43
|
+
| [`no-floating-workers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-workers) | - |
|
|
44
|
+
| [`no-unmanaged-event-listeners`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-unmanaged-event-listeners) | - |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Presets
|
|
2
|
+
|
|
3
|
+
`eslint-plugin-runtime-cleanup` exposes stable flat-config presets so consumers
|
|
4
|
+
can adopt the package shape before concrete rules are published.
|
|
5
|
+
|
|
6
|
+
## Preset list
|
|
7
|
+
|
|
8
|
+
| Preset | Type information | Intended use |
|
|
9
|
+
| --- | :-: | --- |
|
|
10
|
+
| `runtime-cleanup.configs.minimal` | No | Lowest-noise cleanup rules. |
|
|
11
|
+
| `runtime-cleanup.configs.recommended` | No | Broadly safe cleanup rules. |
|
|
12
|
+
| `runtime-cleanup.configs["recommended-type-checked"]` | Yes | Recommended rules that need TypeScript type information. |
|
|
13
|
+
| `runtime-cleanup.configs.strict` | No | Stronger cleanup enforcement. |
|
|
14
|
+
| `runtime-cleanup.configs.all` | No | All stable rules. |
|
|
15
|
+
| `runtime-cleanup.configs.experimental` | No | Rules still proving out behavior. |
|
|
16
|
+
|
|
17
|
+
## Rule matrix
|
|
18
|
+
|
|
19
|
+
Runtime-cleanup rules are listed below. Each rule documents the exact resource-lifetime pattern it enforces.
|
|
20
|
+
|
|
21
|
+
- `Fix` legend:
|
|
22
|
+
- `fix` = autofixable
|
|
23
|
+
- `suggest` = suggestions available
|
|
24
|
+
- `-` = report only
|
|
25
|
+
- `Preset key` legend:
|
|
26
|
+
- [M](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/minimal) - [`runtime-cleanup.configs.minimal`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/minimal)
|
|
27
|
+
- [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) - [`runtime-cleanup.configs.recommended`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended)
|
|
28
|
+
- [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) - [`runtime-cleanup.configs["recommended-type-checked"]`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked)
|
|
29
|
+
- [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) - [`runtime-cleanup.configs.strict`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict)
|
|
30
|
+
- [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) - [`runtime-cleanup.configs.all`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all)
|
|
31
|
+
- [E](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/experimental) - [`runtime-cleanup.configs.experimental`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/experimental)
|
|
32
|
+
|
|
33
|
+
| Rule | Fix | Preset key |
|
|
34
|
+
| --- | :-: | :-- |
|
|
35
|
+
| [`no-floating-abort-controllers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-abort-controllers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
36
|
+
| [`no-floating-audio-contexts`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-audio-contexts) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
37
|
+
| [`no-floating-broadcast-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-broadcast-channels) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
38
|
+
| [`no-floating-child-processes`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-child-processes) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
39
|
+
| [`no-floating-disposable-stacks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-disposable-stacks) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
40
|
+
| [`no-floating-file-watchers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-file-watchers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
41
|
+
| [`no-floating-geolocation-watches`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-geolocation-watches) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
42
|
+
| [`no-floating-infinite-animations`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-infinite-animations) | - | [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
43
|
+
| [`no-floating-media-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-media-streams) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
44
|
+
| [`no-floating-message-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-message-channels) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
45
|
+
| [`no-floating-network-connections`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-network-connections) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
46
|
+
| [`no-floating-object-urls`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-object-urls) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
47
|
+
| [`no-floating-observers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-observers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
48
|
+
| [`no-floating-servers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-servers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
49
|
+
| [`no-floating-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-streams) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
50
|
+
| [`no-floating-timers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-timers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
51
|
+
| [`no-floating-wake-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-wake-locks) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
52
|
+
| [`no-floating-web-stream-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-web-stream-locks) | - | [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
53
|
+
| [`no-floating-workers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-workers) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
54
|
+
| [`no-unmanaged-event-listeners`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-unmanaged-event-listeners) | - | [R](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended) [T](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/recommended-type-checked) [S](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/strict) [A](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/presets/all) |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# minimal
|
|
2
|
+
|
|
3
|
+
`runtime-cleanup.configs.minimal` is reserved for the lowest-noise runtime
|
|
4
|
+
cleanup rules.
|
|
5
|
+
|
|
6
|
+
## Rules in this preset
|
|
7
|
+
|
|
8
|
+
No rules are currently enabled by this preset.
|
|
9
|
+
|
|
10
|
+
- `Fix` legend:
|
|
11
|
+
- `fix` = autofixable
|
|
12
|
+
- `suggest` = suggestions available
|
|
13
|
+
- `-` = report only
|
|
14
|
+
|
|
15
|
+
| Rule | Fix |
|
|
16
|
+
| --- | :-: |
|
|
17
|
+
| - | - |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# recommended-type-checked
|
|
2
|
+
|
|
3
|
+
`runtime-cleanup.configs["recommended-type-checked"]` is reserved for
|
|
4
|
+
recommended cleanup rules that need TypeScript parser services.
|
|
5
|
+
|
|
6
|
+
## Rules in this preset
|
|
7
|
+
|
|
8
|
+
This preset enables recommended rules and any type-aware recommended additions.
|
|
9
|
+
|
|
10
|
+
- `Fix` legend:
|
|
11
|
+
- `fix` = autofixable
|
|
12
|
+
- `suggest` = suggestions available
|
|
13
|
+
- `-` = report only
|
|
14
|
+
|
|
15
|
+
### Type-aware additions over `recommended`
|
|
16
|
+
|
|
17
|
+
| Rule | Fix |
|
|
18
|
+
| --- | :-: |
|
|
19
|
+
| [`no-floating-infinite-animations`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-infinite-animations) | - |
|
|
20
|
+
| [`no-floating-web-stream-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-web-stream-locks) | - |
|
|
21
|
+
|
|
22
|
+
### Baseline rules inherited from `recommended`
|
|
23
|
+
|
|
24
|
+
| Rule | Fix |
|
|
25
|
+
| --- | :-: |
|
|
26
|
+
| [`no-floating-abort-controllers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-abort-controllers) | - |
|
|
27
|
+
| [`no-floating-audio-contexts`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-audio-contexts) | - |
|
|
28
|
+
| [`no-floating-broadcast-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-broadcast-channels) | - |
|
|
29
|
+
| [`no-floating-child-processes`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-child-processes) | - |
|
|
30
|
+
| [`no-floating-disposable-stacks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-disposable-stacks) | - |
|
|
31
|
+
| [`no-floating-file-watchers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-file-watchers) | - |
|
|
32
|
+
| [`no-floating-geolocation-watches`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-geolocation-watches) | - |
|
|
33
|
+
| [`no-floating-media-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-media-streams) | - |
|
|
34
|
+
| [`no-floating-message-channels`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-message-channels) | - |
|
|
35
|
+
| [`no-floating-network-connections`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-network-connections) | - |
|
|
36
|
+
| [`no-floating-object-urls`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-object-urls) | - |
|
|
37
|
+
| [`no-floating-observers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-observers) | - |
|
|
38
|
+
| [`no-floating-servers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-servers) | - |
|
|
39
|
+
| [`no-floating-streams`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-streams) | - |
|
|
40
|
+
| [`no-floating-timers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-timers) | - |
|
|
41
|
+
| [`no-floating-wake-locks`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-wake-locks) | - |
|
|
42
|
+
| [`no-floating-workers`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-floating-workers) | - |
|
|
43
|
+
| [`no-unmanaged-event-listeners`](https://nick2bad4u.github.io/eslint-plugin-runtime-cleanup/docs/rules/no-unmanaged-event-listeners) | - |
|