compile vs tslints services dts, null check lint

This commit is contained in:
Wesley Wigham committed 2015-08-25 18:37:52 -07:00
1 parent c31ad6fb28
commit 7813121c4d
5 files changed
+26 -4

No files matched your search

+2 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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" />
+20
View File
@@ -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
View File
@@ -38,6 +38,7 @@
],
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-inferrable-types": true
"no-inferrable-types": true,
"no-null": true
}
}