Skip to content

Commit 3a1f52d

Browse files
committed
prettier: ran on all files again, sorry. now settings are defined in package.json
1 parent af34f99 commit 3a1f52d

File tree

262 files changed

+4001
-7436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+4001
-7436
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ indent_size = 2
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
10+
max_line_length = 120
11+
insert_final_newline = true
1012

1113
[*.go]
1214
indent_style = tab

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,19 @@
107107
},
108108
"lint-staged": {
109109
"*.{ts,tsx}": [
110-
"prettier --single-quote --trailing-comma es5 --write",
110+
"prettier --write",
111111
"git add"
112112
],
113113
"*.scss": [
114-
"prettier --single-quote --write",
114+
"prettier --write",
115115
"git add"
116116
]
117117
},
118+
"prettier": {
119+
"trailingComma": "es5",
120+
"singleQuote": true,
121+
"printWidth": 120
122+
},
118123
"license": "Apache-2.0",
119124
"dependencies": {
120125
"angular": "^1.6.6",

public/app/app.ts

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -54,49 +54,40 @@ export class GrafanaApp {
5454

5555
moment.locale(config.bootData.user.locale);
5656

57-
app.config(
58-
(
59-
$locationProvider,
60-
$controllerProvider,
61-
$compileProvider,
62-
$filterProvider,
63-
$httpProvider,
64-
$provide
65-
) => {
66-
// pre assing bindings before constructor calls
67-
$compileProvider.preAssignBindingsEnabled(true);
68-
69-
if (config.buildInfo.env !== 'development') {
70-
$compileProvider.debugInfoEnabled(false);
71-
}
72-
73-
$httpProvider.useApplyAsync(true);
74-
75-
this.registerFunctions.controller = $controllerProvider.register;
76-
this.registerFunctions.directive = $compileProvider.directive;
77-
this.registerFunctions.factory = $provide.factory;
78-
this.registerFunctions.service = $provide.service;
79-
this.registerFunctions.filter = $filterProvider.register;
80-
81-
$provide.decorator('$http', [
82-
'$delegate',
83-
'$templateCache',
84-
function($delegate, $templateCache) {
85-
var get = $delegate.get;
86-
$delegate.get = function(url, config) {
87-
if (url.match(/\.html$/)) {
88-
// some template's already exist in the cache
89-
if (!$templateCache.get(url)) {
90-
url += '?v=' + new Date().getTime();
91-
}
92-
}
93-
return get(url, config);
94-
};
95-
return $delegate;
96-
},
97-
]);
57+
app.config(($locationProvider, $controllerProvider, $compileProvider, $filterProvider, $httpProvider, $provide) => {
58+
// pre assing bindings before constructor calls
59+
$compileProvider.preAssignBindingsEnabled(true);
60+
61+
if (config.buildInfo.env !== 'development') {
62+
$compileProvider.debugInfoEnabled(false);
9863
}
99-
);
64+
65+
$httpProvider.useApplyAsync(true);
66+
67+
this.registerFunctions.controller = $controllerProvider.register;
68+
this.registerFunctions.directive = $compileProvider.directive;
69+
this.registerFunctions.factory = $provide.factory;
70+
this.registerFunctions.service = $provide.service;
71+
this.registerFunctions.filter = $filterProvider.register;
72+
73+
$provide.decorator('$http', [
74+
'$delegate',
75+
'$templateCache',
76+
function($delegate, $templateCache) {
77+
var get = $delegate.get;
78+
$delegate.get = function(url, config) {
79+
if (url.match(/\.html$/)) {
80+
// some template's already exist in the cache
81+
if (!$templateCache.get(url)) {
82+
url += '?v=' + new Date().getTime();
83+
}
84+
}
85+
return get(url, config);
86+
};
87+
return $delegate;
88+
},
89+
]);
90+
});
10091

10192
this.ngModuleDependencies = [
10293
'grafana.core',
@@ -111,14 +102,7 @@ export class GrafanaApp {
111102
'react',
112103
];
113104

114-
var module_types = [
115-
'controllers',
116-
'directives',
117-
'factories',
118-
'services',
119-
'filters',
120-
'routes',
121-
];
105+
var module_types = ['controllers', 'directives', 'factories', 'services', 'filters', 'routes'];
122106

123107
_.each(module_types, type => {
124108
var moduleName = 'grafana.' + type;

public/app/core/components/code_editor/code_editor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ function link(scope, elem, attrs) {
5656
let maxLines = attrs.maxLines || DEFAULT_MAX_LINES;
5757
let showGutter = attrs.showGutter !== undefined;
5858
let tabSize = attrs.tabSize || DEFAULT_TAB_SIZE;
59-
let behavioursEnabled = attrs.behavioursEnabled
60-
? attrs.behavioursEnabled === 'true'
61-
: DEFAULT_BEHAVIOURS;
59+
let behavioursEnabled = attrs.behavioursEnabled ? attrs.behavioursEnabled === 'true' : DEFAULT_BEHAVIOURS;
6260

6361
// Initialize editor
6462
let aceElem = elem.get(0);

public/app/core/components/colorpicker/spectrum_picker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export function spectrumPicker() {
1212
require: 'ngModel',
1313
scope: true,
1414
replace: true,
15-
template:
16-
'<color-picker color="ngModel.$viewValue" onChange="onColorChange"></color-picker>',
15+
template: '<color-picker color="ngModel.$viewValue" onChange="onColorChange"></color-picker>',
1716
link: function(scope, element, attrs, ngModel) {
1817
scope.ngModel = ngModel;
1918
scope.onColorChange = color => {

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

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ export class FormDropdownCtrl {
3232
lookupText: boolean;
3333

3434
/** @ngInject **/
35-
constructor(
36-
private $scope,
37-
$element,
38-
private $sce,
39-
private templateSrv,
40-
private $q
41-
) {
35+
constructor(private $scope, $element, private $sce, private templateSrv, private $q) {
4236
this.inputElement = $element.find('input').first();
4337
this.linkElement = $element.find('a').first();
4438
this.linkMode = true;
@@ -50,8 +44,7 @@ export class FormDropdownCtrl {
5044
if (this.labelMode) {
5145
this.cssClasses = 'gf-form-label ' + this.cssClass;
5246
} else {
53-
this.cssClasses =
54-
'gf-form-input gf-form-input--dropdown ' + this.cssClass;
47+
this.cssClasses = 'gf-form-input gf-form-input--dropdown ' + this.cssClass;
5548
}
5649

5750
this.inputElement.attr('data-provide', 'typeahead');
@@ -207,16 +200,11 @@ export class FormDropdownCtrl {
207200

208201
updateDisplay(text) {
209202
this.text = text;
210-
this.display = this.$sce.trustAsHtml(
211-
this.templateSrv.highlightVariablesAsHtml(text)
212-
);
203+
this.display = this.$sce.trustAsHtml(this.templateSrv.highlightVariablesAsHtml(text));
213204
}
214205

215206
open() {
216-
this.inputElement.css(
217-
'width',
218-
Math.max(this.linkElement.width(), 80) + 16 + 'px'
219-
);
207+
this.inputElement.css('width', Math.max(this.linkElement.width(), 80) + 16 + 'px');
220208

221209
this.inputElement.show();
222210
this.inputElement.focus();

public/app/core/components/grafana_app.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,7 @@ import Drop from 'tether-drop';
99

1010
export class GrafanaCtrl {
1111
/** @ngInject */
12-
constructor(
13-
$scope,
14-
alertSrv,
15-
utilSrv,
16-
$rootScope,
17-
$controller,
18-
contextSrv,
19-
globalEventSrv
20-
) {
12+
constructor($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv, globalEventSrv) {
2113
$scope.init = function() {
2214
$scope.contextSrv = contextSrv;
2315

@@ -118,12 +110,7 @@ export class GrafanaCtrl {
118110
}
119111

120112
/** @ngInject */
121-
export function grafanaAppDirective(
122-
playlistSrv,
123-
contextSrv,
124-
$timeout,
125-
$rootScope
126-
) {
113+
export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScope) {
127114
return {
128115
restrict: 'E',
129116
controller: GrafanaCtrl,
@@ -269,10 +256,7 @@ export function grafanaAppDirective(
269256

270257
// hide search
271258
if (body.find('.search-container').length > 0) {
272-
if (
273-
target.parents('.search-results-container, .search-field-wrapper')
274-
.length === 0
275-
) {
259+
if (target.parents('.search-results-container, .search-field-wrapper').length === 0) {
276260
scope.$apply(function() {
277261
scope.appEvent('hide-dash-search');
278262
});
@@ -281,10 +265,7 @@ export function grafanaAppDirective(
281265

282266
// hide popovers
283267
var popover = elem.find('.popover');
284-
if (
285-
popover.length > 0 &&
286-
target.parents('.graph-legend').length === 0
287-
) {
268+
if (popover.length > 0 && target.parents('.graph-legend').length === 0) {
288269
popover.hide();
289270
}
290271
});

public/app/core/components/json_explorer/helpers.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ export function cssClass(className: string): string {
103103
* Creates a new DOM element wiht given type and class
104104
* TODO: move me to helpers
105105
*/
106-
export function createElement(
107-
type: string,
108-
className?: string,
109-
content?: Element | string
110-
): Element {
106+
export function createElement(type: string, className?: string, content?: Element | string): Element {
111107
const el = document.createElement(type);
112108
if (className) {
113109
el.classList.add(cssClass(className));

public/app/core/components/json_explorer/json_explorer.ts

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
// Based on work https://github.com/mohsen1/json-formatter-js
22
// Licence MIT, Copyright (c) 2015 Mohsen Azimi
33

4-
import {
5-
isObject,
6-
getObjectName,
7-
getType,
8-
getValuePreview,
9-
cssClass,
10-
createElement,
11-
} from './helpers';
4+
import { isObject, getObjectName, getType, getValuePreview, cssClass, createElement } from './helpers';
125

136
import _ from 'lodash';
147

@@ -112,9 +105,7 @@ export class JsonExplorer {
112105
private get isDate(): boolean {
113106
return (
114107
this.type === 'string' &&
115-
(DATE_STRING_REGEX.test(this.json) ||
116-
JSON_DATE_REGEX.test(this.json) ||
117-
PARTIAL_DATE_REGEX.test(this.json))
108+
(DATE_STRING_REGEX.test(this.json) || JSON_DATE_REGEX.test(this.json) || PARTIAL_DATE_REGEX.test(this.json))
118109
);
119110
}
120111

@@ -151,9 +142,7 @@ export class JsonExplorer {
151142
* is this an empty object or array?
152143
*/
153144
private get isEmpty(): boolean {
154-
return (
155-
this.isEmptyObject || (this.keys && !this.keys.length && this.isArray)
156-
);
145+
return this.isEmptyObject || (this.keys && !this.keys.length && this.isArray);
157146
}
158147

159148
/*
@@ -234,11 +223,7 @@ export class JsonExplorer {
234223
}
235224

236225
isNumberArray() {
237-
return (
238-
this.json.length > 0 &&
239-
this.json.length < 4 &&
240-
(_.isNumber(this.json[0]) || _.isNumber(this.json[1]))
241-
);
226+
return this.json.length > 0 && this.json.length < 4 && (_.isNumber(this.json[0]) || _.isNumber(this.json[1]));
242227
}
243228

244229
renderArray() {
@@ -249,17 +234,13 @@ export class JsonExplorer {
249234
if (this.isNumberArray()) {
250235
this.json.forEach((val, index) => {
251236
if (index > 0) {
252-
arrayWrapperSpan.appendChild(
253-
createElement('span', 'array-comma', ',')
254-
);
237+
arrayWrapperSpan.appendChild(createElement('span', 'array-comma', ','));
255238
}
256239
arrayWrapperSpan.appendChild(createElement('span', 'number', val));
257240
});
258241
this.skipChildren = true;
259242
} else {
260-
arrayWrapperSpan.appendChild(
261-
createElement('span', 'number', this.json.length)
262-
);
243+
arrayWrapperSpan.appendChild(createElement('span', 'number', this.json.length));
263244
}
264245

265246
arrayWrapperSpan.appendChild(createElement('span', 'bracket', ']'));
@@ -298,11 +279,7 @@ export class JsonExplorer {
298279
const objectWrapperSpan = createElement('span');
299280

300281
// get constructor name and append it to wrapper span
301-
var constructorName = createElement(
302-
'span',
303-
'constructor-name',
304-
this.constructorName
305-
);
282+
var constructorName = createElement('span', 'constructor-name', this.constructorName);
306283
objectWrapperSpan.appendChild(constructorName);
307284

308285
// if it's an array append the array specific elements like brackets and length
@@ -399,12 +376,7 @@ export class JsonExplorer {
399376
let index = 0;
400377
const addAChild = () => {
401378
const key = this.keys[index];
402-
const formatter = new JsonExplorer(
403-
this.json[key],
404-
this.open - 1,
405-
this.config,
406-
key
407-
);
379+
const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
408380
children.appendChild(formatter.render());
409381

410382
index += 1;
@@ -421,12 +393,7 @@ export class JsonExplorer {
421393
requestAnimationFrame(addAChild);
422394
} else {
423395
this.keys.forEach(key => {
424-
const formatter = new JsonExplorer(
425-
this.json[key],
426-
this.open - 1,
427-
this.config,
428-
key
429-
);
396+
const formatter = new JsonExplorer(this.json[key], this.open - 1, this.config, key);
430397
children.appendChild(formatter.render());
431398
});
432399
}
@@ -437,9 +404,7 @@ export class JsonExplorer {
437404
* Animated option is used when user triggers this via a click
438405
*/
439406
removeChildren(animated = false) {
440-
const childrenElement = this.element.querySelector(
441-
`div.${cssClass('children')}`
442-
) as HTMLDivElement;
407+
const childrenElement = this.element.querySelector(`div.${cssClass('children')}`) as HTMLDivElement;
443408

444409
if (animated) {
445410
let childrenRemoved = 0;

0 commit comments

Comments
 (0)