mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-13 04:57:55 -06:00
use tslint@next
This commit is contained in:
parent
b3f0a71082
commit
15f505e6aa
@ -35,7 +35,7 @@
|
||||
"browserify": "latest",
|
||||
"istanbul": "latest",
|
||||
"mocha-fivemat-progress-reporter": "latest",
|
||||
"tslint": "latest",
|
||||
"tslint": "next",
|
||||
"tsd": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public static FAILURE_STRING_FACTORY = (name: string, currently: string) => `Tag boolean argument as '${name}' (currently '${currently}')`;
|
||||
@ -19,7 +18,7 @@ class BooleanTriviaWalker extends Lint.RuleWalker {
|
||||
|
||||
visitCallExpression(node: ts.CallExpression) {
|
||||
super.visitCallExpression(node);
|
||||
if (node.arguments) {
|
||||
if (node.arguments) {
|
||||
const targetCallSignature = this.checker.getResolvedSignature(node);
|
||||
if (!!targetCallSignature) {
|
||||
const targetParameters = targetCallSignature.getParameters();
|
||||
@ -37,7 +36,7 @@ class BooleanTriviaWalker extends Lint.RuleWalker {
|
||||
let triviaContent: string;
|
||||
const ranges = ts.getLeadingCommentRanges(arg.getFullText(), 0);
|
||||
if (ranges && ranges.length === 1 && ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia) {
|
||||
triviaContent = arg.getFullText().slice(ranges[0].pos + 2, ranges[0].end - 2); //+/-2 to remove /**/
|
||||
triviaContent = arg.getFullText().slice(ranges[0].pos + 2, ranges[0].end - 2); // +/-2 to remove /**/
|
||||
}
|
||||
if (triviaContent !== param.getName()) {
|
||||
this.addFailure(this.createFailure(arg.getStart(source), arg.getWidth(source), Rule.FAILURE_STRING_FACTORY(param.getName(), triviaContent)));
|
||||
@ -45,6 +44,6 @@ class BooleanTriviaWalker extends Lint.RuleWalker {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
const OPTION_CATCH = "check-catch";
|
||||
const OPTION_ELSE = "check-else";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
@ -101,13 +101,13 @@ class PreferConstWalker extends Lint.RuleWalker {
|
||||
this.visitBindingLiteralExpression(node as (ts.ArrayLiteralExpression | ts.ObjectLiteralExpression));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private visitBindingLiteralExpression(node: ts.ArrayLiteralExpression | ts.ObjectLiteralExpression) {
|
||||
if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) {
|
||||
const pattern = node as ts.ObjectLiteralExpression;
|
||||
for (const element of pattern.properties) {
|
||||
if (element.name.kind === ts.SyntaxKind.Identifier) {
|
||||
this.markAssignment(element.name as ts.Identifier)
|
||||
this.markAssignment(element.name as ts.Identifier);
|
||||
}
|
||||
else if (isBindingPattern(element.name)) {
|
||||
this.visitBindingPatternIdentifiers(element.name as ts.BindingPattern);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user