Skip to content

Commit

Permalink
fix doc lint & lock
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Oct 14, 2024
1 parent 7bb6ff8 commit ea77328
Show file tree
Hide file tree
Showing 22 changed files with 3,905 additions and 3,910 deletions.
10 changes: 1 addition & 9 deletions packages/@ember/debug/ember-inspector-support/adapters/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { onReady } from '../utils/on-ready';
export default class BasicAdapter extends BaseObject {
private _messageCallbacks: any[] = [];
private __environment = '';
interval: number | undefined;
declare interval: number | undefined;
init() {
Promise.resolve(this.connect()).then(() => {
this.onConnectionReady();
Expand All @@ -18,9 +18,6 @@ export default class BasicAdapter extends BaseObject {
/**
* Uses the current build's config module to determine
* the environment.
*
* @property environment
* @type {String}
*/
get environment() {
if (!this.__environment) {
Expand All @@ -40,7 +37,6 @@ export default class BasicAdapter extends BaseObject {
/**
* A wrapper for `console.warn`.
*
* @method warn
*/
warn(...args: any[]) {
return console.warn(...args);
Expand Down Expand Up @@ -91,8 +87,6 @@ export default class BasicAdapter extends BaseObject {
* The idea is to control errors triggered by the inspector
* and make sure that users don't get mislead by inspector-caused
* bugs.
*
* @method handleError
* @param {Error} error
*/
handleError(error: any) {
Expand All @@ -115,8 +109,6 @@ export default class BasicAdapter extends BaseObject {
A promise that resolves when the connection
with the inspector is set up and ready.
@return {Promise}
*/
connect() {
return new Promise((resolve, reject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import BasicAdapter from './basic';
import { run } from '@ember/runloop';

export default class WebExtension extends BasicAdapter {
declare private _channel: MessageChannel;
declare private _chromePort: MessagePort;
private declare _channel: MessageChannel;
private declare _chromePort: MessagePort;
init() {
this._channel = new MessageChannel();
this._chromePort = this._channel?.port1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type SourceMapSupport from '@ember/debug/ember-inspector-support/libs/sou

export default class DeprecationDebug extends DebugPort {
declare options: any;
declare private _warned: boolean;
private declare _warned: boolean;
declare debounce: any;
declare private _watching: any;
private declare _watching: any;
declare deprecationsToSend: {
stackStr: string;
message: string;
Expand All @@ -19,10 +19,10 @@ export default class DeprecationDebug extends DebugPort {
id: string;
sources: any[];
}[];
declare private sourceMap: SourceMapSupport;
private declare sourceMap: SourceMapSupport;
declare groupedDeprecations: any;
declare deprecations: any;
declare private __emberCliConfig: any;
private declare __emberCliConfig: any;
static {
this.prototype.portNamespace = 'deprecation';
this.prototype.sourceMap = new SourceMap();
Expand Down
10 changes: 0 additions & 10 deletions packages/@ember/debug/ember-inspector-support/general-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ export default class GeneralDebug extends DebugPort {
* Contains ember-cli configuration info.
*
* Info used to determine the file paths of an ember-cli app.
*
* @return {Object}
* {String} environment ex: 'development'
* {String} modulePrefix ex: 'my-app'
* {String} podModulePrefix ex: 'my-app/pods'
* {Boolean} usePodsByDefault
*/
emberCliConfig = this.getAppConfig();

Expand Down Expand Up @@ -130,10 +124,6 @@ export default class GeneralDebug extends DebugPort {

/**
* Finds a meta tag by searching through a certain meta attribute.
*
* @param {String} attribute
* @param {RegExp} regExp
* @return {Element}
*/
function findMetaTag(attribute: string, regExp = /.*/) {
let metas = document.querySelectorAll(`meta[${attribute}]`);
Expand Down
16 changes: 0 additions & 16 deletions packages/@ember/debug/ember-inspector-support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ function loadEmberDebug(
/**
* Get all the Ember.Application instances from Ember.Namespace.NAMESPACES
* and add our own applicationId and applicationName to them
* @return {*}
*/
function getApplications() {
let namespaces = A(Namespace.NAMESPACES);
Expand Down Expand Up @@ -250,10 +249,6 @@ function loadEmberDebug(
/**
* Checks if a version is between two different versions.
* version should be >= left side, < right side
*
* @param {String} version1
* @param {String} version2
* @return {Boolean}
*/
function versionTest(version: string, between: [string, string]) {
let fromVersion = between[0];
Expand All @@ -272,10 +267,6 @@ function loadEmberDebug(
* `-1` if version1 < version
* 0 if version1 == version2
* 1 if version1 > version2
*
* @param {String} version1
* @param {String} version2
* @return {Boolean} result of the comparison
*/
function compareVersion(version1: string, version2: string) {
let compared, i;
Expand All @@ -292,19 +283,12 @@ function loadEmberDebug(

/**
* Remove -alpha, -beta, etc from versions
*
* @param {String} version
* @return {String} The cleaned up version
*/
function cleanupVersion(version: string) {
return version.replace(/-.*/g, '');
}

/**
* @method compare
* @param {Number} val
* @param {Number} number
* @return {Number}
* 0: same
* -1: <
* 1: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export type PromiseChainedEvent = {
class PromiseAssembler extends Evented.extend(BaseObject) {
// RSVP lib to debug
isStarted = false;
RSVP: any;
all!: any[];
promiseIndex!: Record<string, number>;
declare RSVP: any;
declare all: any[];
declare promiseIndex: Record<string, number>;
promiseChained: ((e: any) => void) | null = null;
promiseRejected: ((e: any) => void) | null = null;
promiseFulfilled: ((e: any) => void) | null = null;
Expand Down
38 changes: 13 additions & 25 deletions packages/@ember/debug/ember-inspector-support/libs/render-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,22 @@ class InElementSupportProvider {
}

export default class RenderTree {
tree!: CapturedRenderNode[];
owner: any;
retainObject: any;
releaseObject: any;
inspectNode: (node: Node) => void;
renderNodeIdPrefix: string;
nodes!: Record<string, CapturedRenderNode>;
serialized!: Record<string, any>;
ranges!: Record<string, Range | null | undefined>;
parentNodes: any;
previouslyRetainedObjects: any;
retainedObjects: any;
inElementSupport: InElementSupportProvider | undefined;
declare tree: CapturedRenderNode[];
declare owner: any;
declare retainObject: any;
declare releaseObject: any;
declare inspectNode: (node: Node) => void;
declare renderNodeIdPrefix: string;
declare nodes: Record<string, CapturedRenderNode>;
declare serialized: Record<string, any>;
declare ranges: Record<string, Range | null | undefined>;
declare parentNodes: any;
declare previouslyRetainedObjects: any;
declare retainedObjects: any;
declare inElementSupport: InElementSupportProvider | undefined;
/**
* Sets up the initial options.
*
* @method constructor
* @param {Object} options
* - {owner} owner The Ember app's owner.
* - {Function} retainObject Called to retain an object for future inspection.
Expand Down Expand Up @@ -201,9 +200,6 @@ export default class RenderTree {
* bounds: Option<'single' | 'range'>;
* children: SerializedRenderNode[];
* }
*
* @method build
* @return {Array<SerializedRenderNode>} The render nodes tree.
*/
build() {
this._reset();
Expand All @@ -218,9 +214,6 @@ export default class RenderTree {

/**
* Find a render node by id.
*
* @param {string} id A render node id.
* @return {Option<SerializedRenderNode>} A render node with the given id, if any.
*/
find(id: string): CapturedRenderNode | null {
let node = this.nodes[id];
Expand All @@ -235,7 +228,6 @@ export default class RenderTree {
/**
* Find the deepest enclosing render node for a given DOM node.
*
* @method findNearest
* @param {Node} node A DOM node.
* @param {string} hint The id of the last-matched render node (see comment below).
* @return {Option<SerializedRenderNode>} The deepest enclosing render node, if any.
Expand Down Expand Up @@ -280,7 +272,6 @@ export default class RenderTree {
/**
* Get the bounding rect for a given render node id.
*
* @method getBoundingClientRect
* @param {*} id A render node id.
* @return {Option<DOMRect>} The bounding rect, if the render node is found and has valid `bounds`.
*/
Expand Down Expand Up @@ -315,7 +306,6 @@ export default class RenderTree {
/**
* Get the DOM range for a give render node id.
*
* @method getRange
* @param {string} id A render node id.
* @return {Option<Range>} The DOM range, if the render node is found and has valid `bounds`.
*/
Expand Down Expand Up @@ -343,7 +333,6 @@ export default class RenderTree {
/**
* Scroll the given render node id into view (if the render node is found and has valid `bounds`).
*
* @method scrollIntoView
* @param {string} id A render node id.
*/
scrollIntoView(id: string) {
Expand All @@ -368,7 +357,6 @@ export default class RenderTree {
* Inspect the bounds for the given render node id in the "Elements" panel (if the render node
* is found and has valid `bounds`).
*
* @method inspectElement
* @param {string} id A render node id.
*/
inspectElement(id: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SourceMapConsumer } from 'source-map-js';
const notFoundError = new Error('Source map url not found');

export default class SourceMapSupport extends BaseObject {
private _lastPromise!: Promise<any>;
private declare _lastPromise: Promise<any>;
init() {
super.init();
this._lastPromise = Promise.resolve(undefined);
Expand All @@ -12,9 +12,6 @@ export default class SourceMapSupport extends BaseObject {
/**
* Returns a promise that resolves to an array
* of mapped sourcew.
*
* @param {String} stack The stack trace
* @return {RSVP.Promise}
*/
map(stack: string): Promise<any> {
let parsed = fromStackProperty(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,23 @@ function makeStylesheet(id: string) {
}

export default class ViewInspection {
renderTree: RenderTree;
objectInspector: ObjectInspector;
private didShow: (id: string, pin: boolean) => void;
private didHide: (id: string, pinned: boolean) => void;
private didStartInspecting: () => void;
private didStopInspecting: () => void;
private id: string;
private currentId: string | null;
private lastMatchId: string | null;
private isInspecting: boolean;
private lastTarget: EventTarget | null;
private isShowing: boolean;
private isPinned: boolean;

private highlight!: HTMLElement;
private tooltip!: HTMLElement;
private stylesheet!: HTMLElement;
declare renderTree: RenderTree;
declare objectInspector: ObjectInspector;
private declare didShow: (id: string, pin: boolean) => void;
private declare didHide: (id: string, pinned: boolean) => void;
private declare didStartInspecting: () => void;
private declare didStopInspecting: () => void;
private declare id: string;
private declare currentId: string | null;
private declare lastMatchId: string | null;
private declare isInspecting: boolean;
private declare lastTarget: EventTarget | null;
private declare isShowing: boolean;
private declare isPinned: boolean;

private declare highlight: HTMLElement;
private declare tooltip: HTMLElement;
private declare stylesheet: HTMLElement;
constructor({
renderTree,
objectInspector,
Expand Down
3 changes: 0 additions & 3 deletions packages/@ember/debug/ember-inspector-support/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class EmberDebug extends BaseObject {
/**
* We use the application's id instead of the owner's id so that we use the same inspector
* instance for the same application even if it was reset (owner changes on reset).
*
* @property applicationId
* @type {String}
*/
get applicationId() {
if (!this.isTesting) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ type Highlight = {
*/
export default class ProfileManager {
profiles: ProfileNode[] = [];
current: ProfileNode | undefined;
queue: Info[];
highlights: Highlight[];
currentSet: ProfileNode[];
private _profilesAddedCallbacks: { context: any; callback: Function }[];
shouldHighlightRender: boolean;
isHighlightEnabled: boolean;
stylesheet: HTMLStyleElement;
declare current: ProfileNode | undefined;
declare queue: Info[];
declare highlights: Highlight[];
declare currentSet: ProfileNode[];
private declare _profilesAddedCallbacks: { context: any; callback: Function }[];
declare shouldHighlightRender: boolean;
declare isHighlightEnabled: boolean;
declare stylesheet: HTMLStyleElement;
constructor() {
this.currentSet = [];
this._profilesAddedCallbacks = [];
Expand Down Expand Up @@ -150,8 +150,6 @@ export default class ProfileManager {

/**
* Push a new profile into the queue
* @param info
* @return {number}
*/
addToQueue(info: Info) {
const index = this.queue.push(info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export type Payload = {

class ProfileNode {
isHighlightEnabled = true;
time!: number;
start: number;
timestamp: any;
viewGuid: string | undefined;
name: string;
parent: ProfileNode | undefined;
children: ProfileNode[];
duration: number | undefined;
declare time: number;
declare start: number;
declare timestamp: any;
declare viewGuid: string | undefined;
declare name: string;
declare parent: ProfileNode | undefined;
declare children: ProfileNode[];
declare duration: number | undefined;
constructor(start: number, payload: Payload, parent?: ProfileNode, now?: number) {
let name;
this.start = start;
Expand Down
Loading

0 comments on commit ea77328

Please sign in to comment.