Files
react-native-devtools-frontend/front_end/testing/LanguagePluginHelpers.ts
T
Benedikt Meurer 84b0fcc58c [eslint] Replace prefer-readonly-keyword with @typescript-eslint/array-type.
We had our own homegrown ESLint rule that was trying to enforce some
consistency around `ReadonlyArray<T>` vs. `readonly T[]`, but that was
fairly limited and still allowed for `Array<T>` vs `T[]` with no shared
discipline.

We now use the `@typescript-eslint/array-type` rule instead and enforce
that for simple types the `T[]` (and `readonly T[]`) syntax is used,
while for complex types the `Array<A & B>` (and `ReadonlyArray<A & B>`)
syntax is used.

Bug: none
Change-Id: I8933869f98577d4afc4141c5736fccb2159924a6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6257990
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-02-12 07:40:43 -08:00

92 lines
2.7 KiB
TypeScript

// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import type {Chrome} from '../../extension-api/ExtensionAPI.js';
import * as Platform from '../core/platform/platform.js';
import type * as SDK from '../core/sdk/sdk.js';
import type * as Bindings from '../models/bindings/bindings.js';
const {urlString} = Platform.DevToolsPath;
export class TestPlugin implements Bindings.DebuggerLanguagePlugins.DebuggerLanguagePlugin {
constructor(name: string) {
this.name = name;
}
name: string;
handleScript(_script: SDK.Script.Script): boolean {
return false;
}
createPageResourceLoadInitiator(): SDK.PageResourceLoader.PageResourceLoadInitiator {
const extensionId = 'chrome-extension-id';
return {
target: null,
frameId: null,
extensionId,
initiatorUrl: urlString`${extensionId}`,
};
}
async evaluate(
_expression: string, _context: Chrome.DevTools.RawLocation,
_stopId: Bindings.DebuggerLanguagePlugins.StopId): Promise<Chrome.DevTools.RemoteObject|null> {
return null;
}
async getProperties(_objectId: string): Promise<Chrome.DevTools.PropertyDescriptor[]> {
return [];
}
async releaseObject(_objectId: string): Promise<void> {
}
async addRawModule(_rawModuleId: string, _symbolsURL: string, _rawModule: Chrome.DevTools.RawModule):
Promise<string[]> {
return [];
}
async sourceLocationToRawLocation(_sourceLocation: Chrome.DevTools.SourceLocation):
Promise<Chrome.DevTools.RawLocationRange[]> {
return [];
}
async rawLocationToSourceLocation(_rawLocation: Chrome.DevTools.RawLocation):
Promise<Chrome.DevTools.SourceLocation[]> {
return [];
}
async getScopeInfo(type: string): Promise<Chrome.DevTools.ScopeInfo> {
return {type, typeName: type};
}
async listVariablesInScope(_rawLocation: Chrome.DevTools.RawLocation): Promise<Chrome.DevTools.Variable[]> {
return [];
}
async removeRawModule(_rawModuleId: string): Promise<void> {
}
async getFunctionInfo(_rawLocation: Chrome.DevTools.RawLocation): Promise<{
frames: Chrome.DevTools.FunctionInfo[],
missingSymbolFiles: string[],
}|{frames: Chrome.DevTools.FunctionInfo[]}|{missingSymbolFiles: string[]}> {
return {frames: []};
}
async getInlinedFunctionRanges(_rawLocation: Chrome.DevTools.RawLocation):
Promise<Chrome.DevTools.RawLocationRange[]> {
return [];
}
async getInlinedCalleesRanges(_rawLocation: Chrome.DevTools.RawLocation):
Promise<Chrome.DevTools.RawLocationRange[]> {
return [];
}
async getMappedLines(_rawModuleId: string, _sourceFileURL: string): Promise<number[]|undefined> {
return undefined;
}
}