Skip to content

Commit 6339234

Browse files
committed
Convert type file naming to kebab-case
1 parent f34bbea commit 6339234

File tree

12 files changed

+35
-56
lines changed

12 files changed

+35
-56
lines changed

packages/plugins/eslint-plugin-react-web-api/src/rules/no-leaked-event-listener.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ type EffectMethodKind = "useEffect" | "useInsertionEffect" | "useLayoutEffect";
3939
type LifecycleMethodKind = "componentDidMount" | "componentWillUnmount";
4040
type CallKind = EventMethodKind | EffectMethodKind | LifecycleMethodKind | "abort" | "other";
4141

42-
export type AEntry = EventListenerEntry & { kind: "addEventListener" };
42+
export type AEntry = EventListenerEntry & { method: "addEventListener" };
4343

44-
export type REntry = EventListenerEntry & { kind: "removeEventListener" };
44+
export type REntry = EventListenerEntry & { method: "removeEventListener" };
4545

4646
// #endregion
4747

@@ -256,11 +256,11 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
256256
checkInlineFunction(node, callKind, opts);
257257
aEntries.push({
258258
...opts,
259-
kind: "addEventListener",
260259
type,
261260
node,
262261
callee,
263262
listener,
263+
method: "addEventListener",
264264
phase: fKind,
265265
});
266266
})
@@ -276,11 +276,11 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
276276
checkInlineFunction(node, callKind, opts);
277277
rEntries.push({
278278
...opts,
279-
kind: "removeEventListener",
280279
type,
281280
node,
282281
callee,
283282
listener,
283+
method: "removeEventListener",
284284
phase: fKind,
285285
});
286286
})

packages/plugins/eslint-plugin-react-web-api/src/rules/no-leaked-resize-observer.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { AST_NODE_TYPES as T } from "@typescript-eslint/utils";
1515
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
1616
import { P, isMatching, match } from "ts-pattern";
1717

18-
import type { ObserverEntry, ObserverMethod } from "../types";
18+
import type { ObserverEntry } from "../types";
1919
import { createRule } from "../utils";
2020

2121
// #region Rule Metadata
@@ -34,12 +34,11 @@ export type MessageID =
3434
// #region Types
3535

3636
type FunctionKind = ComponentPhaseKind | "other";
37-
type EffectMethodKind = "useEffect" | "useInsertionEffect" | "useLayoutEffect";
38-
type CallKind = ObserverMethod | EffectMethodKind | "other";
37+
type CallKind = ObserverEntry["method"] | "useEffect" | "useInsertionEffect" | "useLayoutEffect" | "other";
3938

40-
export type OEntry = ObserverEntry & { kind: "observe" };
41-
export type UEntry = ObserverEntry & { kind: "unobserve" };
42-
export type DEntry = ObserverEntry & { kind: "disconnect" };
39+
export type OEntry = ObserverEntry & { method: "observe" };
40+
export type UEntry = ObserverEntry & { method: "unobserve" };
41+
export type DEntry = ObserverEntry & { method: "disconnect" };
4342

4443
// #endregion
4544

@@ -146,11 +145,11 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
146145
match(getCallKind(context, node))
147146
.with("disconnect", () => {
148147
dEntries.push({
149-
kind: "disconnect",
148+
kind: "ResizeObserver",
150149
node,
151150
callee: node.callee,
151+
method: "disconnect",
152152
observer: object,
153-
observerKind: "ResizeObserver",
154153
phase: fKind,
155154
});
156155
})
@@ -160,12 +159,12 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
160159
return;
161160
}
162161
oEntries.push({
163-
kind: "observe",
162+
kind: "ResizeObserver",
164163
node,
165164
callee: node.callee,
166165
element,
166+
method: "observe",
167167
observer: object,
168-
observerKind: "ResizeObserver",
169168
phase: fKind,
170169
});
171170
})
@@ -175,12 +174,12 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
175174
return;
176175
}
177176
uEntries.push({
178-
kind: "unobserve",
177+
kind: "ResizeObserver",
179178
node,
180179
callee: node.callee,
181180
element,
181+
method: "unobserve",
182182
observer: object,
183-
observerKind: "ResizeObserver",
184183
phase: fKind,
185184
});
186185
})

packages/plugins/eslint-plugin-react-web-api/src/types/EventListener/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/plugins/eslint-plugin-react-web-api/src/types/Observer/ObserverKind.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/plugins/eslint-plugin-react-web-api/src/types/Observer/ObserverMethod.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/plugins/eslint-plugin-react-web-api/src/types/Observer/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/plugins/eslint-plugin-react-web-api/src/types/Timer/TimerKind.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/plugins/eslint-plugin-react-web-api/src/types/Timer/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import type { TSESTree } from "@typescript-eslint/types";
44

55
export type EventListenerEntry =
66
| {
7-
kind: "addEventListener";
87
type: TSESTree.Node;
98
node: TSESTree.CallExpression | TSESTree.Identifier;
109
callee: TSESTree.Node;
1110
capture: boolean | unit;
1211
listener: TSESTree.Node;
12+
method: "addEventListener";
1313
signal: TSESTree.Node | unit;
1414
} & SemanticEntry
1515
| {
16-
kind: "removeEventListener";
1716
type: TSESTree.Node;
1817
node: TSESTree.CallExpression | TSESTree.Identifier;
1918
callee: TSESTree.Node;
2019
capture: boolean | unit;
2120
listener: TSESTree.Node;
21+
method: "removeEventListener";
2222
} & SemanticEntry;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export type * from "./EventListener";
2-
export type * from "./Observer";
3-
export type * from "./Timer";
1+
export type * from "./event-listener";
2+
export type * from "./observer";
3+
export type * from "./timer";

0 commit comments

Comments
 (0)