Skip to content

Commit ef0c325

Browse files
committed
chore(lint): enable semicolon and variable-name tslint checks
1 parent 9096481 commit ef0c325

File tree

13 files changed

+30
-22
lines changed

13 files changed

+30
-22
lines changed

gulpfile.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const path = require('path');
1111

1212
const srcsToFmt = ['tools/**/*.ts'];
1313

14-
gulp.task('lint', () => {
14+
gulp.task('format:enforce', () => {
1515
const format = require('gulp-clang-format');
1616
const clangFormat = require('clang-format');
1717
return gulp.src(srcsToFmt).pipe(
18-
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
18+
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
1919
});
2020

2121
gulp.task('format', () => {
@@ -25,6 +25,20 @@ gulp.task('format', () => {
2525
format.format('file', clangFormat)).pipe(gulp.dest('.'));
2626
});
2727

28+
gulp.task('lint', ['format:enforce', 'tools:build'], () => {
29+
const tslint = require('gulp-tslint');
30+
// Built-in rules are at
31+
// https://github.com/palantir/tslint#supported-rules
32+
const tslintConfig = require('./tslint.json');
33+
return gulp.src(['modules/@angular/**/*.ts', '!modules/@angular/*/test/**'])
34+
.pipe(tslint({
35+
tslint: require('tslint').default,
36+
configuration: tslintConfig,
37+
rulesDirectory: 'dist/tools/tslint'
38+
}))
39+
.pipe(tslint.report('prose', {emitError: true}));
40+
});
41+
2842
gulp.task('tools:build', (done) => { tsc('tools/', done); });
2943

3044

modules/@angular/common/testing/location_mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ export class SpyLocation implements Location {
8585
forward() {
8686
if (this._historyIndex < (this._history.length - 1)) {
8787
this._historyIndex++;
88-
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true})
88+
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true});
8989
}
9090
}
9191

9292
back() {
9393
if (this._historyIndex > 0) {
9494
this._historyIndex--;
95-
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true})
95+
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true});
9696
}
9797
}
9898

modules/@angular/compiler_cli/src/reflector_host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ts from 'typescript';
33
import {AngularCompilerOptions, MetadataCollector, ModuleMetadata} from 'tsc-wrapped';
44
import * as fs from 'fs';
55
import * as path from 'path';
6-
import {ImportGenerator, AssetUrl} from './compiler_private'
6+
import {ImportGenerator, AssetUrl} from './compiler_private';
77

88

99
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;

modules/@angular/core/src/metadata/lifecycle_hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export enum LifecycleHooks {
1919
* values are instances of {@link SimpleChange}. See {@link OnChanges}
2020
* @stable
2121
*/
22-
export interface SimpleChanges {[propName: string]: SimpleChange}
22+
export interface SimpleChanges {[propName: string]: SimpleChange;}
2323

2424
export var LIFECYCLE_HOOKS_VALUES = [
2525
LifecycleHooks.OnInit,

modules/@angular/core/testing/async.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
* ```
1515
*/
1616
export function async(fn: Function): Function {
17-
return () => {
18-
return new Promise<void>((finishCallback, failCallback) => {
17+
return () => new Promise<void>((finishCallback, failCallback) => {
1918
var AsyncTestZoneSpec = Zone['AsyncTestZoneSpec'];
2019
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
2120
var testZone = Zone.current.fork(testZoneSpec);
2221
return testZone.run(fn);
2322
});
24-
}
2523
}

modules/@angular/core/testing/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class Log {
1111
fn(value) {
1212
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
1313
this.logItems.push(value);
14-
}
14+
};
1515
}
1616

1717
clear(): void { this.logItems = []; }

modules/@angular/core/testing/test_injector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function inject(tokens: any[], fn: Function): Function {
134134
let completer: AsyncTestCompleter = testInjector.get(AsyncTestCompleter);
135135
testInjector.execute(tokens, fn);
136136
return completer.promise;
137-
}
137+
};
138138
} else {
139139
// Return a synchronous test method with the injected tokens.
140140
return () => { return getTestInjector().execute(tokens, fn); };
@@ -155,15 +155,15 @@ export class InjectSetupWrapper {
155155
return () => {
156156
this._addProviders();
157157
return inject_impl(tokens, fn)();
158-
}
158+
};
159159
}
160160

161161
/** @Deprecated {use async(withProviders().inject())} */
162162
injectAsync(tokens: any[], fn: Function): Function {
163163
return () => {
164164
this._addProviders();
165165
return injectAsync_impl(tokens, fn)();
166-
}
166+
};
167167
}
168168
}
169169

modules/@angular/examples/core/pipes/ts/json_pipe/json_pipe_example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {bootstrap} from '@angular/platform-browser';
1212
</div>`
1313
})
1414
export class JsonPipeExample {
15-
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}}
15+
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}};
1616
}
1717
// #enddocregion
1818

modules/@angular/examples/testing/ts/testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('another component',
3333
// #enddocregion
3434

3535
// #docregion xdescribe
36-
xdescribe('some component', () => { it('has a test', () => {throw 'This test will not run.'}); });
36+
xdescribe('some component', () => { it('has a test', () => {throw 'This test will not run.';}); });
3737
describe('another component', () => {
3838
it('also has a test', () => {
3939
// This test will run.

modules/@angular/integration_test/public_api_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ export function main() {
569569
it(`should fail if public API for ${mod} has changed`, () => {
570570
var symbols = getSymbolsFromLibrary(mod);
571571
expect(diff(symbols, API[mod])).toEqual([]);
572-
})
572+
});
573573
});
574574
});
575575
}

0 commit comments

Comments
 (0)