From 1c671e0653fe61999598c4bc0c0507f6363f6651 Mon Sep 17 00:00:00 2001 From: Ivan Jobs Date: Thu, 21 May 2020 10:28:33 +0800 Subject: [PATCH] chore: open explicit-any check, add suppress annotations for special cases --- .eslintrc.json | 1 - src/common/telemetryClient.ts | 1 + src/common/utility.ts | 1 + src/intelliSense/digitalTwinGraph.ts | 4 ++++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8538628..97b709e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,7 +21,6 @@ "prettier/prettier": ["error", {"printWidth": 120}], "max-len": ["error", {"code": 120, "ignorePattern": "^import\\s.+\\sfrom\\s.+;$", "ignoreStrings": true}], "@typescript-eslint/no-empty-function": ["error", { "allow": ["constructors"] }], - "@typescript-eslint/no-explicit-any": "off", "object-curly-spacing": ["error", "always"] } } diff --git a/src/common/telemetryClient.ts b/src/common/telemetryClient.ts index fb9f09c..7e11252 100644 --- a/src/common/telemetryClient.ts +++ b/src/common/telemetryClient.ts @@ -17,6 +17,7 @@ export class TelemetryClient { * check if it is a valid package json * @param packageJSON package json */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any private static isValidPackageJSON(packageJSON: any): boolean { return packageJSON.name && packageJSON.publisher && packageJSON.version && packageJSON.aiKey; } diff --git a/src/common/utility.ts b/src/common/utility.ts index 098ae77..e2404b2 100644 --- a/src/common/utility.ts +++ b/src/common/utility.ts @@ -51,6 +51,7 @@ export class Utility { * get json content from file * @param filePath file path */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any public static async getJsonContent(filePath: string): Promise { return fs.readJson(filePath, { encoding: Constants.UTF8 }); } diff --git a/src/intelliSense/digitalTwinGraph.ts b/src/intelliSense/digitalTwinGraph.ts index d1250f6..388bced 100644 --- a/src/intelliSense/digitalTwinGraph.ts +++ b/src/intelliSense/digitalTwinGraph.ts @@ -101,6 +101,7 @@ export class DigitalTwinGraph { * @param context extension context * @param fileName file name */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any private static async resolveDefinition(context: vscode.ExtensionContext, fileName: string): Promise { const filePath: string = context.asAbsolutePath( path.join(Constants.RESOURCE_FOLDER, Constants.DEFINITION_FOLDER, fileName) @@ -112,6 +113,7 @@ export class DigitalTwinGraph { * check if it is a valid node * @param node node */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any private static isValidNode(node: any): boolean { return node.id && node.name; } @@ -284,6 +286,7 @@ export class DigitalTwinGraph { * build DigitalTwin graph * @param graphJson json object of graph definition */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any private buildGraph(graphJson: any): void { this.parse(graphJson); this.inheritProperties(); @@ -295,6 +298,7 @@ export class DigitalTwinGraph { * parse content of graph json * @param graphJson json object of graph definition */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any private parse(graphJson: any): void { for (const key in graphJson) { if (graphJson.hasOwnProperty(key)) {