Skip to content

Commit

Permalink
Fix eslint/ts warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Apr 30, 2024
1 parent 7ce87e4 commit d4784ae
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 137 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": [
"app/views/misc/mode-regexp.js",
"lib/tmp/jsonxl-snapshot9.js"
],
"rules": {
"@typescript-eslint/no-var-requires": 0,
"no-duplicate-case": 2,
Expand Down
12 changes: 6 additions & 6 deletions app/encodings/v8log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const parsers = {

export async function decode(iterator) {
const meta: Meta = {};
const codes: any[] = [];
const sources: any[] = [];
const ticks: any[] = [];
const memory: any[] = [];
const profiler: any[] = [];
const codes: unknown[] = [];
const sources: unknown[] = [];
const ticks: unknown[] = [];
const memory: unknown[] = [];
const profiler: unknown[] = [];
const ignoredOps = new Set();
const ignoredEntries: any[] = [];
const ignoredEntries: unknown[] = [];
const processLine = (buffer: string, sol: number, eol: number) => {
if (sol >= eol) {
return;
Expand Down
5 changes: 2 additions & 3 deletions app/encodings/v8log/parse-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { CodeState } from './types.js';

const useBigInt = false as const;
export const parseAddress = // useBigInt ? BigInt :
parseInt;
// const useBigInt = false as const;
export const parseAddress = parseInt; // useBigInt ? BigInt : parseInt;

export function parseState(state: string) {
switch (state) {
Expand Down
3 changes: 2 additions & 1 deletion app/prepare/formats/chromium-performance-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
type ChromiumTimeline = {
traceEvents: ChromiumTimelineEvent[]
} & {
[key: string]: any;
[key: string]: unknown;
};

interface ChromiumTimelineEvent {
Expand All @@ -16,6 +16,7 @@ interface ChromiumTimelineEvent {
dur: number;
tdur: number;
tts: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: { [key: string]: any };
id?: string;
}
Expand Down
5 changes: 2 additions & 3 deletions app/prepare/process-paths.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CpuProFunction, CpuProModule, CpuProPackage } from './types';
import { CpuProModule, CpuProPackage } from './types';

function getLongestCommonPath(longestCommonModulePath: string[] | null, modulePath: string) {
let parts = modulePath.split(/\//);
Expand All @@ -22,8 +22,7 @@ function getLongestCommonPath(longestCommonModulePath: string[] | null, modulePa

export function processPaths(
packages: CpuProPackage[],
modules: CpuProModule[],
functions: CpuProFunction[]
modules: CpuProModule[]
) {
// shorthand paths
const longestCommonModulePath: Record<string, string[] | null> = Object.create(null);
Expand Down
6 changes: 3 additions & 3 deletions app/views/flamechart/event-emmiter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
type EventMap = {
[key: string]: (...args: any[]) => void
[key: string]: (...args: unknown[]) => void
};
type Listener<Callback> = {
callback: Callback,
callback: Callback | null,
next: Listener<Callback>
};

Expand Down Expand Up @@ -33,7 +33,7 @@ export class EventEmitter<Events extends EventMap> {

off<E extends keyof Events>(event: E, callback: Events[E]) {
let cursor = this.listeners[event] || null;
let prev = null;
let prev: Listener<Events[E]> | null = null;

// search for a callback and remove it
while (cursor !== null) {
Expand Down
1 change: 1 addition & 0 deletions app/views/flamechart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { generateColorVector, calculateColor } from './color-utils';
import { EventEmitter } from './event-emmiter';

type FrameElement = HTMLElement;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type FrameData = any;
type FrameColorGenerator<T> = (frame: T, colorHue: string | null) => string;
type SetDataOptions = {
Expand Down
Loading

0 comments on commit d4784ae

Please sign in to comment.