Skip to content

Commit

Permalink
Eslint checks (#123)
Browse files Browse the repository at this point in the history
* fix @typescript-eslint/no-unsafe-argument
fix
 "@typescript-eslint/no-unsafe-member-access

* fix @typescript-eslint/restrict-plus-operands

* switch back to Buffer.toString()
  • Loading branch information
jmue authored Sep 6, 2022
1 parent 20a156f commit c298feb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/consistent-generic-constructors": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/unbound-method": "error",
"curly": "error",
"eqeqeq": "warn",
Expand Down
9 changes: 5 additions & 4 deletions src/ccScmProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { Lock } from "./lock";
import { fromCcUri } from "./uri";

import * as path from "path";
import { getErrorMessage } from "./errormessage";

const localize: LocalizeFunc = loadMessageBundle();

Expand Down Expand Up @@ -64,7 +65,7 @@ export class CCScmProvider {
private mDisposables: Disposable[],
private outputChannel: OutputChannel,
private configHandler: CCConfigHandler
) {}
) { }

async init(): Promise<boolean> {
this.mListLock = new Lock(1);
Expand Down Expand Up @@ -233,7 +234,7 @@ export class CCScmProvider {
}
}
} catch (error) {
this.outputChannel.appendLine("Clearcase error: getVersionInformation: " + error);
this.outputChannel.appendLine("Clearcase error: getVersionInformation: " + getErrorMessage(error));
}
}
this.mListLock?.release();
Expand Down Expand Up @@ -664,14 +665,14 @@ export class CCScmProvider {
try {
version = (await this.clearCase?.getVersionInformation(event.document.uri)) ?? "";
} catch (error) {
this.outputChannel.appendLine("Clearcase error: getVersionInformation: " + error);
this.outputChannel.appendLine("Clearcase error: getVersionInformation: " + getErrorMessage(error));
}
if (version === "") {
this.handleChangeFiles(event.document.uri);
}
}
} catch (error) {
console.log("error " + error);
console.log("error " + getErrorMessage(error));
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/clearcase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class ClearCase {
try {
await this.runCleartoolCommand(cmd, dirname(path), null, () => this.mUpdateEvent.fire(doc));
} catch (error) {
this.outputChannel.appendLine("Clearcase error: runCleartoolCommand: " + error);
this.outputChannel.appendLine("Clearcase error: runCleartoolCommand: " + getErrorMessage(error));
return false;
}
return true;
Expand Down Expand Up @@ -882,7 +882,7 @@ export class ClearCase {

const outputChannel = this.outputChannel;
const isView = this.isView;

return new Promise<void>((resolve, reject) => {
let cmdErrMsg = "";

Expand All @@ -896,21 +896,21 @@ export class ClearCase {
if (typeof data === "string") {
res = data;
allDataStr += data;
} else {
} else if (Buffer.isBuffer(data)) {
allData = Buffer.concat([allData, data], allData.length + data.length);
res = JSON.stringify(data);
res = data.toString();
}
if (onData !== null && typeof onData === "function") {
onData(res.split(/\r\n|\r|\n/).filter((s: string) => s.length > 0));
}
});

command.stderr.on("data", (data) => {
let msg: string;
let msg = "";
if (typeof data === "string") {
msg = data;
} else {
msg = JSON.stringify(data);
} else if (Buffer.isBuffer(data)) {
msg = data.toString();
}
if (onError !== undefined && typeof onError === "function") {
onError(msg);
Expand Down

0 comments on commit c298feb

Please sign in to comment.