From 37a0e8f502195b29b63e7fd7614191a82943bed7 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 13 Apr 2016 02:09:14 -0400 Subject: [PATCH] Remove custom no-null rule, use tslint builtin no null rule --- Jakefile.js | 1 - scripts/tslint/noNullRule.ts | 20 -------------------- src/harness/compilerRunner.ts | 2 +- src/harness/fourslash.ts | 2 +- src/harness/fourslashRunner.ts | 2 +- src/harness/harness.ts | 2 +- src/harness/loggedIO.ts | 2 +- src/harness/projectsRunner.ts | 2 +- src/harness/runner.ts | 2 +- src/harness/rwcRunner.ts | 2 +- src/harness/test262Runner.ts | 2 +- src/server/server.ts | 2 +- src/services/shims.ts | 2 +- tslint.json | 2 +- 14 files changed, 12 insertions(+), 33 deletions(-) delete mode 100644 scripts/tslint/noNullRule.ts diff --git a/Jakefile.js b/Jakefile.js index 2ffdfc37807f3..f8233a3636c82 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -871,7 +871,6 @@ task("update-sublime", ["local", serverFile], function() { var tslintRuleDir = "scripts/tslint"; var tslintRules = ([ "nextLineRule", - "noNullRule", "preferConstRule", "booleanTriviaRule", "typeOperatorSpacingRule", diff --git a/scripts/tslint/noNullRule.ts b/scripts/tslint/noNullRule.ts deleted file mode 100644 index 8e9deca996b5e..0000000000000 --- a/scripts/tslint/noNullRule.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as Lint from "tslint/lib/lint"; -import * as ts from "typescript"; - - -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)); - } - } -} diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 3362cb1d375be..eb49aa78146a4 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ const enum CompilerTestType { Conformance, diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index ba7a5f20daecd..9a8bdbc486f0c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -18,7 +18,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace FourSlash { ts.disableIncrementalParsing = false; diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index 84e352359c4ac..386bd9e340c2a 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ const enum FourSlashTestType { Native, diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 4020bcd821b8d..23dde7dbd03dc 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -23,7 +23,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ // Block scoped definitions work poorly for global variables, temporarily enable var /* tslint:disable:no-var-keyword */ diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 2c4d019d45b55..f1be3a4507f66 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ interface FileInformation { contents: string; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index f5df92bedbf55..14d5beacddae9 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -1,6 +1,6 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ // Test case is json of below type in tests/cases/project/ interface ProjectRunnerTestCase { diff --git a/src/harness/runner.ts b/src/harness/runner.ts index ec8e1105c2f96..bb3cafea0a8e8 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -20,7 +20,7 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ let runners: RunnerBase[] = []; let iterations = 1; diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index ce570a7d6ad01..b059729fbbdf3 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -2,7 +2,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace RWC { function runWithIOLog(ioLog: IOLog, fn: (oldIO: Harness.IO) => void) { diff --git a/src/harness/test262Runner.ts b/src/harness/test262Runner.ts index 262145b476405..cc9957c1fac7c 100644 --- a/src/harness/test262Runner.ts +++ b/src/harness/test262Runner.ts @@ -1,6 +1,6 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ class Test262BaselineRunner extends RunnerBase { private static basePath = "internal/cases/test262"; diff --git a/src/server/server.ts b/src/server/server.ts index d9f078ac0eb53..3ffd64fe07d7c 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,7 +1,7 @@ /// /// // used in fs.writeSync -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace ts.server { const readline: NodeJS.ReadLine = require("readline"); diff --git a/src/services/shims.ts b/src/services/shims.ts index ecfcd6f84dab4..1228f2747ac54 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -19,7 +19,7 @@ let debugObjectHost = (this); // We need to use 'null' to interface with the managed side. -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ /* tslint:disable:no-in-operator */ /* @internal */ diff --git a/tslint.json b/tslint.json index ad056efaa743d..f789af46cea5a 100644 --- a/tslint.json +++ b/tslint.json @@ -38,7 +38,7 @@ "no-internal-module": true, "no-trailing-whitespace": true, "no-inferrable-types": true, - "no-null": true, + "no-null-keyword": true, "no-unused-variable": true, "boolean-trivia": true, "type-operator-spacing": true,