Skip to content

Commit c90e192

Browse files
committed
chore(tslint): disallow variable names that look like keywords.
We've had issues such as the one I documented: microsoft/TypeScript#5187 This tslint check prevents this happening again. This change also updates to the newest tslint which gets typings from npm. Closes angular#4970
1 parent 25ddd87 commit c90e192

File tree

7 files changed

+708
-275
lines changed

7 files changed

+708
-275
lines changed

gulpfile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,15 @@ gulp.task('lint', ['build.tools'], function() {
294294
// https://github.com/palantir/tslint#supported-rules
295295
var tslintConfig = {
296296
"rules": {
297-
"semicolon": true,
297+
"requireParameterType": true,
298298
"requireReturnType": true,
299-
"requireParameterType": true
299+
"semicolon": true,
300+
"variable-name": [true, "ban-keywords"]
300301
}
301302
};
302303
return gulp.src(['modules/angular2/src/**/*.ts', '!modules/angular2/src/testing/**'])
303304
.pipe(tslint({
304-
tslint: require('tslint'),
305+
tslint: require('tslint').default,
305306
configuration: tslintConfig,
306307
rulesDirectory: 'dist/tools/tslint'
307308
}))

modules/angular2/src/core/facade/intl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export enum NumberFormatStyle {
4848
}
4949

5050
export class NumberFormatter {
51-
static format(number: number, locale: string, style: NumberFormatStyle,
51+
static format(num: number, locale: string, style: NumberFormatStyle,
5252
{minimumIntegerDigits = 1, minimumFractionDigits = 0, maximumFractionDigits = 3,
5353
currency, currencyAsSymbol = false}: {
5454
minimumIntegerDigits?: number,
@@ -67,7 +67,7 @@ export class NumberFormatter {
6767
intlOptions.currency = currency;
6868
intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
6969
}
70-
return new Intl.NumberFormat(locale, intlOptions).format(number);
70+
return new Intl.NumberFormat(locale, intlOptions).format(num);
7171
}
7272
}
7373

0 commit comments

Comments
 (0)