tech: removing unused variables from typescript files, and making tslint rules more strict

This commit is contained in:
Torkel Ödegaard
2017-09-21 16:40:18 +02:00
parent adda84d124
commit b8d9722b4f
176 changed files with 137 additions and 391 deletions

View File

@@ -1,5 +1,5 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
// import from 'react-dom';
import coreModule from '../core_module';
export interface IProps {

View File

@@ -1,8 +1,5 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `
@@ -37,7 +34,7 @@ export class ColorPickerCtrl {
showAxisControls: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope) {
constructor(private $scope, $rootScope) {
this.colors = $rootScope.colors;
this.autoClose = $scope.autoClose;
this.series = $scope.series;

View File

@@ -1,8 +1,5 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `

View File

@@ -1,6 +1,5 @@
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';

View File

@@ -1,9 +1,7 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import store from 'app/core/store';
import _ from 'lodash';
import angular from 'angular';
import $ from 'jquery';
import coreModule from 'app/core/core_module';

View File

@@ -8,7 +8,7 @@ export class HelpCtrl {
shortcuts: any;
/** @ngInject */
constructor(private $scope, $sce) {
constructor() {
this.tabIndex = 0;
this.shortcuts = {
'Global': [

View File

@@ -1,7 +1,6 @@
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';

View File

@@ -6,7 +6,6 @@ import {
getObjectName,
getType,
getValuePreview,
getPreview,
cssClass,
createElement
} from './helpers';

View File

@@ -1,9 +1,6 @@
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import store from 'app/core/store';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `

View File

@@ -1,5 +1,5 @@
<div class="navbar-inner">
<a class="navbar-brand-btn pointer" ng-click="ctrl.contextSrv.toggleSideMenu()">
<a class="navbar-brand-btn pointer" ng-click="ctrl.toggleSideMenu()">
<span class="navbar-brand-btn-background">
<img src="public/img/grafana_icon.svg"></img>
</span>

View File

@@ -1,8 +1,5 @@
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
import {NavModel, NavModelItem} from '../../nav_model_srv';
@@ -12,7 +9,7 @@ export class NavbarCtrl {
hasMenu: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope, private contextSrv) {
constructor(private $rootScope, private contextSrv) {
this.section = this.model.section;
this.hasMenu = this.model.menu.length > 0;
}
@@ -21,6 +18,10 @@ export class NavbarCtrl {
this.$rootScope.appEvent('show-dash-search');
}
toggleSideMenu() {
this.contextSrv.toggleSideMenu();
}
navItemClicked(navItem, evt) {
if (navItem.clickHandler) {
navItem.clickHandler();

View File

@@ -1,11 +1,8 @@
///<reference path="../../../headers/common.d.ts" />
import angular from 'angular';
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
import appEvents from 'app/core/app_events';
export class SearchCtrl {
isOpen: boolean;
@@ -22,7 +19,7 @@ export class SearchCtrl {
openCompleted: boolean;
/** @ngInject */
constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv, private $rootScope) {
constructor($scope, private $location, private $timeout, private backendSrv, public contextSrv, $rootScope) {
$rootScope.onAppEvent('show-dash-search', this.openSearch.bind(this), $scope);
$rootScope.onAppEvent('hide-dash-search', this.closeSearch.bind(this), $scope);
}

View File

@@ -1,7 +1,6 @@
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
@@ -19,7 +18,7 @@ export class SideMenuCtrl {
maxShownOrgs: number;
/** @ngInject */
constructor(private $scope, private $location, private contextSrv, private backendSrv, private $element) {
constructor(private $scope, private $location, private contextSrv, private backendSrv) {
this.isSignedIn = contextSrv.isSignedIn;
this.user = contextSrv.user;
this.appSubUrl = config.appSubUrl;

View File

@@ -1,10 +1,6 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';
var template = `
<label for="check-{{ctrl.id}}" class="gf-form-label {{ctrl.labelClass}} pointer" ng-show="ctrl.label">

View File

@@ -8,9 +8,9 @@ export class SignUpCtrl {
/** @ngInject */
constructor(
private $scope: any,
private $location: any,
private contextSrv: any,
private backendSrv: any) {
private backendSrv: any,
$location: any,
contextSrv: any) {
contextSrv.sidemenu = false;
$scope.ctrl = this;

View File

@@ -7,7 +7,7 @@ export class DeltaCtrl {
observer: any;
/** @ngInject */
constructor(private $rootScope) {
constructor($rootScope) {
const waitForCompile = function(mutations) {
if (mutations.length === 1) {
this.$rootScope.appEvent('json-diff-ready');

View File

@@ -1,7 +1,5 @@
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../core_module';

View File

@@ -2,7 +2,6 @@
import _ from 'lodash';
import config from 'app/core/config';
import coreModule from 'app/core/core_module';
import {Observable} from 'vendor/npm/rxjs/Observable';

View File

@@ -1,7 +1,6 @@
///<reference path="../headers/common.d.ts" />
import $ from 'jquery';
import _ from 'lodash';
import angular from 'angular';
export class Profiler {

View File

@@ -2,7 +2,6 @@
import './dashboard_loaders';
import angular from 'angular';
import coreModule from 'app/core/core_module';
import {BundleLoader} from './bundle_loader';

View File

@@ -2,7 +2,6 @@
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
@@ -10,7 +9,7 @@ export class AlertSrv {
list: any[];
/** @ngInject */
constructor(private $timeout, private $sce, private $rootScope, private $modal) {
constructor(private $timeout, private $rootScope, private $modal) {
this.list = [];
}

View File

@@ -1,8 +1,6 @@
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import config from 'app/core/config';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
@@ -12,7 +10,7 @@ export class BackendSrv {
private noBackendCache: boolean;
/** @ngInject */
constructor(private $http, private alertSrv, private $rootScope, private $q, private $timeout, private contextSrv) {
constructor(private $http, private alertSrv, private $q, private $timeout, private contextSrv) {
}
get(url, params?) {

View File

@@ -6,7 +6,7 @@ import coreModule from '../core_module';
class DynamicDirectiveSrv {
/** @ngInject */
constructor(private $compile, private $parse, private $rootScope) {}
constructor(private $compile, private $rootScope) {}
addDirective(element, name, scope) {
var child = angular.element(document.createElement(name));

View File

@@ -14,10 +14,7 @@ export class KeybindingSrv {
/** @ngInject */
constructor(
private $rootScope,
private $modal,
private $location,
private contextSrv,
private $timeout) {
private $location) {
// clear out all shortcuts on route change
$rootScope.$on('$routeChangeSuccess', () => {

View File

@@ -1,8 +1,6 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';

View File

@@ -1,9 +1,5 @@
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';

View File

@@ -2,12 +2,6 @@
import EventEmitter from 'eventemitter3';
var hasOwnProp = {}.hasOwnProperty;
function createName(name) {
return '$' + name;
}
export class Emitter {
emitter: any;