mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
compile vs tslints services dts, null check lint
This commit is contained in:
1 parent
c31ad6fb28
commit
7813121c4d
5 files changed
+26
-4
No files matched your search
+2
-1
@@ -773,7 +773,8 @@ task("update-sublime", ["local", serverFile], function() {
|
||||
var tslintRuleDir = "scripts/tslint";
|
||||
var tslintRules = ([
|
||||
"nextLineRule",
|
||||
"noInferrableTypesRule"
|
||||
"noInferrableTypesRule",
|
||||
"noNullRule"
|
||||
]);
|
||||
var tslintRulesFiles = tslintRules.map(function(p) {
|
||||
return path.join(tslintRuleDir, p + ".ts");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../../lib/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
|
||||
const OPTION_CATCH = "check-catch";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../../lib/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public static FAILURE_STRING = "Don't use the 'null' keyword - use 'undefined' for missing values instead";
|
||||
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
return this.applyWithWalker(new NullWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
class NullWalker extends Lint.RuleWalker {
|
||||
visitNode(node: ts.Node) {
|
||||
super.visitNode(node);
|
||||
if (node.kind === ts.SyntaxKind.NullKeyword) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -38,6 +38,7 @@
|
||||
],
|
||||
"no-internal-module": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-inferrable-types": true
|
||||
"no-inferrable-types": true,
|
||||
"no-null": true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user