diff --git a/public/app/containers/Explore/TimePicker.tsx b/public/app/containers/Explore/TimePicker.tsx index 3ae4ea4a83c..08867f8d0fc 100644 --- a/public/app/containers/Explore/TimePicker.tsx +++ b/public/app/containers/Explore/TimePicker.tsx @@ -16,7 +16,7 @@ export function parseTime(value, isUtc = false, asString = false) { return value; } if (!isNaN(value)) { - const epoch = parseInt(value); + const epoch = parseInt(value, 10); const m = isUtc ? moment.utc(epoch) : moment(epoch); return asString ? m.format(DATE_FORMAT) : m; } diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 852e2ed3c50..484dd0e3327 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -111,7 +111,7 @@ export function describeTextRange(expr: any) { const parts = /^now([-+])(\d+)(\w)/.exec(expr); if (parts) { const unit = parts[3]; - const amount = parseInt(parts[2]); + const amount = parseInt(parts[2], 10); const span = spans[unit]; if (span) { opt.display = isLast ? 'Last ' : 'Next '; diff --git a/public/app/features/dashboard/time_srv.ts b/public/app/features/dashboard/time_srv.ts index 4bd78ce776d..dd5a0ba758f 100644 --- a/public/app/features/dashboard/time_srv.ts +++ b/public/app/features/dashboard/time_srv.ts @@ -70,7 +70,7 @@ export class TimeSrv { } if (!isNaN(value)) { - const epoch = parseInt(value); + const epoch = parseInt(value, 10); return moment.utc(epoch); } diff --git a/public/app/features/dashboard/view_state_srv.ts b/public/app/features/dashboard/view_state_srv.ts index 521de4ecbad..d9ad6827567 100644 --- a/public/app/features/dashboard/view_state_srv.ts +++ b/public/app/features/dashboard/view_state_srv.ts @@ -49,7 +49,7 @@ export class DashboardViewState { getQueryStringState() { const state = this.$location.search(); - state.panelId = parseInt(state.panelId) || null; + state.panelId = parseInt(state.panelId, 10) || null; state.fullscreen = state.fullscreen ? true : null; state.edit = state.edit === 'true' || state.edit === true || null; state.editview = state.editview || null; diff --git a/public/app/features/panel/solo_panel_ctrl.ts b/public/app/features/panel/solo_panel_ctrl.ts index 0e45fe48c4d..15d35188d6d 100644 --- a/public/app/features/panel/solo_panel_ctrl.ts +++ b/public/app/features/panel/solo_panel_ctrl.ts @@ -12,7 +12,7 @@ export class SoloPanelCtrl { appEvents.emit('toggle-sidemenu-hidden'); const params = $location.search(); - panelId = parseInt(params.panelId); + panelId = parseInt(params.panelId, 10); $scope.onAppEvent('dashboard-initialized', $scope.initPanelScope); diff --git a/public/app/features/playlist/playlist_edit_ctrl.ts b/public/app/features/playlist/playlist_edit_ctrl.ts index 3c81aff1093..16da9a0a209 100644 --- a/public/app/features/playlist/playlist_edit_ctrl.ts +++ b/public/app/features/playlist/playlist_edit_ctrl.ts @@ -37,7 +37,7 @@ export class PlaylistEditCtrl { filterFoundPlaylistItems() { this.filteredDashboards = _.reject(this.dashboardresult, playlistItem => { return _.find(this.playlistItems, listPlaylistItem => { - return parseInt(listPlaylistItem.value) === playlistItem.id; + return parseInt(listPlaylistItem.value, 10) === playlistItem.id; }); }); diff --git a/public/app/plugins/datasource/elasticsearch/bucket_agg.ts b/public/app/plugins/datasource/elasticsearch/bucket_agg.ts index e17a34778ee..8963f2c3f4b 100644 --- a/public/app/plugins/datasource/elasticsearch/bucket_agg.ts +++ b/public/app/plugins/datasource/elasticsearch/bucket_agg.ts @@ -208,7 +208,7 @@ export class ElasticBucketAggCtrl { const id = _.reduce( $scope.target.bucketAggs.concat($scope.target.metrics), (max, val) => { - return parseInt(val.id) > max ? parseInt(val.id) : max; + return parseInt(val.id, 10) > max ? parseInt(val.id, 10) : max; }, 0 ); diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.ts b/public/app/plugins/datasource/elasticsearch/metric_agg.ts index 7e5300b43e1..623eed68914 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.ts +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.ts @@ -177,7 +177,7 @@ export class ElasticMetricAggCtrl { const id = _.reduce( $scope.target.bucketAggs.concat($scope.target.metrics), (max, val) => { - return parseInt(val.id) > max ? parseInt(val.id) : max; + return parseInt(val.id, 10) > max ? parseInt(val.id, 10) : max; }, 0 ); diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index ec995de630a..5ffbf7cf418 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -314,7 +314,7 @@ export default class InfluxDatasource { const parts = /^now-(\d+)([d|h|m|s])$/.exec(date); if (parts) { - const amount = parseInt(parts[1]); + const amount = parseInt(parts[1], 10); const unit = parts[2]; return 'now() - ' + amount + unit; } diff --git a/public/app/plugins/datasource/opentsdb/datasource.ts b/public/app/plugins/datasource/opentsdb/datasource.ts index 08bd1585b42..7cb0806359d 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.ts +++ b/public/app/plugins/datasource/opentsdb/datasource.ts @@ -408,11 +408,11 @@ export default class OpenTsDatasource { }; if (target.counterMax && target.counterMax.length) { - query.rateOptions.counterMax = parseInt(target.counterMax); + query.rateOptions.counterMax = parseInt(target.counterMax, 10); } if (target.counterResetValue && target.counterResetValue.length) { - query.rateOptions.resetValue = parseInt(target.counterResetValue); + query.rateOptions.resetValue = parseInt(target.counterResetValue, 10); } if (tsdbVersion >= 2) { diff --git a/public/app/plugins/datasource/prometheus/result_transformer.ts b/public/app/plugins/datasource/prometheus/result_transformer.ts index 96b8e0d4137..bf916bebf04 100644 --- a/public/app/plugins/datasource/prometheus/result_transformer.ts +++ b/public/app/plugins/datasource/prometheus/result_transformer.ts @@ -37,7 +37,7 @@ export class ResultTransformer { metricLabel = this.createMetricLabel(metricData.metric, options); - const stepMs = parseInt(options.step) * 1000; + const stepMs = parseInt(options.step, 10) * 1000; let baseTimestamp = start * 1000; if (metricData.values === undefined) { diff --git a/public/app/plugins/panel/graph/threshold_manager.ts b/public/app/plugins/panel/graph/threshold_manager.ts index 46ec9e61854..e7d874e7451 100644 --- a/public/app/plugins/panel/graph/threshold_manager.ts +++ b/public/app/plugins/panel/graph/threshold_manager.ts @@ -53,7 +53,7 @@ export class ThresholdManager { function stopped() { // calculate graph level let graphValue = plot.c2p({ left: 0, top: posTop }).y; - graphValue = parseInt(graphValue.toFixed(0)); + graphValue = parseInt(graphValue.toFixed(0), 10); model.value = graphValue; handleElem.off('mousemove', dragging); diff --git a/public/app/plugins/panel/heatmap/heatmap_data_converter.ts b/public/app/plugins/panel/heatmap/heatmap_data_converter.ts index 68ab6fee92f..99b61be40dc 100644 --- a/public/app/plugins/panel/heatmap/heatmap_data_converter.ts +++ b/public/app/plugins/panel/heatmap/heatmap_data_converter.ts @@ -271,7 +271,7 @@ function pushToYBuckets(buckets, bucketNum, value, point, bounds) { let count = 1; // Use the 3rd argument as scale/count if (point.length > 3) { - count = parseInt(point[2]); + count = parseInt(point[2], 10); } if (buckets[bucketNum]) { buckets[bucketNum].values.push(value); diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index fe79b5f5043..b10eb68b87e 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -493,7 +493,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { const bgColor = config.bootData.user.lightTheme ? 'rgb(230,230,230)' : 'rgb(38,38,38)'; - const fontScale = parseInt(panel.valueFontSize) / 100; + const fontScale = parseInt(panel.valueFontSize, 10) / 100; const fontSize = Math.min(dimension / 5, 100) * fontScale; // Reduce gauge width if threshold labels enabled const gaugeWidthReduceRatio = panel.gauge.thresholdLabels ? 1.5 : 1; diff --git a/tslint.json b/tslint.json index 15dc83ec575..4c7ea71366c 100644 --- a/tslint.json +++ b/tslint.json @@ -51,7 +51,7 @@ "one-line": [true, "check-open-brace", "check-catch", "check-else"], "only-arrow-functions": [true, "allow-declarations", "allow-named-functions"], "prefer-const": true, - "radix": false, + "radix": true, "typedef-whitespace": [ true, {