Skip to content

Commit 36bc8b7

Browse files
committed
Merge branch 'tsconfig-no-implicit-this'
2 parents b8e6817 + a8547ae commit 36bc8b7

File tree

27 files changed

+91
-114
lines changed

27 files changed

+91
-114
lines changed

public/app/containers/Explore/utils/debounce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Based on underscore.js debounce()
22
export default function debounce(func, wait) {
33
let timeout;
4-
return function() {
4+
return function(this: any) {
55
const context = this;
66
const args = arguments;
77
const later = function() {

public/app/containers/Explore/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Node.closest() polyfill
22
if ('Element' in window && !Element.prototype.closest) {
3-
Element.prototype.closest = function(s) {
3+
Element.prototype.closest = function(this: any, s) {
44
const matches = (this.document || this.ownerDocument).querySelectorAll(s);
55
let el = this;
66
let i;

public/app/core/components/form_dropdown/form_dropdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22
import coreModule from '../../core_module';
33

4-
function typeaheadMatcher(item) {
4+
function typeaheadMatcher(this: any, item) {
55
let str = this.query;
66
if (str === '') {
77
return true;

public/app/core/components/query_part/query_part_editor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
3333

3434
$scope.partActions = [];
3535

36-
function clickFuncParam(paramIndex) {
36+
function clickFuncParam(this: any, paramIndex) {
3737
/*jshint validthis:true */
3838
const $link = $(this);
3939
const $input = $link.next();
@@ -53,7 +53,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
5353
}
5454
}
5555

56-
function inputBlur(paramIndex) {
56+
function inputBlur(this: any, paramIndex) {
5757
/*jshint validthis:true */
5858
const $input = $(this);
5959
const $link = $input.prev();
@@ -72,14 +72,14 @@ export function queryPartEditorDirective($compile, templateSrv) {
7272
$link.show();
7373
}
7474

75-
function inputKeyPress(paramIndex, e) {
75+
function inputKeyPress(this: any, paramIndex, e) {
7676
/*jshint validthis:true */
7777
if (e.which === 13) {
7878
inputBlur.call(this, paramIndex);
7979
}
8080
}
8181

82-
function inputKeyDown() {
82+
function inputKeyDown(this: any) {
8383
/*jshint validthis:true */
8484
this.style.width = (3 + this.value.length) * 8 + 'px';
8585
}

public/app/core/directives/tags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function bootstrapTagsinput() {
6969
},
7070
});
7171

72-
select.on('itemAdded', function(event) {
72+
select.on('itemAdded', event => {
7373
if (scope.model.indexOf(event.item) === -1) {
7474
scope.model.push(event.item);
7575
if (scope.onTagsUpdated) {
@@ -79,7 +79,7 @@ function bootstrapTagsinput() {
7979
const tagElement = select
8080
.next()
8181
.children('span')
82-
.filter(function() {
82+
.filter(() => {
8383
return $(this).text() === event.item;
8484
});
8585
setColor(event.item, tagElement);

public/app/core/jquery_extended.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ $.fn.place_tt = (function() {
99
offset: 5,
1010
};
1111

12-
return function(x, y, opts) {
12+
return function(this: any, x, y, opts) {
1313
opts = $.extend(true, {}, defaults, opts);
1414

15-
return this.each(function() {
15+
return this.each(() => {
1616
const $tooltip = $(this);
1717
let width, height;
1818

public/app/core/services/ng_react.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const reactComponent = function($injector) {
204204
attrs.props ? watchProps(attrs.watchDepth, scope, [attrs.props], renderMyComponent) : renderMyComponent();
205205

206206
// cleanup when scope is destroyed
207-
scope.$on('$destroy', function() {
207+
scope.$on('$destroy', () => {
208208
if (!attrs.onScopeDestroy) {
209209
ReactDOM.unmountComponentAtNode(elem[0]);
210210
} else {
@@ -280,7 +280,7 @@ const reactDirective = function($injector) {
280280
props.length ? watchProps(attrs.watchDepth, scope, propExpressions, renderMyComponent) : renderMyComponent();
281281

282282
// cleanup when scope is destroyed
283-
scope.$on('$destroy', function() {
283+
scope.$on('$destroy', () => {
284284
if (!attrs.onScopeDestroy) {
285285
ReactDOM.unmountComponentAtNode(elem[0]);
286286
} else {

public/app/core/services/popover_srv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import coreModule from 'app/core/core_module';
33
import Drop from 'tether-drop';
44

55
/** @ngInject **/
6-
function popoverSrv($compile, $rootScope, $timeout) {
6+
function popoverSrv(this: any, $compile, $rootScope, $timeout) {
77
let openDrop = null;
88

99
this.close = function() {

public/app/core/services/segment_srv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import _ from 'lodash';
22
import coreModule from '../core_module';
33

44
/** @ngInject */
5-
export function uiSegmentSrv($sce, templateSrv) {
5+
export function uiSegmentSrv(this: any, $sce, templateSrv) {
66
const self = this;
77

8-
function MetricSegment(options) {
8+
function MetricSegment(this: any, options) {
99
if (options === '*' || options.value === '*') {
1010
this.value = '*';
1111
this.html = $sce.trustAsHtml('<i class="fa fa-asterisk"><i>');

public/app/features/dashboard/dashboard_migration.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,12 @@ export class DashboardMigrator {
140140
}
141141

142142
// ensure query refIds
143-
panelUpgrades.push(function(panel) {
144-
_.each(
145-
panel.targets,
146-
function(target) {
147-
if (!target.refId) {
148-
target.refId = this.dashboard.getNextQueryLetter(panel);
149-
}
150-
}.bind(this)
151-
);
143+
panelUpgrades.push(panel => {
144+
_.each(panel.targets, target => {
145+
if (!target.refId) {
146+
target.refId = this.dashboard.getNextQueryLetter(panel);
147+
}
148+
});
152149
});
153150
}
154151

0 commit comments

Comments
 (0)