Skip to content

Commit

Permalink
Merging support for latest eslint/tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jessehouwing authored Jan 7, 2025
2 parents daa3e70 + 5b11e86 commit 2a2215e
Show file tree
Hide file tree
Showing 46 changed files with 4,007 additions and 3,361 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"uuidv"
],
"eslint.useFlatConfig": true
}
22 changes: 17 additions & 5 deletions BuildTasks/Common/v4/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import * as tl from "azure-pipelines-task-lib/task";
import * as trl from "azure-pipelines-task-lib/toolrunner";
import * as fse from "fs-extra";
import ToolRunner = trl.ToolRunner;
import * as uuidv5 from "uuidv5";
import uuidv5 from "uuidv5";
import * as tmp from "tmp";

function writeBuildTempFile(taskName: string, data: any): string {
function writeBuildTempFile(taskName: string, data: string | Buffer): string {
const tempDir = tl.getVariable("Agent.TempDirectory");
const tempFile = tmp.tmpNameSync({ prefix: taskName, postfix: ".tmp", tmpdir: tempDir });

Expand Down Expand Up @@ -78,11 +78,11 @@ export function validateAndSetTfxManifestArguments(tfx: ToolRunner): (() => void

if (!matchingVsixFile || matchingVsixFile.length === 0) {
tl.setResult(tl.TaskResult.Failed, `Found no vsix files matching: ${vsixFilePattern}.`);
throw "failed";
throw new Error("failed");
}
if (matchingVsixFile.length !== 1) {
tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
throw "failed";
throw new Error("failed");
}
tfx.arg(["--vsix", matchingVsixFile[0]]);
break;
Expand Down Expand Up @@ -293,7 +293,7 @@ export class TfxJsonOutputStream extends stream.Writable {
super();
}

// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
_write(chunk: any, enc: string, cb: (Function)) : void {
const chunkStr: string = chunk.toString();
if (chunkStr.startsWith("[command]"))
Expand Down Expand Up @@ -544,3 +544,15 @@ export function writeManifest(manifest: any, path: string): Promise<void> {
export function checkUpdateTasksManifests(manifestFile?: string): Promise<void> {
return updateManifests(manifestFile ? [manifestFile] : []);
}

export default {
validateAndSetTfxManifestArguments,
runTfx,
getExtensionVersion,
getMarketplaceEndpointDetails,
setTfxMarketplaceArguments,
TfxJsonOutputStream,
updateManifests,
writeManifest,
checkUpdateTasksManifests
};
6 changes: 5 additions & 1 deletion BuildTasks/Common/v4/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"compilerOptions": {
"outDir": "./Common",
"sourceRoot": "./"
}
},
"files": [
"Common.ts",
"uuidv5.d.ts"
]
}
4 changes: 2 additions & 2 deletions BuildTasks/Common/v4/uuidv5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ declare module 'uuidv5' {
createUUIDv5: createUUIDv5;
spaces: space;
}
const exp: createUUIDv5;
export = exp;
const createUUIDv5: createUUIDv5;
export default createUUIDv5;
}
17 changes: 14 additions & 3 deletions BuildTasks/Common/v5/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export function validateAndSetTfxManifestArguments(tfx: ToolRunner): (() => Prom

if (!matchingVsixFile || matchingVsixFile.length === 0) {
tl.setResult(tl.TaskResult.Failed, `Found no vsix files matching: ${vsixFilePattern}.`);
throw "failed";
throw new Error("failed");
}
if (matchingVsixFile.length !== 1) {
tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
throw "failed";
throw new Error("failed");
}
tfx.arg(["--vsix", matchingVsixFile[0]]);
break;
Expand Down Expand Up @@ -305,7 +305,6 @@ export class TfxJsonOutputStream extends stream.Writable {
super();
}

// eslint-disable-next-line @typescript-eslint/ban-types
_write(chunk: any, enc: string, cb: (Function)): void {
const chunkStr: string = chunk.toString();
if (chunkStr.startsWith("[command]")) {
Expand Down Expand Up @@ -553,3 +552,15 @@ export function writeManifest(manifest: any, path: string): Promise<void> {
export function checkUpdateTasksManifests(manifestFile?: string): Promise<void> {
return updateManifests(manifestFile ? [manifestFile] : []);
}

export default {
validateAndSetTfxManifestArguments,
runTfx,
getExtensionVersion,
getMarketplaceEndpointDetails,
setTfxMarketplaceArguments,
TfxJsonOutputStream,
updateManifests,
writeManifest,
checkUpdateTasksManifests
};
Loading

0 comments on commit 2a2215e

Please sign in to comment.