Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update typescript eslint to v8 #561

Merged
merged 11 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '20.'
cache: 'pnpm'
- name: Install Packages
run: HUSKY=0 pnpm install
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
48 changes: 48 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["**/node_modules"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},

rules: {
"no-console": "warn",
"@typescript-eslint/naming-convention": "warn",
semi: "warn",

"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
}],

"@typescript-eslint/no-explicit-any": "warn",
curly: "warn",
eqeqeq: "warn",
},
}];
1 change: 1 addition & 0 deletions lana-docs-site/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const config: Config = {
},

future: {
// eslint-disable-next-line @typescript-eslint/naming-convention
experimental_faster: true,
},

Expand Down
4 changes: 2 additions & 2 deletions lana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@
"devDependencies": {
"@types/node": "~18.15.13",
"@types/vscode": "~1.74.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"typescript": "^5.7.2"
}
}
10 changes: 6 additions & 4 deletions log-viewer/modules/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ export default function formatDuration(duration: number) {
return `${millis}.${micros}ms`;
}

export function debounce(callBack: void) {
export function debounce<T extends unknown[]>(callBack: (...args: T) => unknown) {
if (requestId) {
window.cancelAnimationFrame(requestId);
}

requestId = window.requestAnimationFrame(() => {
callBack;
});
return (...args: T) => {
requestId = window.requestAnimationFrame(() => {
callBack(...args);
});
};
}
4 changes: 3 additions & 1 deletion log-viewer/modules/components/database-view/DMLView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ export class DMLView extends LitElement {
if (!group.isVisible()) {
this.dmlTable?.blockRedraw();
this.dmlTable?.getRows().forEach((row) => {
!row.isTreeExpanded() && row.treeExpand();
if (!row.isTreeExpanded()) {
row.treeExpand();
}
});
this.dmlTable?.restoreRedraw();
}
Expand Down
4 changes: 3 additions & 1 deletion log-viewer/modules/components/database-view/SOQLView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ export class SOQLView extends LitElement {
if (!group.isVisible()) {
this.soqlTable?.blockRedraw();
this.soqlTable?.getRows().forEach((row) => {
!row.isTreeExpanded() && row.treeExpand();
if (!row.isTreeExpanded()) {
row.treeExpand();
}
});
this.soqlTable?.restoreRedraw();
}
Expand Down
8 changes: 6 additions & 2 deletions log-viewer/modules/components/find-widget/FindWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export class FindWidget extends LitElement {
if (e.key === 'f' && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
e.preventDefault();

!this.isVisble && !this.totalMatches && this._triggerFind();
if (!this.isVisble && !this.totalMatches) {
this._triggerFind();
}
this._findInputClick();
return;
}
Expand All @@ -268,8 +270,10 @@ export class FindWidget extends LitElement {
case 'Enter': {
if (this._hasMatchValueChanged() || !this.totalMatches) {
this._triggerFind();
} else if (this.nextMatchDirection) {
this._nextMatch();
} else {
this.nextMatchDirection ? this._nextMatch() : this._previousMatch();
this._previousMatch();
}
break;
}
Expand Down
4 changes: 3 additions & 1 deletion log-viewer/modules/datagrid/module/RowKeyboardNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class RowKeyboardNavigation extends Module {
this.tableHolder ??= table.element.querySelector('.tabulator-tableholder') as HTMLElement;

const selectedRow = table.getSelectedRows()[0];
!selectedRow && row.select();
if (!selectedRow) {
row.select();
}
this.tableHolder?.focus();
}

Expand Down
12 changes: 9 additions & 3 deletions log-viewer/modules/datagrid/module/RowNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ export class RowNavigation extends Module {
row.select();
table.restoreRedraw();

focusRow && this.tableHolder.focus();
row && setTimeout(() => this._scrollToRow(row, opts));
if (focusRow) {
this.tableHolder.focus();
}
if (row) {
setTimeout(() => this._scrollToRow(row, opts));
}
}
}

Expand All @@ -64,7 +68,9 @@ export class RowNavigation extends Module {
elem.scrollIntoView({ behavior: 'auto', block: 'center', inline: 'start' });
}

focusRow && elem.focus();
if (focusRow) {
elem.focus();
}
});
});
}
Expand Down
8 changes: 5 additions & 3 deletions log-viewer/modules/parsers/ApexLogParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export class ApexLogParser {
lastEntry.text += '\n' + line;
} else if (hasType) {
const message = `Unsupported log event name: ${type}`;
!this.parsingErrors.includes(message) && this.parsingErrors.push(message);
if (!this.parsingErrors.includes(message)) {
this.parsingErrors.push(message);
}
} else if (lastEntry && line.startsWith('*** Skipped')) {
this.addLogIssue(
lastEntry.timestamp,
Expand Down Expand Up @@ -2782,7 +2784,7 @@ const basicExitLogEvents: LogEventType[] = [
'SESSION_CACHE_REMOVE_END',
];

const logEventNames = [
const _logEventNames = [
'BULK_DML_RETRY',
'BULK_HEAP_ALLOCATE',
'CALLOUT_REQUEST',
Expand Down Expand Up @@ -3036,6 +3038,6 @@ const logEventNames = [
'SESSION_CACHE_REMOVE_END',
] as const;

export type LogEventType = (typeof logEventNames)[number];
export type LogEventType = (typeof _logEventNames)[number];

export { DMLBeginLine, SOQLExecuteBeginLine, SOQLExecuteExplainLine };
7 changes: 4 additions & 3 deletions log-viewer/modules/timeline/Timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ function onMouseMove(evt: MouseEvent) {
if (clRect) {
lastMouseX = evt.clientX - clRect.left;
lastMouseY = evt.clientY - clRect.top;
debounce(showTooltip(lastMouseX, lastMouseY, false));
debounce(showTooltip)(lastMouseX, lastMouseY, false);
}
}
}
Expand Down Expand Up @@ -865,7 +865,7 @@ function handleMouseDown(): void {

function handleMouseUp(): void {
stopDragging();
debounce(showTooltip(lastMouseX, lastMouseY, false));
debounce(showTooltip)(lastMouseX, lastMouseY, false);
}

function stopDragging() {
Expand Down Expand Up @@ -912,7 +912,8 @@ function handleScroll(evt: WheelEvent) {
const maxWidth = state.zoom * timelineRoot.exitStamp - displayWidth;
state.offsetX = Math.max(0, Math.min(maxWidth, state.offsetX + deltaX));
}
debounce(showTooltip(lastMouseX, lastMouseY, false));

debounce(showTooltip)(lastMouseX, lastMouseY, false);
}
}

Expand Down
5 changes: 2 additions & 3 deletions log-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
},
"devDependencies": {
"@types/tabulator-tables": "^6.2.3",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"concurrently": "^9.1.0",
"http-server": "^14.1.1",
"node-sass": "^9.0.0",
"postcss": "^8.4.49",
"sass": "^1.78.0",
"typescript": "^5.7.2"
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "lana-ws",
"private": true,
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.17.0",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.0",
Expand All @@ -10,9 +12,10 @@
"@swc/helpers": "^0.5.15",
"@swc/jest": "^0.2.37",
"@types/jest": "^29.5.14",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"concurrently": "^9.1.0",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
Expand All @@ -34,7 +37,7 @@
"build:dev": "rm -rf lana/out && concurrently -r -g 'rollup -c rollup.config.mjs' 'tsc --noemit --skipLibCheck -p log-viewer/tsconfig.json' 'tsc --noemit --skipLibCheck -p lana/tsconfig.json'",
"watch": "rm -rf lana/out && rollup -w -c rollup.config.mjs",
"prepare": "husky",
"lint": "concurrently -r -g 'eslint . --ext ts' 'prettier --cache **/*.{ts,css,md,scss} --check' 'tsc --noemit --skipLibCheck -p log-viewer/tsconfig.json' 'tsc --noemit --skipLibCheck -p lana/tsconfig.json'",
"lint": "concurrently -r -g \"eslint '**/*.ts/'\" \"prettier --cache **/*.{ts,css,md,scss} --check\" \"tsc --noemit --skipLibCheck -p log-viewer/tsconfig.json\" \"tsc --noemit --skipLibCheck -p lana/tsconfig.json\"",
"test": "jest",
"test:ci": "jest --runInBand",
"prettier-format": "prettier '**/*.ts' --cache --write"
Expand Down
Loading
Loading