From 272c09513fc02975074166119f18d2ed257d8bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 30 Aug 2018 07:34:17 +0200 Subject: [PATCH] tslint: added a new tslint rule --- package.json | 2 +- .../datasource/prometheus/datasource.ts | 2 +- public/app/plugins/panel/graph/graph.ts | 6 +-- tslint.json | 39 +++++++------------ 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 9cc47ff71b8..87ba147fb4d 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "build": "grunt build", "test": "grunt test", "test:coverage": "grunt test --coverage=true", - "lint": "tslint -c tslint.json --project tsconfig.json --type-check", + "lint": "tslint -c tslint.json --project tsconfig.json", "jest": "jest --notify --watch", "api-tests": "jest --notify --watch --config=tests/api/jest.js", "precommit": "lint-staged && grunt precommit" diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 8cd1abd9ccf..94521e8629e 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -109,7 +109,7 @@ export function determineQueryHints(series: any[], datasource?: any): any[] { } // Check for monotony - const datapoints: [number, number][] = s.datapoints; + const datapoints: number[][] = s.datapoints; if (datapoints.length > 1) { let increasing = false; const monotonic = datapoints.filter(dp => dp[0] !== null).every((dp, index) => { diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 7f9fa0e1693..3aada709484 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -27,11 +27,11 @@ class GraphElement { ctrl: GraphCtrl; tooltip: any; dashboard: any; - annotations: Array; + annotations: object[]; panel: any; plot: any; - sortedSeries: Array; - data: Array; + sortedSeries: any[]; + data: any[]; panelWidth: number; eventManager: EventManager; thresholdManager: ThresholdManager; diff --git a/tslint.json b/tslint.json index a157981e0e7..937089cf01d 100644 --- a/tslint.json +++ b/tslint.json @@ -1,5 +1,6 @@ { "rules": { + "array-type": [true, "array-simple"], "interface-name": [true, "never-prefix"], "no-string-throw": true, "no-unused-expression": true, @@ -19,13 +20,7 @@ "member-access": false, "no-arg": true, "no-bitwise": false, - "no-console": [true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], + "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], "no-construct": true, "no-debugger": true, "no-empty": false, @@ -37,26 +32,20 @@ "no-trailing-whitespace": true, "no-var-keyword": false, "object-literal-sort-keys": false, - "one-line": [true, - "check-open-brace", - "check-catch", - "check-else" - ], + "one-line": [true, "check-open-brace", "check-catch", "check-else"], "prefer-const": true, "radix": false, - "typedef-whitespace": [true, { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], "variable-name": [true, "ban-keywords"], - "whitespace": [true, - "check-branch", - "check-decl", - "check-type", - "check-preblock" - ] + "whitespace": [true, "check-branch", "check-decl", "check-type", "check-preblock"] } }