Skip to content

Commit fd2bc9c

Browse files
cexbrayathansl
authored andcommitted
chore(lint): bump to tslint 4.3.0 and add a few new rules (angular#3934)
Adds a few rules introduced or fixed by tslint 4.3 - [import-spacing](https://palantir.github.io/tslint/rules/import-spacing/) - [unified-signature](https://palantir.github.io/tslint/rules/unified-signatures/) - [prefer-const](https://palantir.github.io/tslint/rules/prefer-const/) - [typeof-compare](https://palantir.github.io/tslint/rules/typeof-compare/) and removes a rule for codelyzer (now handled by tslint directly): - import-destructuring-spacing Fixes `test.ts` and several `.spec.ts` files to use `const` instead of `let`.
1 parent f84e220 commit fd2bc9c

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

‎packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import{<%= classifiedModuleName %>Directive } from './<%= dasherizedModuleName
55

66
describe('<%= classifiedModuleName %>Directive',()=>{
77
it('should create an instance',()=>{
8-
letdirective=new<%=classifiedModuleName%>Directive();
8+
constdirective=new<%=classifiedModuleName%>Directive();
99
expect(directive).toBeTruthy();
1010
});
1111
});

‎packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ describe('AppComponent', () =>{
1818
});
1919

2020
it('should create the app',async(()=>{
21-
letfixture=TestBed.createComponent(AppComponent);
22-
letapp=fixture.debugElement.componentInstance;
21+
constfixture=TestBed.createComponent(AppComponent);
22+
constapp=fixture.debugElement.componentInstance;
2323
expect(app).toBeTruthy();
2424
}));
2525

2626
it(`should have as title '<%= prefix %> works!'`,async(()=>{
27-
letfixture=TestBed.createComponent(AppComponent);
28-
letapp=fixture.debugElement.componentInstance;
27+
constfixture=TestBed.createComponent(AppComponent);
28+
constapp=fixture.debugElement.componentInstance;
2929
expect(app.title).toEqual('<%= prefix %> works!');
3030
}));
3131

3232
it('should render title in a h1 tag',async(()=>{
33-
letfixture=TestBed.createComponent(AppComponent);
33+
constfixture=TestBed.createComponent(AppComponent);
3434
fixture.detectChanges();
35-
letcompiled=fixture.debugElement.nativeElement;
35+
constcompiled=fixture.debugElement.nativeElement;
3636
expect(compiled.querySelector('h1').textContent).toContain('<%= prefix %> works!');
3737
}));
3838
});

‎packages/angular-cli/blueprints/ng2/files/__path__/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ getTestBed().initTestEnvironment(
2525
platformBrowserDynamicTesting()
2626
);
2727
// Then we find all the tests.
28-
letcontext=require.context('./',true,/\.spec\.ts$/);
28+
constcontext=require.context('./',true,/\.spec\.ts$/);
2929
// And load the modules.
3030
context.keys().map(context);
3131
// Finally, start Karma to run the tests.

‎packages/angular-cli/blueprints/ng2/files/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"karma-remap-istanbul": "^0.2.1",
4242
"protractor": "~4.0.13",
4343
"ts-node": "1.2.1",
44-
"tslint": "^4.2.0",
44+
"tslint": "^4.3.0",
4545
"typescript": "~2.0.3"
4646
}
4747
}

‎packages/angular-cli/blueprints/ng2/files/tslint.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"eofline": true,
1414
"forin": true,
1515
"import-blacklist": [true, "rxjs"],
16+
"import-spacing": true,
1617
"indent": [
1718
true,
1819
"spaces"
@@ -62,6 +63,7 @@
6263
"check-else",
6364
"check-whitespace"
6465
],
66+
"prefer-const": true,
6567
"quotemark": [
6668
true,
6769
"single"
@@ -84,6 +86,8 @@
8486
"variable-declaration": "nospace"
8587
}
8688
],
89+
"typeof-compare": true,
90+
"unified-signatures": true,
8791
"variable-name": false,
8892
"whitespace": [
8993
true,
@@ -105,7 +109,6 @@
105109
"use-pipe-transform-interface": true,
106110
"component-class-suffix": true,
107111
"directive-class-suffix": true,
108-
"import-destructuring-spacing": true,
109112
"no-access-missing-member": true,
110113
"templates-use-public": true,
111114
"invoke-injectable": true

‎packages/angular-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import{<%= classifiedModuleName %>Pipe } from './<%= dasherizedModuleName %>.p
55

66
describe('<%= classifiedModuleName %>Pipe',()=>{
77
it('create an instance',()=>{
8-
letpipe=new<%=classifiedModuleName%>Pipe();
8+
constpipe=new<%=classifiedModuleName%>Pipe();
99
expect(pipe).toBeTruthy();
1010
});
1111
});

0 commit comments

Comments
(0)