Merge pull request #8056 from weswigham/remove-custom-no-null-rule
Remove custom no-null rule, use tslint builtin no null rule
This commit is contained in:
commit
5b0b09ca62
|
@ -903,7 +903,6 @@ task("update-sublime", ["local", serverFile], function() {
|
|||
var tslintRuleDir = "scripts/tslint";
|
||||
var tslintRules = ([
|
||||
"nextLineRule",
|
||||
"noNullRule",
|
||||
"preferConstRule",
|
||||
"booleanTriviaRule",
|
||||
"typeOperatorSpacingRule",
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="harness.ts" />
|
||||
/// <reference path="runnerbase.ts" />
|
||||
/// <reference path="typeWriter.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
const enum CompilerTestType {
|
||||
Conformance,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/// <reference path="harnessLanguageService.ts" />
|
||||
/// <reference path="harness.ts" />
|
||||
/// <reference path="fourslashRunner.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
namespace FourSlash {
|
||||
ts.disableIncrementalParsing = false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
///<reference path="fourslash.ts" />
|
||||
///<reference path="harness.ts"/>
|
||||
///<reference path="runnerbase.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
const enum FourSlashTestType {
|
||||
Native,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
/// <reference path="external\chai.d.ts"/>
|
||||
/// <reference path="sourceMapRecorder.ts"/>
|
||||
/// <reference path="runnerbase.ts"/>
|
||||
/* 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 */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="..\..\src\compiler\sys.ts" />
|
||||
/// <reference path="..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\src\harness\runnerbase.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
interface FileInformation {
|
||||
contents: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
///<reference path="harness.ts" />
|
||||
///<reference path="runnerbase.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
// Test case is json of below type in tests/cases/project/
|
||||
interface ProjectRunnerTestCase {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/// <reference path="rwcRunner.ts" />
|
||||
/// <reference path="harness.ts" />
|
||||
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
let runners: RunnerBase[] = [];
|
||||
let iterations = 1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/// <reference path="runnerbase.ts" />
|
||||
/// <reference path="loggedIO.ts" />
|
||||
/// <reference path="..\compiler\commandLineParser.ts"/>
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
namespace RWC {
|
||||
function runWithIOLog(ioLog: IOLog, fn: (oldIO: Harness.IO) => void) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path="harness.ts" />
|
||||
/// <reference path="runnerbase.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
class Test262BaselineRunner extends RunnerBase {
|
||||
private static basePath = "internal/cases/test262";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="node.d.ts" />
|
||||
/// <reference path="session.ts" />
|
||||
// used in fs.writeSync
|
||||
/* tslint:disable:no-null */
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
namespace ts.server {
|
||||
const readline: NodeJS.ReadLine = require("readline");
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
let debugObjectHost = (<any>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 */
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue