Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions apex-log-parser/src/ApexLogParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ export class ApexLogParser {

const hascrlf = log.indexOf('\r\n', startIndex) > -1;
let lastEntry = null;
let lfIndex = null;
let eolIndex = (lfIndex = log.indexOf('\n', startIndex));
let lfIndex = log.indexOf('\n', startIndex);
let eolIndex = lfIndex;
let crlfIndex = -1;

while (eolIndex !== -1) {
Expand Down
1 change: 1 addition & 0 deletions apex-log-parser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export interface SelfTotal {
total: number;
}

// eslint-disable-next-line no-useless-assignment -- only read in a type position (LogEventType above), which the rule's runtime scope analysis can't see
const _logEventNames = [
'ADD_SCREEN_POP_ACTION',
'ADD_SKILL_REQUIREMENT_ACTION',
Expand Down
65 changes: 50 additions & 15 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,60 @@
import eslint from '@eslint/js';
import { defineConfig, globalIgnores } from 'eslint/config';
import prettierConfig from 'eslint-config-prettier/flat';
import tseslint from 'typescript-eslint';

import tsParser from '@typescript-eslint/parser';
import prettierConfig from 'eslint-config-prettier';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
prettierConfig,
export default defineConfig(
globalIgnores([
'**/.sf/',
'**/.sfdx/',
'**/dist/',
'**/build/',
'**/out/',
'**/coverage/',
'**/.docusaurus/',
// only TypeScript is linted; without this, `eslint .` selects js/mjs/cjs
// by default and scans them with no rules
'**/*.js',
'**/*.mjs',
'**/*.cjs',
]),
{
ignores: ['**/node_modules', '**/.sf', '**/.sfdx'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
files: ['**/*.ts'],
extends: [eslint.configs.recommended, tseslint.configs.recommended, prettierConfig],

rules: {
'no-console': 'warn',
'@typescript-eslint/naming-convention': 'warn',
semi: 'warn',
'@typescript-eslint/naming-convention': [
'warn',
// options replace the rule's defaults, so the base selectors are restated
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{ selector: 'import', format: ['camelCase', 'PascalCase'] },
{ selector: 'typeLike', format: ['PascalCase'] },
// PascalCase consts: enum-like objects (TimelineErrorCode) and vscode API
// mocks (Uri); allowSingleOrDouble covers __dirname
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allow',
},
// UPPER_CASE static readonly class constants (MAX_CACHE_SIZE, DRAG_THRESHOLD)
{
selector: 'classProperty',
modifiers: ['static', 'readonly'],
format: ['camelCase', 'UPPER_CASE'],
},
// object keys mirror external data: Salesforce API fields, Apex log
// event/category names, module paths, ANTLR rule names
{ selector: ['objectLiteralProperty', 'objectLiteralMethod'], format: null },
// quoted type keys, e.g. 'context-menu' in HTMLElementTagNameMap
{ selector: 'typeProperty', modifiers: ['requiresQuotes'], format: null },
],

'@typescript-eslint/no-unused-vars': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion lana-docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const config: Config = {
{
href: `https://github.com/${organizationName}/${projectName}`,
position: 'right',
'aria-label': 'GitHub Repository', // eslint-disable-line @typescript-eslint/naming-convention
'aria-label': 'GitHub Repository',
className: 'header-github-link',
},
],
Expand Down
6 changes: 3 additions & 3 deletions lana/src/__tests__/mocks/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ export const window = {
dispose: jest.fn(),
})),
setStatusBarMessage: jest.fn(() => ({ dispose: jest.fn() })),
withProgress: jest.fn((options, task) => task({ report: jest.fn() })),
withProgress: jest.fn((_options, task) => task({ report: jest.fn() })),
};

// Mock commands
export const commands = {
registerCommand: jest.fn((command: string, callback: (...args: unknown[]) => unknown) => {
registerCommand: jest.fn((_command: string, _callback: (...args: unknown[]) => unknown) => {
const disposable = { dispose: jest.fn() };
subscriptions.push(disposable);
return disposable;
Expand All @@ -340,7 +340,7 @@ export const commands = {

// Mock languages
export const languages = {
registerFoldingRangeProvider: jest.fn((selector, provider) => {
registerFoldingRangeProvider: jest.fn((_selector, _provider) => {
const disposable = { dispose: jest.fn() };
subscriptions.push(disposable);
return disposable;
Expand Down
4 changes: 2 additions & 2 deletions lana/src/commands/ShowInLogAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ShowInLogAnalysis {
return;
}

let panel = LogView.getCurrentView();
const panel = LogView.getCurrentView();
const logPath = LogView.getLogPath();

// If panel doesn't exist, open the log analysis view first
Expand All @@ -44,7 +44,7 @@ export class ShowInLogAnalysis {

// Set pending navigation so it's sent after log is parsed
LogView.setPendingNavigation(timestamp);
panel = await LogView.createView(context, Promise.resolve(), logFilePath);
await LogView.createView(context, Promise.resolve(), logFilePath);
return; // Navigation will happen via fetchLog payload
} else {
// Panel exists - reveal it first
Expand Down
2 changes: 1 addition & 1 deletion lana/src/salesforce/codesymbol/SymbolFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class SymbolFinder {
*/
async findSymbol(workspaces: VSWorkspace[], symbol: string): Promise<string[]> {
// Dynamic import for code splitting. Improves performance by reducing the amount of JS that is loaded and parsed at the start.
// eslint-disable-next-line @typescript-eslint/naming-convention

const { Workspaces } = await import('@apexdevtools/apex-ls');
const paths = [];
for (const ws of workspaces) {
Expand Down
2 changes: 1 addition & 1 deletion lana/src/salesforce/logs/GetLogFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class GetLogFile {
const connection = await getSalesforceConnection(wsPath);

// Dynamic import for code splitting. Improves performance by reducing the amount of JS that is loaded and parsed at the start.
// eslint-disable-next-line @typescript-eslint/naming-convention

const { LogService } = await import('@salesforce/apex-node');
await new LogService(connection).getLogs({ logId: logId, outputDir: logDir });
}
Expand Down
2 changes: 1 addition & 1 deletion lana/src/salesforce/logs/GetLogFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GetLogFiles {
const connection = await getSalesforceConnection(wsPath);

// Dynamic import for code splitting. Improves performance by reducing the amount of JS that is loaded and parsed at the start.
// eslint-disable-next-line @typescript-eslint/naming-convention

const { LogService } = await import('@salesforce/apex-node');
return new LogService(connection).getLogRecords();
}
Expand Down
2 changes: 1 addition & 1 deletion lana/src/salesforce/logs/SalesforceConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function getSalesforceConnection(wsPath: string): Promise<Connectio
setupPinoBundlerPaths();

// Dynamic import for code splitting. Improves performance by reducing the amount of JS that is loaded and parsed at the start.
// eslint-disable-next-line @typescript-eslint/naming-convention

const { ConfigAggregator, OrgConfigProperties, Org } = await import('@salesforce/core');

const aggregator = await ConfigAggregator.create({ projectPath: wsPath });
Expand Down
2 changes: 1 addition & 1 deletion log-viewer/src/core/events/EventBus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

interface EventMap {
// Supply eventIndex (preferred β€” unique) OR timestamp (fallback for raw-log entry where eventIndex isn't known).
// eslint-disable-next-line @typescript-eslint/naming-convention

'timeline:navigate-to':
| { eventIndex: number; timestamp?: never }
| { eventIndex?: never; timestamp: number };
Expand Down
4 changes: 2 additions & 2 deletions log-viewer/src/core/messaging/VSCodeExtensionMessenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export class VSCodeExtensionMessenger {
public request<T>(message: string, payload?: T): Promise<T> {
const reqId = crypto.randomUUID();
return new Promise((resolve, reject) => {
const listener = (incomingPayload: any, error: unknown) => {
const listener = (incomingPayload: unknown, error: unknown) => {
if (error) {
reject(error);
} else {
resolve(incomingPayload);
resolve(incomingPayload as T);
}
VSCodeExtensionMessenger.listeners.delete(reqId);
};
Expand Down
2 changes: 0 additions & 2 deletions log-viewer/src/features/call-tree/utils/CategoryColoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { addCustomThemes, getTheme } from '../../timeline/themes/ThemeSelector.j

// Maps a LogEvent.category string to its TimelineColors key, so a row can point at the
// matching `--ct-color-<key>` host variable. Single source of truth for the set.
/* eslint-disable @typescript-eslint/naming-convention */
const CATEGORY_THEME_VAR: Readonly<Record<string, keyof TimelineColors>> = {
Apex: 'apex',
System: 'system',
Expand All @@ -31,7 +30,6 @@ const CATEGORY_THEME_VAR: Readonly<Record<string, keyof TimelineColors>> = {
Validation: 'validation',
Callout: 'callout',
};
/* eslint-enable @typescript-eslint/naming-convention */

export const categoryColoringStyles = css`
.tabulator-row .datagrid-code-text {
Expand Down
22 changes: 11 additions & 11 deletions log-viewer/src/features/soql/services/SOQLParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@ export class SOQLTree {
isSimpleSelect(): boolean {
const selectList = this._queryContext.selectList();
const selectEntries = selectList.selectEntry_list();
return selectEntries.every((selectEntry) => selectEntry.fieldName() != null);
return selectEntries.every((selectEntry) => selectEntry.fieldName() !== null);
}

/* Return true for queries only containing WHERE, ORDER BY & LIMIT clauses */
isTrivialQuery(): boolean {
return (
this._queryContext.usingScope() == null &&
this._queryContext.withClause() == null &&
this._queryContext.groupByClause() == null &&
this._queryContext.offsetClause() == null &&
this._queryContext.allRowsClause() == null &&
this._queryContext.usingScope() === null &&
this._queryContext.withClause() === null &&
this._queryContext.groupByClause() === null &&
this._queryContext.offsetClause() === null &&
this._queryContext.allRowsClause() === null &&
this._queryContext.forClauses().getChildCount() === 0 &&
this._queryContext.updateList() == null
this._queryContext.updateList() === null
);
}

/* Return true if query has ORDER BY */
isOrdered(): boolean {
return this._queryContext.orderByClause() != null;
return this._queryContext.orderByClause() !== null;
}

/* Return limit value if defined, maybe a number or a bound expression */
limitValue(): number | string | undefined {
const limitClause = this._queryContext.limitClause();
if (limitClause == null) {
if (limitClause === null) {
return undefined;
} else if (limitClause.IntegerLiteral() != null) {
} else if (limitClause.IntegerLiteral() !== null) {
return parseInt(limitClause.IntegerLiteral()?.getText() as string);
} else {
return limitClause.boundExpression()?.getText() as string;
Expand All @@ -66,7 +66,7 @@ export class SOQLTree {
export class SOQLParser {
async parse(query: string): Promise<SOQLTree> {
// Dynamic import for code splitting. Improves performance by reducing the amount of JS that is loaded and parsed at the start.
// eslint-disable-next-line @typescript-eslint/naming-convention

const { ApexParserFactory, ApexErrorListener } = await import('@apexdevtools/apex-parser');

class ThrowingErrorListener extends ApexErrorListener {
Expand Down
4 changes: 2 additions & 2 deletions log-viewer/src/features/timeline/__tests__/markers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ jest.mock('pixi.js', () => {
const actual = jest.requireActual('pixi.js');
return {
...(actual as Record<string, unknown>),
// eslint-disable-next-line @typescript-eslint/naming-convention

Sprite: jest.fn().mockImplementation(() => {
const mock = new MockSprite();
createdMockSpritesGlobal.push(mock);
return mock;
}),
// eslint-disable-next-line @typescript-eslint/naming-convention

Texture: {
WHITE: {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export class ApexLogTimeline {
private themeToColors(themeName: string) {
const theme = getTheme(themeName);
// Convert TimelineColors keys to the format expected by FlameChart
/* eslint-disable @typescript-eslint/naming-convention */

return {
Apex: theme.apex,
'Code Unit': theme.codeUnit,
Expand All @@ -372,7 +372,6 @@ export class ApexLogTimeline {
Callout: theme.callout,
Validation: theme.validation,
};
/* eslint-enable @typescript-eslint/naming-convention */
}

// ============================================================================
Expand Down
2 changes: 0 additions & 2 deletions log-viewer/src/features/timeline/services/Timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const keyMap: Map<string, TimelineGroup> = new Map([
['SOQL', { label: 'SOQL', fillColor: '#6D4C7D' }],
]);

/* eslint-disable @typescript-eslint/naming-convention */
const LEGACY_CATEGORY_MAP: Record<string, string> = {
Apex: 'Method',
'Code Unit': 'Code Unit',
Expand All @@ -57,7 +56,6 @@ const LEGACY_CATEGORY_MAP: Record<string, string> = {
Callout: 'Method',
Validation: 'System Method',
};
/* eslint-enable @typescript-eslint/naming-convention */

class State {
public isRedrawQueued = true;
Expand Down
Loading
Loading