Bläddra i källkod

feat(tslint): more tslint work

Torkel Ödegaard 10 år sedan
förälder
incheckning
08caf4bbde

+ 1 - 1
package.json

@@ -70,7 +70,7 @@
     "lodash": "^2.4.1",
     "sinon": "1.16.1",
     "systemjs-builder": "^0.14.15",
-    "tslint": "^3.2.0",
+    "tslint": "^5.2.0",
     "typescript": "^1.7.5"
   }
 }

+ 1 - 1
public/app/features/dashboard/timepicker/timepicker.ts

@@ -2,7 +2,7 @@
 
 import _ from 'lodash';
 import angular from 'angular';
-import moment from 'moment'
+import moment from 'moment';
 
 import * as rangeUtil from 'app/core/utils/rangeutil';
 

+ 0 - 2
public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts

@@ -228,10 +228,8 @@ describe('CloudWatchDatasource', function() {
         switch (params.data.action) {
         case 'DescribeAlarmsForMetric':
           return ctx.$q.when({data: alarmResponse});
-          break;
         case 'DescribeAlarmHistory':
           return ctx.$q.when({data: historyResponse});
-          break;
         }
       };
     });

+ 1 - 6
public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts

@@ -1,5 +1,5 @@
 
-import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
+import {describe, beforeEach, it, expect} from 'test/lib/common';
 import ElasticResponse from '../elastic_response';
 
 describe('ElasticResponse', function() {
@@ -497,11 +497,6 @@ describe('ElasticResponse', function() {
     });
   });
 
-  describe('', function() {
-
-
-  });
-
   describe('Raw documents query', function() {
     beforeEach(function() {
       targets = [{ refId: 'A', metrics: [{type: 'raw_document', id: '1'}], bucketAggs: [] }];

+ 1 - 2
public/app/plugins/datasource/graphite/specs/gfunc_specs.ts

@@ -1,6 +1,5 @@
-///<amd-dependency path="app/plugins/datasource/graphite/gfunc" name="gfunc" />
 
-import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
+import {describe, it, expect} from 'test/lib/common';
 import gfunc from '../gfunc';
 
 describe('when creating func instance from func names', function() {

+ 2 - 5
public/app/plugins/datasource/influxdb/query_part.ts

@@ -126,9 +126,7 @@ function addMathStrategy(selectParts, partModel) {
     if (selectParts[partCount-2].def.type === 'math') {
       selectParts[partCount-2] = partModel;
       return;
-    }
-    // if last is alias add it before
-    else if (selectParts[partCount-1].def.type === 'alias') {
+    } else if (selectParts[partCount-1].def.type === 'alias') { // if last is alias add it before
       selectParts.splice(partCount-1, 0, partModel);
       return;
     }
@@ -399,8 +397,7 @@ class QueryPart {
 
     if (strValue === '' && this.def.params[index].optional) {
       this.params.splice(index, 1);
-    }
-    else {
+    } else {
       this.params[index] = strValue;
     }
 

+ 2 - 3
public/app/plugins/panel/table/renderer.ts

@@ -96,13 +96,12 @@ export class TableRenderer {
   }
 
   renderCell(columnIndex, value, addWidthHack = false) {
-    var value = this.formatColumnValue(columnIndex, value);
+    value = this.formatColumnValue(columnIndex, value);
     var style = '';
     if (this.colorState.cell) {
       style = ' style="background-color:' + this.colorState.cell + ';color: white"';
       this.colorState.cell = null;
-    }
-    else if (this.colorState.value) {
+    } else if (this.colorState.value) {
       style = ' style="color:' + this.colorState.value + '"';
       this.colorState.value = null;
     }

+ 1 - 2
public/app/plugins/panel/table/transformers.ts

@@ -52,8 +52,7 @@ transformers['timeseries_to_columns'] = {
         if (!points[timeKey]) {
           points[timeKey] = {time: dp[1]};
           points[timeKey][i] = dp[0];
-        }
-        else {
+        } else {
           points[timeKey][i] = dp[0];
         }
       }

+ 5 - 10
tslint.json

@@ -4,17 +4,12 @@
     "comment-format": [true, "check-space"],
     "curly": true,
     "eofline": true,
-    "forin": true,
+    "forin": false,
     "indent": [true, "spaces"],
     "label-position": true,
     "label-undefined": true,
     "max-line-length": [true, 140],
     "member-access": false,
-    "member-ordering": [true,
-      "public-before-private",
-      "static-before-instance",
-      "variables-before-functions"
-    ],
     "no-arg": true,
     "no-bitwise": true,
     "no-console": [true,
@@ -31,13 +26,13 @@
     "no-empty": true,
     "no-eval": true,
     "no-inferrable-types": true,
-    "no-shadowed-variable": true,
-    "no-string-literal": true,
+    "no-shadowed-variable": false,
+    "no-string-literal": false,
     "no-switch-case-fall-through": true,
     "no-trailing-comma": true,
     "no-trailing-whitespace": true,
-    "no-unused-expression": true,
-    "no-unused-variable": true,
+    "no-unused-expression": false,
+    "no-unused-variable": false,
     "no-unreachable": true,
     "no-use-before-declare": true,
     "no-var-keyword": false,