Automatically fix ESLint violations

This commit is contained in:
Koen Vlaswinkel
2023-12-11 17:00:16 +01:00
parent 7f332e3374
commit 01085e75ba
15 changed files with 42 additions and 53 deletions

View File

@@ -195,9 +195,8 @@ export class DistributionManager implements DistributionProvider {
if (process.env.PATH) {
for (const searchDirectory of process.env.PATH.split(delimiter)) {
const expectedLauncherPath = await getExecutableFromDirectory(
searchDirectory,
);
const expectedLauncherPath =
await getExecutableFromDirectory(searchDirectory);
if (expectedLauncherPath) {
return {
codeQlPath: expectedLauncherPath,

View File

@@ -1,11 +1,11 @@
export type DeepReadonly<T> = T extends Array<infer R>
? DeepReadonlyArray<R>
: // eslint-disable-next-line @typescript-eslint/ban-types
T extends Function
? T
: T extends object
? DeepReadonlyObject<T>
: T;
T extends Function
? T
: T extends object
? DeepReadonlyObject<T>
: T;
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}

View File

@@ -232,14 +232,14 @@ export function parseHighlightedLine(
const highlightStartColumn = isSingleLineHighlight
? highlightedRegion.startColumn
: isFirstHighlightedLine
? highlightedRegion.startColumn
: 0;
? highlightedRegion.startColumn
: 0;
const highlightEndColumn = isSingleLineHighlight
? highlightedRegion.endColumn
: isLastHighlightedLine
? highlightedRegion.endColumn
: line.length + 1;
? highlightedRegion.endColumn
: line.length + 1;
const plainSection1 = line.substring(0, highlightStartColumn - 1);
const highlightedSection = line.substring(

View File

@@ -162,8 +162,8 @@ export class ExtensionTelemetryListener
const status = !error
? CommandCompletion.Success
: error instanceof UserCancellationException
? CommandCompletion.Cancelled
: CommandCompletion.Failed;
? CommandCompletion.Cancelled
: CommandCompletion.Failed;
this.reporter.sendTelemetryEvent(
"command-usage",

View File

@@ -424,9 +424,8 @@ export class DatabaseManager extends DisposableObject {
step: ++step,
});
const databaseItem = await this.createDatabaseItemFromPersistedState(
database,
);
const databaseItem =
await this.createDatabaseItemFromPersistedState(database);
try {
await this.refreshDatabase(databaseItem);
await this.registerDatabase(databaseItem);

View File

@@ -542,8 +542,8 @@ async function installOrUpdateDistribution(
const messageText = willUpdateCodeQl
? "Updating CodeQL CLI"
: codeQlInstalled
? "Checking for updates to CodeQL CLI"
: "Installing CodeQL CLI";
? "Checking for updates to CodeQL CLI"
: "Installing CodeQL CLI";
try {
await installOrUpdateDistributionWithProgressTitle(
@@ -564,8 +564,8 @@ async function installOrUpdateDistribution(
willUpdateCodeQl
? "update"
: codeQlInstalled
? "check for updates to"
: "install"
? "check for updates to"
: "install"
} CodeQL CLI`;
if (e instanceof GithubRateLimitedError) {

View File

@@ -106,9 +106,9 @@ function sortInterpretedResults(
a.message.text === undefined
? 0
: b.message.text === undefined
? 0
: multiplier *
a.message.text?.localeCompare(b.message.text, env.language),
? 0
: multiplier *
a.message.text?.localeCompare(b.message.text, env.language),
);
break;
default:

View File

@@ -507,9 +507,8 @@ export class SkeletonQueryWizard {
): Promise<DatabaseItem | undefined> {
const defaultDatabaseNwo = QUERY_LANGUAGE_TO_DATABASE_REPO[language];
const dbItems = await SkeletonQueryWizard.sortDatabaseItemsByDateAdded(
databaseItems,
);
const dbItems =
await SkeletonQueryWizard.sortDatabaseItemsByDateAdded(databaseItems);
const defaultDatabaseItem = await SkeletonQueryWizard.findDatabaseItemByNwo(
language,

View File

@@ -85,9 +85,8 @@ export async function runAutoModelQueries({
// CodeQL needs to have access to the database to be able to retrieve the
// snippets from it. The source location prefix is used to determine the
// base path of the database.
const sourceLocationPrefix = await databaseItem.getSourceLocationPrefix(
cliServer,
);
const sourceLocationPrefix =
await databaseItem.getSourceLocationPrefix(cliServer);
const sourceArchiveUri = databaseItem.sourceArchive;
const sourceInfo =
sourceArchiveUri === undefined

View File

@@ -482,9 +482,8 @@ export class ModelEditorView extends AbstractWebview<
// In application mode, we need the database of a specific library to generate
// the modeled methods. In framework mode, we'll use the current database.
if (mode === Mode.Application) {
addedDatabase = await this.promptChooseNewOrExistingDatabase(
progress,
);
addedDatabase =
await this.promptChooseNewOrExistingDatabase(progress);
if (!addedDatabase) {
return;
}
@@ -562,9 +561,8 @@ export class ModelEditorView extends AbstractWebview<
private async modelDependency(): Promise<void> {
return withProgress(async (progress, token) => {
const addedDatabase = await this.promptChooseNewOrExistingDatabase(
progress,
);
const addedDatabase =
await this.promptChooseNewOrExistingDatabase(progress);
if (!addedDatabase || token.isCancellationRequested) {
return;
}

View File

@@ -239,8 +239,8 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
const state = event.pass
? "passed"
: event.messages?.length
? "errored"
: "failed";
? "errored"
: "failed";
let message: string | undefined;
if (event.failureDescription || event.diff?.length) {
message =

View File

@@ -45,9 +45,8 @@ export async function exportVariantAnalysisResults(
): Promise<void> {
await withProgress(
async (progress: ProgressCallback, token: CancellationToken) => {
const variantAnalysis = await variantAnalysisManager.getVariantAnalysis(
variantAnalysisId,
);
const variantAnalysis =
await variantAnalysisManager.getVariantAnalysis(variantAnalysisId);
if (!variantAnalysis) {
void extLogger.log(
`Could not find variant analysis with id ${variantAnalysisId}`,
@@ -61,9 +60,8 @@ export async function exportVariantAnalysisResults(
throw new UserCancellationException("Cancelled");
}
const repoStates = await variantAnalysisManager.getRepoStates(
variantAnalysisId,
);
const repoStates =
await variantAnalysisManager.getRepoStates(variantAnalysisId);
void extLogger.log(
`Exporting variant analysis results for variant analysis with id ${variantAnalysis.id}`,

View File

@@ -183,9 +183,8 @@ async function copyExistingQueryPack(
if (
await cliServer.cliConstraints.supportsGenerateExtensiblePredicateMetadata()
) {
const metadata = await cliServer.generateExtensiblePredicateMetadata(
originalPackRoot,
);
const metadata =
await cliServer.generateExtensiblePredicateMetadata(originalPackRoot);
metadata.extensible_predicates.forEach((predicate) => {
if (predicate.path.endsWith(".ql")) {
toCopy.push(join(originalPackRoot, predicate.path));

View File

@@ -21,9 +21,8 @@ export const createVariantAnalysisContentProvider = (
}
const variantAnalysisId = parseInt(variantAnalysisIdString);
const variantAnalysis = await variantAnalysisManager.getVariantAnalysis(
variantAnalysisId,
);
const variantAnalysis =
await variantAnalysisManager.getVariantAnalysis(variantAnalysisId);
if (!variantAnalysis) {
void showAndLogWarningMessage(
extLogger,

View File

@@ -180,9 +180,8 @@ export class VariantAnalysisResultsManager extends DisposableObject {
repositoryFullName,
);
const repoTask: VariantAnalysisRepositoryTask = await readRepoTask(
storageDirectory,
);
const repoTask: VariantAnalysisRepositoryTask =
await readRepoTask(storageDirectory);
if (!repoTask.databaseCommitSha || !repoTask.sourceLocationPrefix) {
throw new Error("Missing database commit SHA");