Browse Source

tslint: added a new tslint rule

Torkel Ödegaard 7 years ago
parent
commit
272c09513f

+ 1 - 1
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"

+ 1 - 1
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) => {

+ 3 - 3
public/app/plugins/panel/graph/graph.ts

@@ -27,11 +27,11 @@ class GraphElement {
   ctrl: GraphCtrl;
   tooltip: any;
   dashboard: any;
-  annotations: Array<object>;
+  annotations: object[];
   panel: any;
   plot: any;
-  sortedSeries: Array<any>;
-  data: Array<any>;
+  sortedSeries: any[];
+  data: any[];
   panelWidth: number;
   eventManager: EventManager;
   thresholdManager: ThresholdManager;

+ 14 - 25
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"]
   }
 }