Skip to content

Commit d396b27

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[eslint] Enable @typescript-eslint/consistent-generic-constructors
Bug: 397260638 Change-Id: Id9eb30ea776f9b4bb05dc6a095ff24d1c742b89c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6279125 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]>
1 parent f1b287d commit d396b27

File tree

104 files changed

+208
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+208
-216
lines changed

eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ export default [
502502
// certain TypeScript compilation errors after fixes
503503
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
504504

505+
'@typescript-eslint/consistent-generic-constructors': [
506+
'error',
507+
'constructor',
508+
],
509+
505510
'rulesdir/no-underscored-properties': 'error',
506511
'rulesdir/inline-type-imports': 'error',
507512

extensions/cxx_debugging/src/CustomFormatters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ function lazyObjectFromAny(
506506

507507
export class LazyObjectStore {
508508
private nextObjectId: number = 0;
509-
private objects: Map<string, LazyObject> = new Map();
509+
private objects = new Map<string, LazyObject>();
510510

511511
store(lazyObject: LazyObject): string {
512512
const objectId = `${this.nextObjectId++}`;
@@ -646,7 +646,7 @@ export class DebuggerProxy {
646646
}
647647

648648
export class CustomFormatters {
649-
private static formatters: Map<string, Formatter> = new Map();
649+
private static formatters = new Map<string, Formatter>();
650650
private static genericFormatters: Formatter[] = [];
651651

652652
static addFormatter(formatter: Formatter): void {

extensions/cxx_debugging/src/WorkerRPC.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ export class WorkerRPC<LocalInterface extends Record<string, any>, RemoteInterfa
7979
private nextRequestId = 0;
8080
private readonly channel: Channel<LocalInterface, RemoteInterface>;
8181
private readonly localHandler: LocalInterface;
82-
private readonly requests: Map<number, {resolve: (params: unknown) => void, reject: (message: Error) => void}> =
83-
new Map();
82+
private readonly requests = new Map<number, {resolve: (params: unknown) => void, reject: (message: Error) => void}>();
8483
private readonly semaphore: Int32Array;
8584

8685
constructor(channel: Channel<LocalInterface, RemoteInterface>, localHandler: LocalInterface) {

extensions/cxx_debugging/tests/RealBackend.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ export class Debugger {
4949
private readonly targetId: string;
5050
private connected: boolean;
5151
private readonly queue: string[];
52-
private readonly callbacks: Map<number, {
52+
private readonly callbacks = new Map<number, {
5353
method: string,
5454
resolve: (r: ProtocolMapping.Commands[keyof ProtocolMapping.Commands]['returnType']) => unknown,
5555
reject: (r: unknown) => unknown,
56-
}> = new Map();
56+
}>();
5757
// eslint-disable-next-line @typescript-eslint/no-explicit-any
58-
private readonly eventHandlers: Map<string, Set<Handler<any>>> = new Map();
58+
private readonly eventHandlers = new Map<string, Set<Handler<any>>>();
5959
private nextMessageId = 0;
60-
private readonly scripts: Map<string, Protocol.Debugger.ScriptParsedEvent> = new Map();
61-
private readonly scriptsById: Map<string, Protocol.Debugger.ScriptParsedEvent> = new Map();
60+
private readonly scripts = new Map<string, Protocol.Debugger.ScriptParsedEvent>();
61+
private readonly scriptsById = new Map<string, Protocol.Debugger.ScriptParsedEvent>();
6262
private nextStopId = 0n;
6363
private waitForPauseQueue: Array<{resolve: (pauseLocation: PauseLocation) => void}> = [];
6464
private pauseLocation?: PauseLocation;

front_end/core/common/ResolverBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface PromiseInfo<T> {
1616
* promises by using the `clear` method on this class.
1717
*/
1818
export abstract class ResolverBase<Id, T> {
19-
#unresolvedIds: Map<Id, PromiseInfo<T>> = new Map();
19+
#unresolvedIds = new Map<Id, PromiseInfo<T>>();
2020

2121
protected abstract getForId(id: Id): T|null;
2222
protected abstract startListening(): void;

front_end/core/protocol_client/InspectorBackend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ interface CallbackWithDebugInfo {
100100
}
101101

102102
export class InspectorBackend {
103-
readonly agentPrototypes: Map<ProtocolDomainName, AgentPrototype> = new Map();
103+
readonly agentPrototypes = new Map<ProtocolDomainName, AgentPrototype>();
104104
#initialized: boolean = false;
105105
#eventParameterNamesForDomain = new Map<ProtocolDomainName, EventParameterNames>();
106106
readonly typeMap = new Map<QualifiedName, CommandParameter[]>();

front_end/core/sdk/CSSPropertyParserMatchers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class LinkableNameMatcher extends matcherBase(LinkableNameMatch) {
452452
return names.includes(propertyName);
453453
}
454454

455-
static readonly identifierAnimationLonghandMap: Map<string, AnimationLonghandPart> = new Map(
455+
static readonly identifierAnimationLonghandMap = new Map<string, AnimationLonghandPart>(
456456
Object.entries({
457457
normal: AnimationLonghandPart.DIRECTION,
458458
alternate: AnimationLonghandPart.DIRECTION,

front_end/core/sdk/ChildTargetManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
3131
readonly #targetManager: TargetManager;
3232
#parentTarget: Target;
3333
readonly #targetAgent: ProtocolProxyApi.TargetApi;
34-
readonly #targetInfosInternal: Map<Protocol.Target.TargetID, Protocol.Target.TargetInfo> = new Map();
35-
readonly #childTargetsBySessionId: Map<Protocol.Target.SessionID, Target> = new Map();
36-
readonly #childTargetsById: Map<Protocol.Target.TargetID|'main', Target> = new Map();
37-
readonly #parallelConnections: Map<string, ProtocolClient.InspectorBackend.Connection> = new Map();
34+
readonly #targetInfosInternal = new Map<Protocol.Target.TargetID, Protocol.Target.TargetInfo>();
35+
readonly #childTargetsBySessionId = new Map<Protocol.Target.SessionID, Target>();
36+
readonly #childTargetsById = new Map<Protocol.Target.TargetID|'main', Target>();
37+
readonly #parallelConnections = new Map<string, ProtocolClient.InspectorBackend.Connection>();
3838
#parentTargetId: Protocol.Target.TargetID|null = null;
3939

4040
constructor(parentTarget: Target) {

front_end/core/sdk/DOMModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ export class DOMDocument extends DOMNode {
11341134

11351135
export class DOMModel extends SDKModel<EventTypes> {
11361136
agent: ProtocolProxyApi.DOMApi;
1137-
idToDOMNode: Map<Protocol.DOM.NodeId, DOMNode> = new Map();
1137+
idToDOMNode = new Map<Protocol.DOM.NodeId, DOMNode>();
11381138
#document: DOMDocument|null;
11391139
readonly #attributeLoadNodeIds: Set<Protocol.DOM.NodeId>;
11401140
readonly runtimeModelInternal: RuntimeModel;

front_end/core/sdk/FrameManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
3535
creationStackTrace?: Protocol.Runtime.StackTrace,
3636
creationStackTraceTarget?: Target,
3737
}>();
38-
#awaitedFrames: Map<string, Array<{notInTarget?: Target, resolve: (frame: ResourceTreeFrame) => void}>> = new Map();
38+
#awaitedFrames = new Map<string, Array<{notInTarget?: Target, resolve: (frame: ResourceTreeFrame) => void}>>();
3939

4040
constructor() {
4141
super();

0 commit comments

Comments
 (0)