Skip to content

Commit deb544a

Browse files
authored
Merge pull request #295 from aeisenberg/aeisenberg/lint
lint: Ran the auto-fix command for the linter
2 parents 9ec017a + ebdf576 commit deb544a

18 files changed

+103
-97
lines changed

extensions/ql-vscode/src/archive-filesystem-provider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function encodeSourceArchiveUri(ref: ZipFileReference): vscode.Uri {
9090
});
9191
}
9292

93-
const sourceArchiveUriAuthorityPattern = /^(\d+)\-(\d+)$/;
93+
const sourceArchiveUriAuthorityPattern = /^(\d+)-(\d+)$/;
9494

9595
class InvalidSourceArchiveUriError extends Error {
9696
constructor(uri: vscode.Uri) {
@@ -142,8 +142,8 @@ function ensureDir(map: DirectoryHierarchyMap, dir: string) {
142142
}
143143

144144
type Archive = {
145-
unzipped: unzipper.CentralDirectory,
146-
dirMap: DirectoryHierarchyMap,
145+
unzipped: unzipper.CentralDirectory;
146+
dirMap: DirectoryHierarchyMap;
147147
};
148148

149149
export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
@@ -192,7 +192,7 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
192192

193193
// write operations, all disabled
194194

195-
writeFile(_uri: vscode.Uri, _content: Uint8Array, _options: { create: boolean, overwrite: boolean }): void {
195+
writeFile(_uri: vscode.Uri, _content: Uint8Array, _options: { create: boolean; overwrite: boolean }): void {
196196
throw this.readOnlyError;
197197
}
198198

@@ -257,7 +257,7 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
257257

258258
watch(_resource: vscode.Uri): vscode.Disposable {
259259
// ignore, fires for all changes...
260-
return new vscode.Disposable(() => { });
260+
return new vscode.Disposable(() => { /**/ });
261261
}
262262
}
263263

extensions/ql-vscode/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ export class CodeQLCliServer implements Disposable {
245245
// Report the error (if there is a stderr then use that otherwise just report the error cod or nodejs error)
246246
const newError =
247247
stderrBuffers.length == 0
248-
? new Error(`${description} failed: ${err}`)
249-
: new Error(`${description} failed: ${Buffer.concat(stderrBuffers).toString("utf8")}`);
248+
? new Error(`${description} failed: ${err}`)
249+
: new Error(`${description} failed: ${Buffer.concat(stderrBuffers).toString("utf8")}`);
250250
newError.stack += (err.stack || '');
251251
throw newError;
252252
} finally {

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { clearCacheInDatabase, UserCancellationException } from './run-queries';
99
import * as qsClient from './queryserver-client';
1010
import { upgradeDatabase } from './upgrades';
1111

12-
type ThemableIconPath = { light: string, dark: string } | string;
12+
type ThemableIconPath = { light: string; dark: string } | string;
1313

1414
/**
1515
* Path to icons to display next to currently selected database.

extensions/ql-vscode/src/databases.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import { Logger, logger } from './logging';
2424
* The name of the key in the workspaceState dictionary in which we
2525
* persist the current database across sessions.
2626
*/
27-
const CURRENT_DB: string = 'currentDatabase';
27+
const CURRENT_DB = 'currentDatabase';
2828

2929
/**
3030
* The name of the key in the workspaceState dictionary in which we
3131
* persist the list of databases across sessions.
3232
*/
33-
const DB_LIST: string = 'databaseList';
33+
const DB_LIST = 'databaseList';
3434

3535
export interface DatabaseOptions {
3636
displayName?: string;
@@ -107,8 +107,8 @@ async function findDataset(parentDirectory: string): Promise<vscode.Uri> {
107107
return vscode.Uri.file(dbAbsolutePath);
108108
}
109109

110-
async function findSourceArchive(databasePath: string, silent: boolean = false):
111-
Promise<vscode.Uri | undefined> {
110+
async function findSourceArchive(databasePath: string, silent = false):
111+
Promise<vscode.Uri | undefined> {
112112

113113
const relativePaths = ['src', 'output/src_archive']
114114

@@ -128,8 +128,9 @@ async function findSourceArchive(databasePath: string, silent: boolean = false):
128128
return undefined;
129129
}
130130

131-
async function resolveDatabase(databasePath: string):
132-
Promise<DatabaseContents | undefined> {
131+
async function resolveDatabase(
132+
databasePath: string
133+
): Promise<DatabaseContents | undefined> {
133134

134135
const name = path.basename(databasePath);
135136

@@ -427,7 +428,7 @@ class DatabaseItemImpl implements DatabaseItem {
427428
* `event` fires. If waiting for the event takes too long (by default
428429
* >1000ms) log a warning, and resolve to undefined.
429430
*/
430-
function eventFired<T>(event: vscode.Event<T>, timeoutMs: number = 1000): Promise<T | undefined> {
431+
function eventFired<T>(event: vscode.Event<T>, timeoutMs = 1000): Promise<T | undefined> {
431432
return new Promise((res, _rej) => {
432433
let timeout: NodeJS.Timeout | undefined;
433434
let disposable: vscode.Disposable | undefined;
@@ -436,22 +437,24 @@ function eventFired<T>(event: vscode.Event<T>, timeoutMs: number = 1000): Promis
436437
if (disposable !== undefined) disposable.dispose();
437438
}
438439
disposable = event(e => {
439-
res(e); dispose();
440+
res(e);
441+
dispose();
440442
});
441443
timeout = setTimeout(() => {
442444
logger.log(`Waiting for event ${event} timed out after ${timeoutMs}ms`);
443-
res(undefined); dispose();
445+
res(undefined);
446+
dispose();
444447
}, timeoutMs);
445448
});
446449
}
447450

448451
export class DatabaseManager extends DisposableObject {
449452
private readonly _onDidChangeDatabaseItem =
450-
this.push(new vscode.EventEmitter<DatabaseItem | undefined>());
453+
this.push(new vscode.EventEmitter<DatabaseItem | undefined>());
451454
readonly onDidChangeDatabaseItem = this._onDidChangeDatabaseItem.event;
452455

453456
private readonly _onDidChangeCurrentDatabaseItem =
454-
this.push(new vscode.EventEmitter<DatabaseItem | undefined>());
457+
this.push(new vscode.EventEmitter<DatabaseItem | undefined>());
455458
readonly onDidChangeCurrentDatabaseItem = this._onDidChangeCurrentDatabaseItem.event;
456459

457460
private readonly _databaseItems: DatabaseItemImpl[] = [];
@@ -466,7 +469,7 @@ export class DatabaseManager extends DisposableObject {
466469
}
467470

468471
public async openDatabase(uri: vscode.Uri, options?: DatabaseOptions):
469-
Promise<DatabaseItem> {
472+
Promise<DatabaseItem> {
470473

471474
const contents = await resolveDatabaseContents(uri);
472475
const realOptions = options || {};
@@ -526,7 +529,7 @@ export class DatabaseManager extends DisposableObject {
526529
}
527530

528531
private async createDatabaseItemFromPersistedState(state: PersistedDatabaseItem):
529-
Promise<DatabaseItem> {
532+
Promise<DatabaseItem> {
530533

531534
let displayName: string | undefined = undefined;
532535
let ignoreSourceArchive = false;
@@ -584,7 +587,7 @@ export class DatabaseManager extends DisposableObject {
584587
}
585588

586589
public async setCurrentDatabaseItem(item: DatabaseItem | undefined,
587-
skipRefresh: boolean = false): Promise<void> {
590+
skipRefresh = false): Promise<void> {
588591

589592
if (!skipRefresh && (item !== undefined)) {
590593
await item.refresh(); // Will throw on invalid database.

extensions/ql-vscode/src/helpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export async function showInformationMessageWithAction(message: string, actionMe
131131
/** Gets all active workspace folders that are on the filesystem. */
132132
export function getOnDiskWorkspaceFolders() {
133133
const workspaceFolders = workspace.workspaceFolders || [];
134-
let diskWorkspaceFolders: string[] = [];
134+
const diskWorkspaceFolders: string[] = [];
135135
for (const workspaceFolder of workspaceFolders) {
136136
if (workspaceFolder.uri.scheme === "file")
137137
diskWorkspaceFolders.push(workspaceFolder.uri.fsPath)
@@ -215,15 +215,15 @@ export enum InvocationRateLimiterResultKind {
215215
* The function was invoked and returned the value `result`.
216216
*/
217217
interface InvokedResult<T> {
218-
kind: InvocationRateLimiterResultKind.Invoked,
219-
result: T
218+
kind: InvocationRateLimiterResultKind.Invoked;
219+
result: T;
220220
}
221221

222222
/**
223223
* The function was not invoked as the minimum interval since the last invocation had not elapsed.
224224
*/
225225
interface RateLimitedResult {
226-
kind: InvocationRateLimiterResultKind.RateLimited
226+
kind: InvocationRateLimiterResultKind.RateLimited;
227227
}
228228

229229
type InvocationRateLimiterResult<T> = InvokedResult<T> | RateLimitedResult;

extensions/ql-vscode/src/interface-types.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export interface DatabaseInfo {
1818

1919
/** Arbitrary query metadata */
2020
export interface QueryMetadata {
21-
name?: string,
22-
description?: string,
23-
id?: string,
24-
kind?: string
21+
name?: string;
22+
description?: string;
23+
id?: string;
24+
kind?: string;
2525
}
2626

2727
export interface PreviousExecution {
@@ -70,18 +70,18 @@ export interface SetStateMsg {
7070
sortedResultsMap: SortedResultsMap;
7171
interpretation: undefined | Interpretation;
7272
database: DatabaseInfo;
73-
metadata?: QueryMetadata
73+
metadata?: QueryMetadata;
7474
/**
7575
* Whether to keep displaying the old results while rendering the new results.
7676
*
7777
* This is useful to prevent properties like scroll state being lost when rendering the sorted results after sorting a column.
7878
*/
7979
shouldKeepOldResultsWhileRendering: boolean;
80-
};
80+
}
8181

8282
/** Advance to the next or previous path no in the path viewer */
8383
export interface NavigatePathMsg {
84-
t: 'navigatePath',
84+
t: 'navigatePath';
8585

8686
/** 1 for next, -1 for previous */
8787
direction: number;
@@ -100,20 +100,20 @@ interface ViewSourceFileMsg {
100100
t: 'viewSourceFile';
101101
loc: ResolvableLocationValue;
102102
databaseUri: string;
103-
};
103+
}
104104

105105
interface ToggleDiagnostics {
106106
t: 'toggleDiagnostics';
107107
databaseUri: string;
108-
metadata?: QueryMetadata
108+
metadata?: QueryMetadata;
109109
origResultsPaths: ResultsPaths;
110110
visible: boolean;
111111
kind?: string;
112-
};
112+
}
113113

114114
interface ResultViewLoaded {
115115
t: 'resultViewLoaded';
116-
};
116+
}
117117

118118
export enum SortDirection {
119119
asc, desc

extensions/ql-vscode/src/interface.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ export class InterfaceManager extends DisposableObject {
437437
sourceArchiveUri === undefined
438438
? undefined
439439
: {
440-
sourceArchive: sourceArchiveUri.fsPath,
441-
sourceLocationPrefix
442-
};
440+
sourceArchive: sourceArchiveUri.fsPath,
441+
sourceLocationPrefix
442+
};
443443
interpretation = await this.getTruncatedResults(
444444
query.metadata,
445445
query.resultsPaths,
@@ -471,9 +471,9 @@ export class InterfaceManager extends DisposableObject {
471471
sourceArchiveUri === undefined
472472
? undefined
473473
: {
474-
sourceArchive: sourceArchiveUri.fsPath,
475-
sourceLocationPrefix
476-
};
474+
sourceArchive: sourceArchiveUri.fsPath,
475+
sourceLocationPrefix
476+
};
477477
const interpretation = await this.getTruncatedResults(
478478
metadata,
479479
resultsInfo,

extensions/ql-vscode/src/messages.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,19 @@ export interface QlFileSet {
216216
/**
217217
* The files imported by the given file
218218
*/
219-
imports: { [key: string]: string[]; };
219+
imports: { [key: string]: string[] };
220220
/**
221221
* An id of each file
222222
*/
223-
nodeNumbering: { [key: string]: number; };
223+
nodeNumbering: { [key: string]: number };
224224
/**
225225
* The code for each file
226226
*/
227-
qlCode: { [key: string]: string; };
227+
qlCode: { [key: string]: string };
228228
/**
229229
* The resolution of an import in each directory.
230230
*/
231-
resolvedDirImports: { [key: string]: { [key: string]: string; }; };
231+
resolvedDirImports: { [key: string]: { [key: string]: string } };
232232
}
233233

234234
/**
@@ -313,6 +313,7 @@ export type Severity = number;
313313
* Severity of different messages. This namespace is intentionally not
314314
* an enum, see "for the sake of extensibility" comment above.
315315
*/
316+
// eslint-disable-next-line @typescript-eslint/no-namespace
316317
export namespace Severity {
317318
/**
318319
* The message is a compilation error.
@@ -360,6 +361,7 @@ export type ResultColumnKind = number;
360361
* The kind of a result column. This namespace is intentionally not an enum, see "for the sake of
361362
* extensibility" comment above.
362363
*/
364+
// eslint-disable-next-line @typescript-eslint/no-namespace
363365
export namespace ResultColumnKind {
364366
/**
365367
* A column of type `float`
@@ -635,7 +637,7 @@ export interface EvaluateQueriesParams {
635637
useSequenceHint: boolean;
636638
}
637639

638-
export type TemplateDefinitions = { [key: string]: TemplateSource; }
640+
export type TemplateDefinitions = { [key: string]: TemplateSource }
639641

640642
/**
641643
* A single query that should be run
@@ -748,7 +750,7 @@ export interface ResultSet {
748750
/**
749751
* The type returned when the evaluation is complete
750752
*/
751-
export interface EvaluationComplete { }
753+
export type EvaluationComplete = {};
752754

753755
/**
754756
* The result of a single query
@@ -790,6 +792,7 @@ export type QueryResultType = number;
790792
* The result of running a query. This namespace is intentionally not
791793
* an enum, see "for the sake of extensibility" comment above.
792794
*/
795+
// eslint-disable-next-line @typescript-eslint/no-namespace
793796
export namespace QueryResultType {
794797
/**
795798
* The query ran successfully
@@ -862,11 +865,11 @@ export interface WithProgressId<T> {
862865
/**
863866
* The main body
864867
*/
865-
body: T,
868+
body: T;
866869
/**
867870
* The id used to report progress updates
868871
*/
869-
progressId: number
872+
progressId: number;
870873
}
871874

872875
export interface ProgressMessage {
@@ -935,7 +938,7 @@ export const runUpgrade = new rpc.RequestType<WithProgressId<RunUpgradeParams>,
935938
* Request returned to the client to notify completion of a query.
936939
* The full runQueries job is completed when all queries are acknowledged.
937940
*/
938-
export const completeQuery = new rpc.RequestType<EvaluationResult, Object, void, void>('evaluation/queryCompleted');
941+
export const completeQuery = new rpc.RequestType<EvaluationResult, Record<string, any>, void, void>('evaluation/queryCompleted');
939942

940943
/**
941944
* A notification that the progress has been changed.

extensions/ql-vscode/src/qlpack-discovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Discovery } from './discovery';
66
export interface QLPack {
77
name: string;
88
uri: Uri;
9-
};
9+
}
1010

1111
/**
1212
* Service to discover all available QL packs in a workspace folder.

0 commit comments

Comments
 (0)