chore(lint): enable semicolon and variable-name tslint checks
This commit is contained in:
parent
9096481744
commit
ef0c32512c
16
gulpfile.js
16
gulpfile.js
@ -11,7 +11,7 @@ const path = require('path');
|
|||||||
|
|
||||||
const srcsToFmt = ['tools/**/*.ts'];
|
const srcsToFmt = ['tools/**/*.ts'];
|
||||||
|
|
||||||
gulp.task('lint', () => {
|
gulp.task('format:enforce', () => {
|
||||||
const format = require('gulp-clang-format');
|
const format = require('gulp-clang-format');
|
||||||
const clangFormat = require('clang-format');
|
const clangFormat = require('clang-format');
|
||||||
return gulp.src(srcsToFmt).pipe(
|
return gulp.src(srcsToFmt).pipe(
|
||||||
@ -25,6 +25,20 @@ gulp.task('format', () => {
|
|||||||
format.format('file', clangFormat)).pipe(gulp.dest('.'));
|
format.format('file', clangFormat)).pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('lint', ['format:enforce', 'tools:build'], () => {
|
||||||
|
const tslint = require('gulp-tslint');
|
||||||
|
// Built-in rules are at
|
||||||
|
// https://github.com/palantir/tslint#supported-rules
|
||||||
|
const tslintConfig = require('./tslint.json');
|
||||||
|
return gulp.src(['modules/@angular/**/*.ts', '!modules/@angular/*/test/**'])
|
||||||
|
.pipe(tslint({
|
||||||
|
tslint: require('tslint').default,
|
||||||
|
configuration: tslintConfig,
|
||||||
|
rulesDirectory: 'dist/tools/tslint'
|
||||||
|
}))
|
||||||
|
.pipe(tslint.report('prose', {emitError: true}));
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('tools:build', (done) => { tsc('tools/', done); });
|
gulp.task('tools:build', (done) => { tsc('tools/', done); });
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,14 +85,14 @@ export class SpyLocation implements Location {
|
|||||||
forward() {
|
forward() {
|
||||||
if (this._historyIndex < (this._history.length - 1)) {
|
if (this._historyIndex < (this._history.length - 1)) {
|
||||||
this._historyIndex++;
|
this._historyIndex++;
|
||||||
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true})
|
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
back() {
|
back() {
|
||||||
if (this._historyIndex > 0) {
|
if (this._historyIndex > 0) {
|
||||||
this._historyIndex--;
|
this._historyIndex--;
|
||||||
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true})
|
ObservableWrapper.callEmit(this._subject, {'url': this.path(), 'pop': true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import * as ts from 'typescript';
|
|||||||
import {AngularCompilerOptions, MetadataCollector, ModuleMetadata} from 'tsc-wrapped';
|
import {AngularCompilerOptions, MetadataCollector, ModuleMetadata} from 'tsc-wrapped';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {ImportGenerator, AssetUrl} from './compiler_private'
|
import {ImportGenerator, AssetUrl} from './compiler_private';
|
||||||
|
|
||||||
|
|
||||||
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
|
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
|
||||||
|
@ -19,7 +19,7 @@ export enum LifecycleHooks {
|
|||||||
* values are instances of {@link SimpleChange}. See {@link OnChanges}
|
* values are instances of {@link SimpleChange}. See {@link OnChanges}
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface SimpleChanges {[propName: string]: SimpleChange}
|
export interface SimpleChanges {[propName: string]: SimpleChange;}
|
||||||
|
|
||||||
export var LIFECYCLE_HOOKS_VALUES = [
|
export var LIFECYCLE_HOOKS_VALUES = [
|
||||||
LifecycleHooks.OnInit,
|
LifecycleHooks.OnInit,
|
||||||
|
@ -14,12 +14,10 @@
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function async(fn: Function): Function {
|
export function async(fn: Function): Function {
|
||||||
return () => {
|
return () => new Promise<void>((finishCallback, failCallback) => {
|
||||||
return new Promise<void>((finishCallback, failCallback) => {
|
|
||||||
var AsyncTestZoneSpec = Zone['AsyncTestZoneSpec'];
|
var AsyncTestZoneSpec = Zone['AsyncTestZoneSpec'];
|
||||||
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
|
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
|
||||||
var testZone = Zone.current.fork(testZoneSpec);
|
var testZone = Zone.current.fork(testZoneSpec);
|
||||||
return testZone.run(fn);
|
return testZone.run(fn);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ export class Log {
|
|||||||
fn(value) {
|
fn(value) {
|
||||||
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
|
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
|
||||||
this.logItems.push(value);
|
this.logItems.push(value);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
clear(): void { this.logItems = []; }
|
clear(): void { this.logItems = []; }
|
||||||
|
@ -134,7 +134,7 @@ export function inject(tokens: any[], fn: Function): Function {
|
|||||||
let completer: AsyncTestCompleter = testInjector.get(AsyncTestCompleter);
|
let completer: AsyncTestCompleter = testInjector.get(AsyncTestCompleter);
|
||||||
testInjector.execute(tokens, fn);
|
testInjector.execute(tokens, fn);
|
||||||
return completer.promise;
|
return completer.promise;
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
// Return a synchronous test method with the injected tokens.
|
// Return a synchronous test method with the injected tokens.
|
||||||
return () => { return getTestInjector().execute(tokens, fn); };
|
return () => { return getTestInjector().execute(tokens, fn); };
|
||||||
@ -155,7 +155,7 @@ export class InjectSetupWrapper {
|
|||||||
return () => {
|
return () => {
|
||||||
this._addProviders();
|
this._addProviders();
|
||||||
return inject_impl(tokens, fn)();
|
return inject_impl(tokens, fn)();
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Deprecated {use async(withProviders().inject())} */
|
/** @Deprecated {use async(withProviders().inject())} */
|
||||||
@ -163,7 +163,7 @@ export class InjectSetupWrapper {
|
|||||||
return () => {
|
return () => {
|
||||||
this._addProviders();
|
this._addProviders();
|
||||||
return injectAsync_impl(tokens, fn)();
|
return injectAsync_impl(tokens, fn)();
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import {bootstrap} from '@angular/platform-browser';
|
|||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
export class JsonPipeExample {
|
export class JsonPipeExample {
|
||||||
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}}
|
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}};
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ describe('another component',
|
|||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
// #docregion xdescribe
|
// #docregion xdescribe
|
||||||
xdescribe('some component', () => { it('has a test', () => {throw 'This test will not run.'}); });
|
xdescribe('some component', () => { it('has a test', () => {throw 'This test will not run.';}); });
|
||||||
describe('another component', () => {
|
describe('another component', () => {
|
||||||
it('also has a test', () => {
|
it('also has a test', () => {
|
||||||
// This test will run.
|
// This test will run.
|
||||||
|
@ -569,7 +569,7 @@ export function main() {
|
|||||||
it(`should fail if public API for ${mod} has changed`, () => {
|
it(`should fail if public API for ${mod} has changed`, () => {
|
||||||
var symbols = getSymbolsFromLibrary(mod);
|
var symbols = getSymbolsFromLibrary(mod);
|
||||||
expect(diff(symbols, API[mod])).toEqual([]);
|
expect(diff(symbols, API[mod])).toEqual([]);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ const IGNORE =
|
|||||||
originalStack: true,
|
originalStack: true,
|
||||||
wrapperMessage: true,
|
wrapperMessage: true,
|
||||||
wrapperStack: true, '@@observable': true
|
wrapperStack: true, '@@observable': true
|
||||||
}
|
};
|
||||||
|
|
||||||
function collectTopLevelSymbols(prefix: string, lib: any):
|
function collectTopLevelSymbols(prefix: string, lib: any):
|
||||||
string[] {
|
string[] {
|
||||||
|
@ -221,7 +221,7 @@ class UpgradeNg1ComponentAdapter implements OnInit, OnChanges, DoCheck {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
if (!this.directive.bindToController && this.directive.controller) {
|
if (!this.directive.bindToController && this.directive.controller) {
|
||||||
this.buildController(this.directive.controller)
|
this.buildController(this.directive.controller);
|
||||||
}
|
}
|
||||||
var link = this.directive.link;
|
var link = this.directive.link;
|
||||||
if (typeof link == 'object') link = (<angular.IDirectivePrePost>link).pre;
|
if (typeof link == 'object') link = (<angular.IDirectivePrePost>link).pre;
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"rules": {
|
"rules": {
|
||||||
"requireInternalWithUnderscore": true,
|
|
||||||
"requireParameterType": true,
|
|
||||||
"requireReturnType": true,
|
|
||||||
"duplicateModuleImport": true,
|
|
||||||
"semicolon": true,
|
"semicolon": true,
|
||||||
"variable-name": false
|
"variable-name": false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user