Skip to content

Commit 370ab93

Browse files
committed
build: enforce consistent spacing in curly braces
Adds a rule to enforce that we have consistent spacing inside curly braces and fixes any violations. Relates to #6615 (comment).
1 parent deca032 commit 370ab93

Some content is hidden

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

58 files changed

+517
-1369
lines changed

package-lock.json

Lines changed: 255 additions & 1112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
"ts-node": "^3.0.4",
116116
"tsconfig-paths": "^2.2.0",
117117
"tslint": "^5.7.0",
118+
"tslint-eslint-rules": "^4.1.1",
118119
"tsutils": "^2.6.0",
119120
"typescript": "~2.2.1",
120121
"uglify-js": "^2.8.14",

src/cdk/a11y/list-key-manager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ describe('Key managers', () => {
400400
it('should throw if the items do not implement the getLabel method', () => {
401401
const invalidQueryList = new FakeQueryList();
402402

403-
invalidQueryList.items = [{ disabled: false }];
403+
invalidQueryList.items = [{disabled: false}];
404404

405405
const invalidManager = new ListKeyManager(invalidQueryList);
406406

src/cdk/observers/observe-content.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ describe('Observe content', () => {
9393
});
9494

9595

96-
@Component({ template: `<div (cdkObserveContent)="doSomething()">{{text}}</div>` })
96+
@Component({template: `<div (cdkObserveContent)="doSomething()">{{text}}</div>`})
9797
class ComponentWithTextContent {
9898
text = '';
9999
doSomething() {}
100100
}
101101

102-
@Component({ template: `<div (cdkObserveContent)="doSomething()"><div>{{text}}<div></div>` })
102+
@Component({template: `<div (cdkObserveContent)="doSomething()"><div>{{text}}<div></div>`})
103103
class ComponentWithChildTextContent {
104104
text = '';
105105
doSomething() {}

src/cdk/overlay/overlay-directives.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Overlay directives', () => {
2525
return {getContainerElement: () => overlayContainerElement};
2626
}},
2727
{provide: Directionality, useFactory: () => {
28-
return dir = { value: 'ltr' };
28+
return dir = {value: 'ltr'};
2929
}}
3030
],
3131
});

src/cdk/overlay/overlay.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ describe('OverlayContainer theming', () => {
480480
let overlayContainerElement: HTMLElement;
481481

482482
beforeEach(async(() => {
483-
TestBed.configureTestingModule({ imports: [OverlayContainerThemingTestModule] });
483+
TestBed.configureTestingModule({imports: [OverlayContainerThemingTestModule]});
484484
TestBed.compileComponents();
485485
}));
486486

src/cdk/overlay/scroll/block-scroll-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {ViewportRuler} from '@angular/cdk/scrolling';
1313
* Strategy that will prevent the user from scrolling while the overlay is visible.
1414
*/
1515
export class BlockScrollStrategy implements ScrollStrategy {
16-
private _previousHTMLStyles = { top: '', left: '' };
16+
private _previousHTMLStyles = {top: '', left: ''};
1717
private _previousScrollPosition: { top: number, left: number };
1818
private _isEnabled = false;
1919

src/cdk/portal/portal.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ class ArbitraryViewContainerRefComponent {
482482
class PortalTestApp {
483483
@ViewChildren(TemplatePortalDirective) portals: QueryList<TemplatePortalDirective>;
484484
@ViewChild(PortalHostDirective) portalHost: PortalHostDirective;
485-
@ViewChild('templateRef', { read: TemplateRef }) templateRef: TemplateRef<any>;
485+
@ViewChild('templateRef', {read: TemplateRef}) templateRef: TemplateRef<any>;
486486

487487
selectedPortal: Portal<any>;
488488
fruit: string = 'Banana';

src/cdk/rxjs/rx-chain.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {RxChain, map, filter, first} from './index';
44

55
describe('RxChain', () => {
66
it('should call all of the operators in the chain', () => {
7-
let operators = { map, filter, first };
7+
let operators = {map, filter, first};
88

99
spyOn(operators, 'map');
1010
spyOn(operators, 'filter');

src/cdk/testing/event-objects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ export function createKeyboardEvent(type: string, keyCode: number, target?: Elem
4141
// Webkit Browsers don't set the keyCode when calling the init function.
4242
// See related bug https://bugs.webkit.org/show_bug.cgi?id=16735
4343
Object.defineProperties(event, {
44-
keyCode: { get: () => keyCode },
45-
key: { get: () => key },
46-
target: { get: () => target }
44+
keyCode: {get: () => keyCode},
45+
key: {get: () => key},
46+
target: {get: () => target}
4747
});
4848

4949
// IE won't set `defaultPrevented` on synthetic events so we need to do it manually.
5050
event.preventDefault = function() {
51-
Object.defineProperty(event, 'defaultPrevented', { get: () => true });
51+
Object.defineProperty(event, 'defaultPrevented', {get: () => true});
5252
return originalPreventDefault.apply(this, arguments);
5353
};
5454

src/demo-app/a11y/checkbox/checkbox-a11y.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ export class CheckboxAccessibilityDemo {
1919
name: 'Reminders',
2020
completed: false,
2121
subtasks: [
22-
{ name: 'Cook Dinner', completed: false },
23-
{ name: 'Read the Material Design Spec', completed: false },
24-
{ name: 'Upgrade Application to Angular', completed: false }
22+
{name: 'Cook Dinner', completed: false},
23+
{name: 'Read the Material Design Spec', completed: false},
24+
{name: 'Upgrade Application to Angular', completed: false}
2525
]
2626
},
2727
{
2828
name: 'Groceries',
2929
completed: false,
3030
subtasks: [
31-
{ name: 'Organic Eggs', completed: false },
32-
{ name: 'Protein Powder', completed: false },
33-
{ name: 'Almond Meal Flour', completed: false }
31+
{name: 'Organic Eggs', completed: false},
32+
{name: 'Protein Powder', completed: false},
33+
{name: 'Almond Meal Flour', completed: false}
3434
]
3535
}
3636
];

src/demo-app/a11y/chips/chips-a11y.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export class ChipsAccessibilityDemo {
2121
message: string = '';
2222

2323
people: Person[] = [
24-
{ name: 'Kara' },
25-
{ name: 'Jeremy' },
26-
{ name: 'Topher' },
27-
{ name: 'Elad' },
28-
{ name: 'Kristiyan' },
29-
{ name: 'Paul' }
24+
{name: 'Kara'},
25+
{name: 'Jeremy'},
26+
{name: 'Topher'},
27+
{name: 'Elad'},
28+
{name: 'Kristiyan'},
29+
{name: 'Paul'}
3030
];
3131

3232
displayMessage(message: string): void {
@@ -39,7 +39,7 @@ export class ChipsAccessibilityDemo {
3939

4040
// Add our person
4141
if ((value || '').trim()) {
42-
this.people.push({ name: value.trim() });
42+
this.people.push({name: value.trim()});
4343
}
4444

4545
// Reset the input value
@@ -62,9 +62,9 @@ export class ChipsAccessibilityDemo {
6262

6363

6464
availableColors = [
65-
{ name: 'none', color: '' },
66-
{ name: 'Primary', color: 'primary' },
67-
{ name: 'Accent', color: 'accent' },
68-
{ name: 'Warn', color: 'warn' }
65+
{name: 'none', color: ''},
66+
{name: 'Primary', color: 'primary'},
67+
{name: 'Accent', color: 'accent'},
68+
{name: 'Warn', color: 'warn'}
6969
];
7070
}

src/demo-app/a11y/grid-list/grid-list-a11y.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export interface Dog {
1313
})
1414
export class GridListAccessibilityDemo {
1515
dogs: Dog[] = [
16-
{ name: 'Porter', human: 'Kara' },
17-
{ name: 'Mal', human: 'Jeremy' },
18-
{ name: 'Koby', human: 'Igor' },
19-
{ name: 'Razzle', human: 'Ward' },
20-
{ name: 'Molly', human: 'Rob' },
21-
{ name: 'Husi', human: 'Matias' },
16+
{name: 'Porter', human: 'Kara'},
17+
{name: 'Mal', human: 'Jeremy'},
18+
{name: 'Koby', human: 'Igor'},
19+
{name: 'Razzle', human: 'Ward'},
20+
{name: 'Molly', human: 'Rob'},
21+
{name: 'Husi', human: 'Matias'},
2222
];
2323

2424
tiles = [

src/demo-app/autocomplete/autocomplete-demo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ export class AutocompleteDemo {
100100
let group = groups.find(g => g.letter === state.name[0]);
101101

102102
if (!group) {
103-
group = { letter: state.name[0], states: [] };
103+
group = {letter: state.name[0], states: []};
104104
groups.push(group);
105105
}
106106

107-
group.states.push({ code: state.code, name: state.name });
107+
group.states.push({code: state.code, name: state.name});
108108

109109
return groups;
110110
}, [] as StateGroup[]);
@@ -121,7 +121,7 @@ export class AutocompleteDemo {
121121
filterStateGroups(val: string) {
122122
if (val) {
123123
return this.groupedStates
124-
.map(group => ({ letter: group.letter, states: this._filter(group.states, val) }))
124+
.map(group => ({letter: group.letter, states: this._filter(group.states, val)}))
125125
.filter(group => group.states.length > 0);
126126
}
127127

src/demo-app/checkbox/checkbox-demo.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ export class MdCheckboxDemoNestedChecklist {
2323
name: 'Reminders',
2424
completed: false,
2525
subtasks: [
26-
{ name: 'Cook Dinner', completed: false },
27-
{ name: 'Read the Material Design Spec', completed: false },
28-
{ name: 'Upgrade Application to Angular', completed: false }
26+
{name: 'Cook Dinner', completed: false},
27+
{name: 'Read the Material Design Spec', completed: false},
28+
{name: 'Upgrade Application to Angular', completed: false}
2929
]
3030
},
3131
{
3232
name: 'Groceries',
3333
completed: false,
3434
subtasks: [
35-
{ name: 'Organic Eggs', completed: false },
36-
{ name: 'Protein Powder', completed: false },
37-
{ name: 'Almond Meal Flour', completed: false }
35+
{name: 'Organic Eggs', completed: false},
36+
{name: 'Protein Powder', completed: false},
37+
{name: 'Almond Meal Flour', completed: false}
3838
]
3939
}
4040
];

src/demo-app/chips/chips-demo.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ export class ChipsDemo {
3030
separatorKeysCodes = [ENTER, COMMA, 186];
3131

3232
people: Person[] = [
33-
{ name: 'Kara' },
34-
{ name: 'Jeremy' },
35-
{ name: 'Topher' },
36-
{ name: 'Elad' },
37-
{ name: 'Kristiyan' },
38-
{ name: 'Paul' }
33+
{name: 'Kara'},
34+
{name: 'Jeremy'},
35+
{name: 'Topher'},
36+
{name: 'Elad'},
37+
{name: 'Kristiyan'},
38+
{name: 'Paul'}
3939
];
4040

4141
availableColors: DemoColor[] = [
42-
{ name: 'none', color: '' },
43-
{ name: 'Primary', color: 'primary' },
44-
{ name: 'Accent', color: 'accent' },
45-
{ name: 'Warn', color: 'warn' }
42+
{name: 'none', color: ''},
43+
{name: 'Primary', color: 'primary'},
44+
{name: 'Accent', color: 'accent'},
45+
{name: 'Warn', color: 'warn'}
4646
];
4747

4848
displayMessage(message: string): void {
@@ -55,7 +55,7 @@ export class ChipsDemo {
5555

5656
// Add our person
5757
if ((value || '').trim()) {
58-
this.people.push({ name: value.trim() });
58+
this.people.push({name: value.trim()});
5959
}
6060

6161
// Reset the input value

src/demo-app/dialog/dialog-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class JazzDialog {
9999
if (this._dimesionToggle) {
100100
this.dialogRef
101101
.updateSize('500px', '500px')
102-
.updatePosition({ top: '25px', left: '25px' });
102+
.updatePosition({top: '25px', left: '25px'});
103103
} else {
104104
this.dialogRef
105105
.updateSize()

src/demo-app/grid-list/grid-list-demo.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export class GridListDemo {
1616
];
1717

1818
dogs: Object[] = [
19-
{ name: 'Porter', human: 'Kara' },
20-
{ name: 'Mal', human: 'Jeremy' },
21-
{ name: 'Koby', human: 'Igor' },
22-
{ name: 'Razzle', human: 'Ward' },
23-
{ name: 'Molly', human: 'Rob' },
24-
{ name: 'Husi', human: 'Matias' },
19+
{name: 'Porter', human: 'Kara'},
20+
{name: 'Mal', human: 'Jeremy'},
21+
{name: 'Koby', human: 'Igor'},
22+
{name: 'Razzle', human: 'Ward'},
23+
{name: 'Molly', human: 'Rob'},
24+
{name: 'Husi', human: 'Matias'},
2525
];
2626

2727
basicRowHeight = 80;

src/demo-app/input/input-demo.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ChangeDetectionStrategy } from '@angular/core';
1+
import {Component, ChangeDetectionStrategy} from '@angular/core';
22
import {FormControl, Validators} from '@angular/forms';
33

44

@@ -30,11 +30,11 @@ export class InputDemo {
3030
dividerColorExample2: string;
3131
dividerColorExample3: string;
3232
items: any[] = [
33-
{ value: 10 },
34-
{ value: 20 },
35-
{ value: 30 },
36-
{ value: 40 },
37-
{ value: 50 },
33+
{value: 10},
34+
{value: 20},
35+
{value: 30},
36+
{value: 40},
37+
{value: 50},
3838
];
3939
rows = 8;
4040
formControl = new FormControl('hello', Validators.required);
@@ -48,7 +48,7 @@ export class InputDemo {
4848

4949
addABunch(n: number) {
5050
for (let x = 0; x < n; x++) {
51-
this.items.push({ value: ++max });
51+
this.items.push({value: ++max});
5252
}
5353
}
5454

src/demo-app/ripple/ripple-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class RippleDemo {
2323

2424
launchRipple(persistent = false) {
2525
if (this.ripple) {
26-
this.ripple.launch(0, 0, { centered: true, persistent });
26+
this.ripple.launch(0, 0, {centered: true, persistent});
2727
}
2828
}
2929

0 commit comments

Comments
 (0)