From f6c7d8e5bc8580f28be586c783b68304e71f986b Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Thu, 21 Dec 2017 18:41:39 -0500 Subject: [PATCH 01/12] codeExample support init implementation --- docs/_layouts/rule.html | 11 ++++++++++- scripts/buildDocs.ts | 6 ++++++ src/language/rule/rule.ts | 8 ++++++++ src/rules/curlyRule.ts | 12 ++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html index c24dac879c4..4f90a75a5a1 100644 --- a/docs/_layouts/rule.html +++ b/docs/_layouts/rule.html @@ -5,6 +5,15 @@ {% if page.descriptionDetails %} {{page.descriptionDetails | markdownify}} {% endif %} + +{% if page.codeExamples %} +

Code examples:

+
Passing
+ {{page.codeExamples.pass | markdownify}} +
Failing
+ {{page.codeExamples.fail | markdownify}} +{% endif %} + {% if page.rationale %}
Rationale
{{page.rationale | markdownify}} @@ -28,7 +37,7 @@
Notes:

Config

{{page.optionsDescription | markdownify}} -
Examples
+
Config examples
{% for example in page.optionExamples %}
 "{{page.ruleName}}": {{example}}
diff --git a/scripts/buildDocs.ts b/scripts/buildDocs.ts
index 48da428a5ea..4fd494fdb3e 100644
--- a/scripts/buildDocs.ts
+++ b/scripts/buildDocs.ts
@@ -195,6 +195,12 @@ function generateRuleFile(metadata: IRuleMetadata): string {
             typeof example === "string" ? example : stringify(example));
     }
 
+    /* Prep code examples for markdownify */
+    if (metadata.codeExamples) {
+        metadata.codeExamples.pass = `\`\`\`${metadata.codeExamples.pass}\`\`\``;
+        metadata.codeExamples.fail = `\`\`\`${metadata.codeExamples.fail}\`\`\``;
+    }
+
     const yamlData = generateJekyllData(metadata, "rule", "Rule", metadata.ruleName);
     yamlData.optionsJSON = JSON.stringify(metadata.options, undefined, 2);
     return `---\n${yaml.safeDump(yamlData, {lineWidth: 140} as any)}---`;
diff --git a/src/language/rule/rule.ts b/src/language/rule/rule.ts
index d52189eab2c..d7b99543808 100644
--- a/src/language/rule/rule.ts
+++ b/src/language/rule/rule.ts
@@ -89,6 +89,14 @@ export interface IRuleMetadata {
      * Whether or not the rule use for TypeScript only. If `false`, this rule may be used with .js files.
      */
     typescriptOnly: boolean;
+
+    /**
+     * Examples demonstrating what the lint rule will pass and fail
+     */
+    codeExamples?: {
+        pass: string;
+        fail: string;
+    };
 }
 
 export type RuleType = "functionality" | "maintainability" | "style" | "typescript";
diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts
index 099c7ea5120..9b9691feb0e 100644
--- a/src/rules/curlyRule.ts
+++ b/src/rules/curlyRule.ts
@@ -24,6 +24,7 @@ import {
 import * as ts from "typescript";
 
 import * as Lint from "../index";
+import { dedent } from "../utils";
 
 const OPTION_AS_NEEDED = "as-needed";
 const OPTION_IGNORE_SAME_LINE = "ignore-same-line";
@@ -72,6 +73,17 @@ export class Rule extends Lint.Rules.AbstractRule {
         type: "functionality",
         typescriptOnly: false,
         hasFix: true,
+        codeExamples: {
+            pass: dedent`
+                if (x > 0) {
+                    doStuff();
+                }
+            `,
+            fail: dedent`
+                if (x > 0)
+                    doStuff();
+            `,
+        },
     };
     /* tslint:enable:object-literal-sort-keys */
 

From 06a295429a32420230fda61062928543a0b8be46 Mon Sep 17 00:00:00 2001
From: Aaron Ervin 
Date: Wed, 3 Jan 2018 17:52:32 -0500
Subject: [PATCH 02/12] dedent/markdown errors need revisting

---
 src/rules/curlyRule.ts | 111 +++++++++++++++++++++++++++++------------
 1 file changed, 79 insertions(+), 32 deletions(-)

diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts
index 9b9691feb0e..0381df5de64 100644
--- a/src/rules/curlyRule.ts
+++ b/src/rules/curlyRule.ts
@@ -24,7 +24,6 @@ import {
 import * as ts from "typescript";
 
 import * as Lint from "../index";
-import { dedent } from "../utils";
 
 const OPTION_AS_NEEDED = "as-needed";
 const OPTION_IGNORE_SAME_LINE = "ignore-same-line";
@@ -59,10 +58,7 @@ export class Rule extends Lint.Rules.AbstractRule {
             type: "array",
             items: {
                 type: "string",
-                enum: [
-                    OPTION_AS_NEEDED,
-                    OPTION_IGNORE_SAME_LINE,
-                ],
+                enum: [OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE],
             },
         },
         optionExamples: [
@@ -74,12 +70,12 @@ export class Rule extends Lint.Rules.AbstractRule {
         typescriptOnly: false,
         hasFix: true,
         codeExamples: {
-            pass: dedent`
+            pass: `
                 if (x > 0) {
                     doStuff();
                 }
             `,
-            fail: dedent`
+            fail: Lint.Utils.dedent`
                 if (x > 0)
                     doStuff();
             `,
@@ -97,16 +93,23 @@ export class Rule extends Lint.Rules.AbstractRule {
             return this.applyWithFunction(sourceFile, walkAsNeeded);
         }
 
-        return this.applyWithWalker(new CurlyWalker(sourceFile, this.ruleName, {
-            ignoreSameLine: this.ruleArguments.indexOf(OPTION_IGNORE_SAME_LINE) !== -1,
-        }));
+        return this.applyWithWalker(
+            new CurlyWalker(sourceFile, this.ruleName, {
+                ignoreSameLine:
+                    this.ruleArguments.indexOf(OPTION_IGNORE_SAME_LINE) !== -1,
+            }),
+        );
     }
 }
 
 function walkAsNeeded(ctx: Lint.WalkContext): void {
     ts.forEachChild(ctx.sourceFile, function cb(node) {
         if (isBlock(node) && isBlockUnnecessary(node)) {
-            ctx.addFailureAt(node.statements.pos - 1, 1, Rule.FAILURE_STRING_AS_NEEDED);
+            ctx.addFailureAt(
+                node.statements.pos - 1,
+                1,
+                Rule.FAILURE_STRING_AS_NEEDED,
+            );
         }
         ts.forEachChild(node, cb);
     });
@@ -114,9 +117,13 @@ function walkAsNeeded(ctx: Lint.WalkContext): void {
 
 function isBlockUnnecessary(node: ts.Block): boolean {
     const parent = node.parent!;
-    if (node.statements.length !== 1) { return false; }
+    if (node.statements.length !== 1) {
+        return false;
+    }
     const statement = node.statements[0];
-    if (isIterationStatement(parent)) { return true; }
+    if (isIterationStatement(parent)) {
+        return true;
+    }
     /*
     Watch out for this case:
     if (so) {
@@ -125,10 +132,15 @@ function isBlockUnnecessary(node: ts.Block): boolean {
     } else
         bar();
     */
-    return isIfStatement(parent) && !(isIfStatement(statement)
-        && statement.elseStatement === undefined
-        && parent.thenStatement === node
-        && parent.elseStatement !== undefined);
+    return (
+        isIfStatement(parent) &&
+        !(
+            isIfStatement(statement) &&
+            statement.elseStatement === undefined &&
+            parent.thenStatement === node &&
+            parent.elseStatement !== undefined
+        )
+    );
 }
 
 class CurlyWalker extends Lint.AbstractWalker {
@@ -138,7 +150,10 @@ class CurlyWalker extends Lint.AbstractWalker {
                 this.checkStatement(node.statement, node, 0, node.end);
             } else if (isIfStatement(node)) {
                 this.checkStatement(node.thenStatement, node, 0);
-                if (node.elseStatement !== undefined && node.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
+                if (
+                    node.elseStatement !== undefined &&
+                    node.elseStatement.kind !== ts.SyntaxKind.IfStatement
+                ) {
                     this.checkStatement(node.elseStatement, node, 5);
                 }
             }
@@ -147,20 +162,38 @@ class CurlyWalker extends Lint.AbstractWalker {
         return ts.forEachChild(sourceFile, cb);
     }
 
-    private checkStatement(statement: ts.Statement, node: ts.IterationStatement | ts.IfStatement, childIndex: number, end = statement.end) {
-        const sameLine = isSameLine(this.sourceFile, statement.pos, statement.end);
-        if (statement.kind !== ts.SyntaxKind.Block &&
-            !(this.options.ignoreSameLine && sameLine)) {
+    private checkStatement(
+        statement: ts.Statement,
+        node: ts.IterationStatement | ts.IfStatement,
+        childIndex: number,
+        end = statement.end,
+    ) {
+        const sameLine = isSameLine(
+            this.sourceFile,
+            statement.pos,
+            statement.end,
+        );
+        if (
+            statement.kind !== ts.SyntaxKind.Block &&
+            !(this.options.ignoreSameLine && sameLine)
+        ) {
             const token = node.getChildAt(childIndex, this.sourceFile);
             const tokenText = ts.tokenToString(token.kind)!;
             this.addFailure(
-                token.end - tokenText.length, end, Rule.FAILURE_STRING_FACTORY(tokenText),
-                this.createMissingBraceFix(statement, node, sameLine));
+                token.end - tokenText.length,
+                end,
+                Rule.FAILURE_STRING_FACTORY(tokenText),
+                this.createMissingBraceFix(statement, node, sameLine),
+            );
         }
     }
 
     /** Generate the necessary replacement to add braces to a statement that needs them. */
-    private createMissingBraceFix(statement: ts.Statement, node: ts.IterationStatement | ts.IfStatement, sameLine: boolean) {
+    private createMissingBraceFix(
+        statement: ts.Statement,
+        node: ts.IterationStatement | ts.IfStatement,
+        sameLine: boolean,
+    ) {
         if (sameLine) {
             return [
                 Lint.Replacement.appendText(statement.pos, " {"),
@@ -168,16 +201,30 @@ class CurlyWalker extends Lint.AbstractWalker {
             ];
         } else {
             const match = /\n([\t ])/.exec(node.getFullText(this.sourceFile)); // determine which character to use (tab or space)
-            const indentation = match === null ?
-                "" :
-                // indentation should match start of statement
-                match[1].repeat(ts.getLineAndCharacterOfPosition(this.sourceFile, node.getStart(this.sourceFile)).character);
-
-            const maybeCarriageReturn = this.sourceFile.text[this.sourceFile.getLineEndOfPosition(node.pos) - 1] === "\r" ? "\r" : "";
+            const indentation =
+                match === null
+                    ? ""
+                    : // indentation should match start of statement
+                      match[1].repeat(
+                          ts.getLineAndCharacterOfPosition(
+                              this.sourceFile,
+                              node.getStart(this.sourceFile),
+                          ).character,
+                      );
+
+            const maybeCarriageReturn =
+                this.sourceFile.text[
+                    this.sourceFile.getLineEndOfPosition(node.pos) - 1
+                ] === "\r"
+                    ? "\r"
+                    : "";
 
             return [
                 Lint.Replacement.appendText(statement.pos, " {"),
-                Lint.Replacement.appendText(statement.end, `${maybeCarriageReturn}\n${indentation}}`),
+                Lint.Replacement.appendText(
+                    statement.end,
+                    `${maybeCarriageReturn}\n${indentation}}`,
+                ),
             ];
         }
     }

From 658e5937c7c7f6b7716903d982cd33ce839de241 Mon Sep 17 00:00:00 2001
From: Aaron Ervin 
Date: Sat, 13 Jan 2018 21:59:02 -0500
Subject: [PATCH 03/12] updates to new code example scheme as per ajafff

---
 docs/_layouts/rule.html   | 22 +++++++++++------
 scripts/buildDocs.ts      | 23 ++++++++++-------
 src/language/rule/rule.ts | 12 ++++++---
 src/rules/curlyRule.ts    | 52 ++++++++++++++++++++++++++++++---------
 4 files changed, 77 insertions(+), 32 deletions(-)

diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html
index 4f90a75a5a1..c27a8e748e1 100644
--- a/docs/_layouts/rule.html
+++ b/docs/_layouts/rule.html
@@ -6,14 +6,6 @@
    {{page.descriptionDetails | markdownify}}
 {% endif %}
 
-{% if page.codeExamples %}
-    

Code examples:

-
Passing
- {{page.codeExamples.pass | markdownify}} -
Failing
- {{page.codeExamples.fail | markdownify}} -{% endif %} - {% if page.rationale %}
Rationale
{{page.rationale | markdownify}} @@ -48,3 +40,17 @@
Schema
 {{page.optionsJSON}}
 
+ +{% if page.codeExamples %} +

Code examples:

+ {% for codeExample in page.codeExamples %} +

{{ codeExample.description }}

+ {{ codeExample.config | markdownify }} +
Passes
+ {{ codeExample.pass | markdownify }} + {% if codeExample.fail %} +
Fails
+ {{ codeExample.fail | markdownify }} + {% endif %} + {% endfor %} +{% endif %} diff --git a/scripts/buildDocs.ts b/scripts/buildDocs.ts index 4fd494fdb3e..4f70d71cb32 100644 --- a/scripts/buildDocs.ts +++ b/scripts/buildDocs.ts @@ -33,19 +33,19 @@ import * as fs from "fs"; import * as glob from "glob"; -import stringify = require("json-stringify-pretty-compact"); import * as yaml from "js-yaml"; +import stringify = require("json-stringify-pretty-compact"); import * as path from "path"; import * as rimraf from "rimraf"; -import {IFormatterMetadata} from "../lib/language/formatter/formatter"; -import {IRuleMetadata} from "../lib/language/rule/rule"; +import { IFormatterMetadata } from "../lib/language/formatter/formatter"; +import { ICodeExample, IRuleMetadata } from "../lib/language/rule/rule"; type Metadata = IRuleMetadata | IFormatterMetadata; interface Documented { metadata: Metadata; -}; +} interface IDocumentation { /** @@ -71,7 +71,7 @@ interface IDocumentation { /** * Function to generate individual documentation pages. */ - pageGenerator: (metadata: any) => string; + pageGenerator(metadata: any): string; /** * Documentation subdirectory to output to. @@ -148,7 +148,7 @@ function buildSingleModuleDocumentation(documentation: IDocumentation, modulePat // tslint:disable-next-line:no-var-requires const module = require(modulePath); const DocumentedItem = module[documentation.exportName] as Documented; - if (DocumentedItem != null && DocumentedItem.metadata != null) { + if (DocumentedItem !== null && DocumentedItem.metadata !== null) { // Build the module's page. const { metadata } = DocumentedItem; const fileData = documentation.pageGenerator(metadata); @@ -195,10 +195,15 @@ function generateRuleFile(metadata: IRuleMetadata): string { typeof example === "string" ? example : stringify(example)); } - /* Prep code examples for markdownify */ if (metadata.codeExamples) { - metadata.codeExamples.pass = `\`\`\`${metadata.codeExamples.pass}\`\`\``; - metadata.codeExamples.fail = `\`\`\`${metadata.codeExamples.fail}\`\`\``; + metadata.codeExamples = metadata.codeExamples.map((example: ICodeExample) => { + example.pass = `\`\`\`ts\n${example.pass.trim()}\n\`\`\``; + if (example.fail) { + example.fail = `\`\`\`ts\n${example.fail.trim()}\n\`\`\``; + } + example.config = `\`\`\`json\n${example.config.trim()}\n\`\`\``; + return example; + }); } const yamlData = generateJekyllData(metadata, "rule", "Rule", metadata.ruleName); diff --git a/src/language/rule/rule.ts b/src/language/rule/rule.ts index d7b99543808..0d3cf97db23 100644 --- a/src/language/rule/rule.ts +++ b/src/language/rule/rule.ts @@ -93,16 +93,20 @@ export interface IRuleMetadata { /** * Examples demonstrating what the lint rule will pass and fail */ - codeExamples?: { - pass: string; - fail: string; - }; + codeExamples?: ICodeExample[]; } export type RuleType = "functionality" | "maintainability" | "style" | "typescript"; export type RuleSeverity = "warning" | "error" | "off"; +export interface ICodeExample { + config: any; + description: string; + pass: string; + fail?: string; +} + export interface IOptions { ruleArguments: any[]; ruleSeverity: RuleSeverity; diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts index 0381df5de64..371858c06dc 100644 --- a/src/rules/curlyRule.ts +++ b/src/rules/curlyRule.ts @@ -69,17 +69,47 @@ export class Rule extends Lint.Rules.AbstractRule { type: "functionality", typescriptOnly: false, hasFix: true, - codeExamples: { - pass: ` - if (x > 0) { - doStuff(); - } - `, - fail: Lint.Utils.dedent` - if (x > 0) - doStuff(); - `, - }, + codeExamples: [ + { + description: "Require curly braces whenever possible (default)", + config: Lint.Utils.dedent` + "rules": { "curly": true } + `, + pass: Lint.Utils.dedent` + if (x > 0) { + doStuff(); + } + `, + fail: Lint.Utils.dedent` + if (x > 0) + doStuff(); + `, + }, + { + description: "Make an exception for single-line instances", + config: Lint.Utils.dedent` + "rules": { "curly": [true, "ignore-same-line"] } + `, + pass: Lint.Utils.dedent` + if (x > 0) doStuff(); + `, + }, + { + description: "Error on unnecessary curly braces", + config: Lint.Utils.dedent` + "rules": { "curly": [true, "as-needed"] } + `, + pass: Lint.Utils.dedent` + if (x > 0) + doStuff(); + `, + fail: Lint.Utils.dedent` + if (x > 0) { + doStuff(); + } + `, + }, + ], }; /* tslint:enable:object-literal-sort-keys */ From d075a5abacd43a1ef3d282338e24b595884d0454 Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Sat, 13 Jan 2018 22:06:25 -0500 Subject: [PATCH 04/12] reverts prettier style updates in curly --- src/rules/curlyRule.ts | 104 +++++++++++------------------------------ 1 file changed, 28 insertions(+), 76 deletions(-) diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts index 371858c06dc..588e1f8e119 100644 --- a/src/rules/curlyRule.ts +++ b/src/rules/curlyRule.ts @@ -58,7 +58,10 @@ export class Rule extends Lint.Rules.AbstractRule { type: "array", items: { type: "string", - enum: [OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE], + enum: [ + OPTION_AS_NEEDED, + OPTION_IGNORE_SAME_LINE, + ], }, }, optionExamples: [ @@ -123,23 +126,16 @@ export class Rule extends Lint.Rules.AbstractRule { return this.applyWithFunction(sourceFile, walkAsNeeded); } - return this.applyWithWalker( - new CurlyWalker(sourceFile, this.ruleName, { - ignoreSameLine: - this.ruleArguments.indexOf(OPTION_IGNORE_SAME_LINE) !== -1, - }), - ); + return this.applyWithWalker(new CurlyWalker(sourceFile, this.ruleName, { + ignoreSameLine: this.ruleArguments.indexOf(OPTION_IGNORE_SAME_LINE) !== -1, + })); } } function walkAsNeeded(ctx: Lint.WalkContext): void { ts.forEachChild(ctx.sourceFile, function cb(node) { if (isBlock(node) && isBlockUnnecessary(node)) { - ctx.addFailureAt( - node.statements.pos - 1, - 1, - Rule.FAILURE_STRING_AS_NEEDED, - ); + ctx.addFailureAt(node.statements.pos - 1, 1, Rule.FAILURE_STRING_AS_NEEDED); } ts.forEachChild(node, cb); }); @@ -147,13 +143,9 @@ function walkAsNeeded(ctx: Lint.WalkContext): void { function isBlockUnnecessary(node: ts.Block): boolean { const parent = node.parent!; - if (node.statements.length !== 1) { - return false; - } + if (node.statements.length !== 1) { return false; } const statement = node.statements[0]; - if (isIterationStatement(parent)) { - return true; - } + if (isIterationStatement(parent)) { return true; } /* Watch out for this case: if (so) { @@ -162,15 +154,10 @@ function isBlockUnnecessary(node: ts.Block): boolean { } else bar(); */ - return ( - isIfStatement(parent) && - !( - isIfStatement(statement) && - statement.elseStatement === undefined && - parent.thenStatement === node && - parent.elseStatement !== undefined - ) - ); + return isIfStatement(parent) && !(isIfStatement(statement) + && statement.elseStatement === undefined + && parent.thenStatement === node + && parent.elseStatement !== undefined); } class CurlyWalker extends Lint.AbstractWalker { @@ -180,10 +167,7 @@ class CurlyWalker extends Lint.AbstractWalker { this.checkStatement(node.statement, node, 0, node.end); } else if (isIfStatement(node)) { this.checkStatement(node.thenStatement, node, 0); - if ( - node.elseStatement !== undefined && - node.elseStatement.kind !== ts.SyntaxKind.IfStatement - ) { + if (node.elseStatement !== undefined && node.elseStatement.kind !== ts.SyntaxKind.IfStatement) { this.checkStatement(node.elseStatement, node, 5); } } @@ -192,38 +176,20 @@ class CurlyWalker extends Lint.AbstractWalker { return ts.forEachChild(sourceFile, cb); } - private checkStatement( - statement: ts.Statement, - node: ts.IterationStatement | ts.IfStatement, - childIndex: number, - end = statement.end, - ) { - const sameLine = isSameLine( - this.sourceFile, - statement.pos, - statement.end, - ); - if ( - statement.kind !== ts.SyntaxKind.Block && - !(this.options.ignoreSameLine && sameLine) - ) { + private checkStatement(statement: ts.Statement, node: ts.IterationStatement | ts.IfStatement, childIndex: number, end = statement.end) { + const sameLine = isSameLine(this.sourceFile, statement.pos, statement.end); + if (statement.kind !== ts.SyntaxKind.Block && + !(this.options.ignoreSameLine && sameLine)) { const token = node.getChildAt(childIndex, this.sourceFile); const tokenText = ts.tokenToString(token.kind)!; this.addFailure( - token.end - tokenText.length, - end, - Rule.FAILURE_STRING_FACTORY(tokenText), - this.createMissingBraceFix(statement, node, sameLine), - ); + token.end - tokenText.length, end, Rule.FAILURE_STRING_FACTORY(tokenText), + this.createMissingBraceFix(statement, node, sameLine)); } } /** Generate the necessary replacement to add braces to a statement that needs them. */ - private createMissingBraceFix( - statement: ts.Statement, - node: ts.IterationStatement | ts.IfStatement, - sameLine: boolean, - ) { + private createMissingBraceFix(statement: ts.Statement, node: ts.IterationStatement | ts.IfStatement, sameLine: boolean) { if (sameLine) { return [ Lint.Replacement.appendText(statement.pos, " {"), @@ -231,30 +197,16 @@ class CurlyWalker extends Lint.AbstractWalker { ]; } else { const match = /\n([\t ])/.exec(node.getFullText(this.sourceFile)); // determine which character to use (tab or space) - const indentation = - match === null - ? "" - : // indentation should match start of statement - match[1].repeat( - ts.getLineAndCharacterOfPosition( - this.sourceFile, - node.getStart(this.sourceFile), - ).character, - ); + const indentation = match === null ? + "" : + // indentation should match start of statement + match[1].repeat(ts.getLineAndCharacterOfPosition(this.sourceFile, node.getStart(this.sourceFile)).character); - const maybeCarriageReturn = - this.sourceFile.text[ - this.sourceFile.getLineEndOfPosition(node.pos) - 1 - ] === "\r" - ? "\r" - : ""; + const maybeCarriageReturn = this.sourceFile.text[this.sourceFile.getLineEndOfPosition(node.pos) - 1] === "\r" ? "\r" : ""; return [ Lint.Replacement.appendText(statement.pos, " {"), - Lint.Replacement.appendText( - statement.end, - `${maybeCarriageReturn}\n${indentation}}`, - ), + Lint.Replacement.appendText(statement.end, `${maybeCarriageReturn}\n${indentation}}`), ]; } } From 938420c39566204ec5dcb46089fa78447b0e6a0c Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Sat, 13 Jan 2018 22:15:12 -0500 Subject: [PATCH 05/12] curly docs he -> they --- src/rules/curlyRule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts index 588e1f8e119..59e09b1b614 100644 --- a/src/rules/curlyRule.ts +++ b/src/rules/curlyRule.ts @@ -45,7 +45,7 @@ export class Rule extends Lint.Rules.AbstractRule { \`\`\` In the code above, the author almost certainly meant for both \`foo++\` and \`bar++\` - to be executed only if \`foo === bar\`. However, he forgot braces and \`bar++\` will be executed + to be executed only if \`foo === bar\`. However, they forgot braces and \`bar++\` will be executed no matter what. This rule could prevent such a mistake.`, optionsDescription: Lint.Utils.dedent` One of the following options may be provided: From 57c418861fc7c7baff2fbea0f9d0edd2fc9fc74f Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Sat, 13 Jan 2018 22:20:59 -0500 Subject: [PATCH 06/12] ICodeExample config type any -> string --- src/language/rule/rule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/language/rule/rule.ts b/src/language/rule/rule.ts index 0d3cf97db23..b3c7ea4a919 100644 --- a/src/language/rule/rule.ts +++ b/src/language/rule/rule.ts @@ -101,7 +101,7 @@ export type RuleType = "functionality" | "maintainability" | "style" | "typescri export type RuleSeverity = "warning" | "error" | "off"; export interface ICodeExample { - config: any; + config: string; description: string; pass: string; fail?: string; From 12bcc3a05b8158b1f2844fadd1cf6f2bde76255d Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Sun, 14 Jan 2018 10:11:26 -0500 Subject: [PATCH 07/12] Code example blocks now color-coded according to pass/fail (grn/red) --- docs/_layouts/rule.html | 12 ++++++++++-- docs/_sass/_base.scss | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html index c27a8e748e1..0c98753c31f 100644 --- a/docs/_layouts/rule.html +++ b/docs/_layouts/rule.html @@ -42,15 +42,23 @@
Schema
{% if page.codeExamples %} +

Code examples:

{% for codeExample in page.codeExamples %} +

{{ codeExample.description }}

{{ codeExample.config | markdownify }}
Passes
- {{ codeExample.pass | markdownify }} +
+ {{ codeExample.pass | markdownify }} +
{% if codeExample.fail %} -
Fails
+
Fails
+
{{ codeExample.fail | markdownify }} +
{% endif %} +
{% endfor %} +
{% endif %} diff --git a/docs/_sass/_base.scss b/docs/_sass/_base.scss index 52e6af050e6..8b8d5a4737a 100644 --- a/docs/_sass/_base.scss +++ b/docs/_sass/_base.scss @@ -173,3 +173,24 @@ figcaption { } } } + + .wrapper__code-examples { + & .wrapper__code-example { + margin-bottom: 64px; + &:last-of-type { + margin-bottom: 24px; + } + } + /* Overwrite default code-block styling */ + & .code-example { + & pre, & .highlight { + background: transparent; + } + } + & .code-example.pass { + background-color: #f1fff1 !important; + } + & .code-example.fail { + background-color: #fff5f5 !important; + } + } From 227ae4504ee9b6f0c31fc352f665b3cbedc0b15c Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Mon, 15 Jan 2018 19:53:40 -0500 Subject: [PATCH 08/12] updates to buildDocs --- docs/_layouts/rule.html | 6 +++--- docs/_sass/_base.scss | 4 ++-- src/rules/curlyRule.ts | 11 +++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html index 0c98753c31f..9a7af5b5346 100644 --- a/docs/_layouts/rule.html +++ b/docs/_layouts/rule.html @@ -46,14 +46,14 @@
Schema

Code examples:

{% for codeExample in page.codeExamples %}
-

{{ codeExample.description }}

+
{{ codeExample.description }}
{{ codeExample.config | markdownify }} -
Passes
+
Passes
{{ codeExample.pass | markdownify }}
{% if codeExample.fail %} -
Fails
+
Fails
{{ codeExample.fail | markdownify }}
diff --git a/docs/_sass/_base.scss b/docs/_sass/_base.scss index 8b8d5a4737a..7b470804d79 100644 --- a/docs/_sass/_base.scss +++ b/docs/_sass/_base.scss @@ -188,9 +188,9 @@ figcaption { } } & .code-example.pass { - background-color: #f1fff1 !important; + background-color: #f1fff1; } & .code-example.fail { - background-color: #fff5f5 !important; + background-color: #fff5f5; } } diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts index 59e09b1b614..63de62cdfc3 100644 --- a/src/rules/curlyRule.ts +++ b/src/rules/curlyRule.ts @@ -86,6 +86,8 @@ export class Rule extends Lint.Rules.AbstractRule { fail: Lint.Utils.dedent` if (x > 0) doStuff(); + + if (x > 0) doStuff(); `, }, { @@ -96,6 +98,10 @@ export class Rule extends Lint.Rules.AbstractRule { pass: Lint.Utils.dedent` if (x > 0) doStuff(); `, + fail: Lint.Utils.dedent` + if (x > 0) + doStuff() + `, }, { description: "Error on unnecessary curly braces", @@ -105,6 +111,11 @@ export class Rule extends Lint.Rules.AbstractRule { pass: Lint.Utils.dedent` if (x > 0) doStuff(); + + if (x > 0) { + customerUpdates.push(getInfo(customerId)); + return customerUpdates; + } `, fail: Lint.Utils.dedent` if (x > 0) { From 5c78e6a161d9404f2244e39df0363378e64a20fe Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Mon, 9 Apr 2018 09:07:02 -0400 Subject: [PATCH 09/12] gemfile.lock??; removes unnecessary html/scss --- docs/Gemfile.lock | 238 ++ docs/_layouts/rule.html | 8 +- docs/_sass/_base.scss | 38 +- .../2015/12/10/a-new-tslint-website.html | 122 + .../03/31/sharable-configurations-rules.html | 203 ++ docs/_site/2016/11/17/new-for-4.0.html | 163 ++ docs/_site/Gemfile | 2 + docs/_site/Gemfile.lock | 238 ++ docs/_site/circle.yml | 7 + docs/_site/css/main.css | 989 ++++++++ docs/_site/develop/contributing/index.html | 178 ++ .../develop/custom-formatters/index.html | 162 ++ docs/_site/develop/custom-rules/index.html | 224 ++ .../custom-rules/performance-tips.html | 295 +++ .../develop/custom-rules/walker-design.html | 320 +++ docs/_site/develop/docs/index.html | 163 ++ docs/_site/develop/testing-rules/index.html | 322 +++ docs/_site/feed.xml | 232 ++ docs/_site/formatters/checkstyle/index.html | 130 + docs/_site/formatters/codeFrame/index.html | 134 ++ docs/_site/formatters/filesList/index.html | 120 + docs/_site/formatters/index.html | 155 ++ docs/_site/formatters/json/index.html | 142 ++ docs/_site/formatters/junit/index.html | 132 + docs/_site/formatters/msbuild/index.html | 123 + docs/_site/formatters/pmd/index.html | 128 + docs/_site/formatters/prose/index.html | 120 + docs/_site/formatters/stylish/index.html | 127 + docs/_site/formatters/tap/index.html | 137 ++ docs/_site/formatters/verbose/index.html | 123 + docs/_site/formatters/vso/index.html | 125 + docs/_site/index.html | 117 + docs/_site/news/index.html | 202 ++ .../adjacent-overload-signatures/index.html | 150 ++ docs/_site/rules/align/index.html | 174 ++ docs/_site/rules/array-type/index.html | 170 ++ docs/_site/rules/arrow-parens/index.html | 161 ++ .../rules/arrow-return-shorthand/index.html | 156 ++ docs/_site/rules/await-promise/index.html | 173 ++ .../_site/rules/ban-comma-operator/index.html | 170 ++ docs/_site/rules/ban-types/index.html | 160 ++ docs/_site/rules/ban/index.html | 212 ++ .../index.html | 139 ++ docs/_site/rules/callable-types/index.html | 148 ++ docs/_site/rules/class-name/index.html | 141 ++ docs/_site/rules/comment-format/index.html | 201 ++ docs/_site/rules/completed-docs/index.html | 553 +++++ docs/_site/rules/curly/index.html | 263 ++ .../rules/cyclomatic-complexity/index.html | 168 ++ docs/_site/rules/deprecation/index.html | 151 ++ docs/_site/rules/encoding/index.html | 137 ++ docs/_site/rules/eofline/index.html | 153 ++ docs/_site/rules/file-header/index.html | 162 ++ docs/_site/rules/forin/index.html | 150 ++ docs/_site/rules/import-blacklist/index.html | 155 ++ docs/_site/rules/import-spacing/index.html | 137 ++ docs/_site/rules/indent/index.html | 197 ++ docs/_site/rules/index.html | 2129 +++++++++++++++++ docs/_site/rules/interface-name/index.html | 166 ++ .../interface-over-type-literal/index.html | 152 ++ docs/_site/rules/jsdoc-format/index.html | 171 ++ docs/_site/rules/label-position/index.html | 147 ++ docs/_site/rules/linebreak-style/index.html | 162 ++ .../match-default-export-name/index.html | 150 ++ .../rules/max-classes-per-file/index.html | 167 ++ .../rules/max-file-line-count/index.html | 146 ++ docs/_site/rules/max-line-length/index.html | 191 ++ docs/_site/rules/member-access/index.html | 181 ++ docs/_site/rules/member-ordering/index.html | 266 ++ docs/_site/rules/new-parens/index.html | 141 ++ .../rules/newline-before-return/index.html | 141 ++ .../rules/newline-per-chained-call/index.html | 139 ++ .../index.html | 155 ++ docs/_site/rules/no-any/index.html | 150 ++ docs/_site/rules/no-arg/index.html | 144 ++ docs/_site/rules/no-bitwise/index.html | 151 ++ .../no-boolean-literal-compare/index.html | 150 ++ .../no-conditional-assignment/index.html | 147 ++ .../no-consecutive-blank-lines/index.html | 159 ++ docs/_site/rules/no-console/index.html | 146 ++ docs/_site/rules/no-construct/index.html | 147 ++ docs/_site/rules/no-debugger/index.html | 141 ++ docs/_site/rules/no-default-export/index.html | 147 ++ .../rules/no-duplicate-imports/index.html | 144 ++ .../_site/rules/no-duplicate-super/index.html | 141 ++ .../rules/no-duplicate-switch-case/index.html | 137 ++ .../rules/no-duplicate-variable/index.html | 157 ++ docs/_site/rules/no-dynamic-delete/index.html | 148 ++ .../_site/rules/no-empty-interface/index.html | 146 ++ docs/_site/rules/no-empty/index.html | 154 ++ docs/_site/rules/no-eval/index.html | 144 ++ .../rules/no-floating-promises/index.html | 169 ++ docs/_site/rules/no-for-in-array/index.html | 161 ++ .../rules/no-implicit-dependencies/index.html | 165 ++ .../rules/no-import-side-effect/index.html | 162 ++ .../rules/no-inferrable-types/index.html | 178 ++ .../no-inferred-empty-object-type/index.html | 148 ++ .../_site/rules/no-internal-module/index.html | 152 ++ .../no-invalid-template-strings/index.html | 137 ++ docs/_site/rules/no-invalid-this/index.html | 160 ++ .../rules/no-irregular-whitespace/index.html | 146 ++ docs/_site/rules/no-magic-numbers/index.html | 155 ++ .../rules/no-mergeable-namespace/index.html | 146 ++ docs/_site/rules/no-misused-new/index.html | 146 ++ docs/_site/rules/no-namespace/index.html | 174 ++ .../rules/no-non-null-assertion/index.html | 150 ++ docs/_site/rules/no-null-keyword/index.html | 152 ++ .../index.html | 157 ++ .../rules/no-parameter-properties/index.html | 152 ++ .../no-parameter-reassignment/index.html | 137 ++ .../_site/rules/no-redundant-jsdoc/index.html | 146 ++ .../rules/no-reference-import/index.html | 142 ++ docs/_site/rules/no-reference/index.html | 143 ++ .../_site/rules/no-require-imports/index.html | 141 ++ docs/_site/rules/no-return-await/index.html | 153 ++ .../rules/no-shadowed-variable/index.html | 213 ++ docs/_site/rules/no-sparse-arrays/index.html | 141 ++ docs/_site/rules/no-string-literal/index.html | 155 ++ docs/_site/rules/no-string-throw/index.html | 142 ++ .../rules/no-submodule-imports/index.html | 154 ++ .../no-switch-case-fall-through/index.html | 166 ++ .../_site/rules/no-this-assignment/index.html | 163 ++ .../rules/no-trailing-whitespace/index.html | 177 ++ docs/_site/rules/no-unbound-method/index.html | 157 ++ .../index.html | 139 ++ .../rules/no-unnecessary-class/index.html | 163 ++ .../no-unnecessary-initializer/index.html | 146 ++ .../rules/no-unnecessary-qualifier/index.html | 150 ++ .../no-unnecessary-type-assertion/index.html | 154 ++ docs/_site/rules/no-unsafe-any/index.html | 152 ++ docs/_site/rules/no-unsafe-finally/index.html | 150 ++ .../rules/no-unused-expression/index.html | 171 ++ .../_site/rules/no-unused-variable/index.html | 197 ++ .../rules/no-use-before-declare/index.html | 156 ++ docs/_site/rules/no-var-keyword/index.html | 149 ++ docs/_site/rules/no-var-requires/index.html | 151 ++ .../_site/rules/no-void-expression/index.html | 154 ++ .../rules/number-literal-format/index.html | 137 ++ .../object-literal-key-quotes/index.html | 189 ++ .../rules/object-literal-shorthand/index.html | 156 ++ .../rules/object-literal-sort-keys/index.html | 170 ++ docs/_site/rules/one-line/index.html | 169 ++ .../one-variable-per-declaration/index.html | 156 ++ .../rules/only-arrow-functions/index.html | 163 ++ docs/_site/rules/ordered-imports/index.html | 251 ++ .../prefer-conditional-expression/index.html | 152 ++ docs/_site/rules/prefer-const/index.html | 171 ++ docs/_site/rules/prefer-for-of/index.html | 141 ++ .../prefer-function-over-method/index.html | 149 ++ .../rules/prefer-method-signature/index.html | 146 ++ .../rules/prefer-object-spread/index.html | 150 ++ docs/_site/rules/prefer-readonly/index.html | 169 ++ docs/_site/rules/prefer-switch/index.html | 151 ++ docs/_site/rules/prefer-template/index.html | 147 ++ .../rules/promise-function-async/index.html | 155 ++ docs/_site/rules/quotemark/index.html | 177 ++ docs/_site/rules/radix/index.html | 146 ++ .../rules/restrict-plus-operands/index.html | 146 ++ docs/_site/rules/return-undefined/index.html | 146 ++ docs/_site/rules/semicolon/index.html | 192 ++ .../space-before-function-paren/index.html | 208 ++ .../rules/space-within-parens/index.html | 147 ++ .../strict-boolean-expressions/index.html | 227 ++ .../rules/strict-type-predicates/index.html | 155 ++ docs/_site/rules/switch-default/index.html | 137 ++ .../_site/rules/switch-final-break/index.html | 149 ++ docs/_site/rules/trailing-comma/index.html | 320 +++ docs/_site/rules/triple-equals/index.html | 162 ++ .../rules/type-literal-delimiter/index.html | 148 ++ .../_site/rules/typedef-whitespace/index.html | 277 +++ docs/_site/rules/typedef/index.html | 177 ++ docs/_site/rules/typeof-compare/index.html | 137 ++ .../_site/rules/unified-signatures/index.html | 146 ++ .../use-default-type-parameter/index.html | 148 ++ docs/_site/rules/use-isnan/index.html | 143 ++ docs/_site/rules/variable-name/index.html | 169 ++ docs/_site/rules/whitespace/index.html | 183 ++ docs/_site/usage/cli/index.html | 290 +++ docs/_site/usage/configuration/index.html | 273 +++ docs/_site/usage/library/index.html | 205 ++ docs/_site/usage/rule-flags/index.html | 185 ++ docs/_site/usage/third-party-tools/index.html | 162 ++ docs/_site/usage/type-checking/index.html | 183 ++ 183 files changed, 32768 insertions(+), 21 deletions(-) create mode 100644 docs/Gemfile.lock create mode 100644 docs/_site/2015/12/10/a-new-tslint-website.html create mode 100644 docs/_site/2016/03/31/sharable-configurations-rules.html create mode 100644 docs/_site/2016/11/17/new-for-4.0.html create mode 100644 docs/_site/Gemfile create mode 100644 docs/_site/Gemfile.lock create mode 100644 docs/_site/circle.yml create mode 100644 docs/_site/css/main.css create mode 100644 docs/_site/develop/contributing/index.html create mode 100644 docs/_site/develop/custom-formatters/index.html create mode 100644 docs/_site/develop/custom-rules/index.html create mode 100644 docs/_site/develop/custom-rules/performance-tips.html create mode 100644 docs/_site/develop/custom-rules/walker-design.html create mode 100644 docs/_site/develop/docs/index.html create mode 100644 docs/_site/develop/testing-rules/index.html create mode 100644 docs/_site/feed.xml create mode 100644 docs/_site/formatters/checkstyle/index.html create mode 100644 docs/_site/formatters/codeFrame/index.html create mode 100644 docs/_site/formatters/filesList/index.html create mode 100644 docs/_site/formatters/index.html create mode 100644 docs/_site/formatters/json/index.html create mode 100644 docs/_site/formatters/junit/index.html create mode 100644 docs/_site/formatters/msbuild/index.html create mode 100644 docs/_site/formatters/pmd/index.html create mode 100644 docs/_site/formatters/prose/index.html create mode 100644 docs/_site/formatters/stylish/index.html create mode 100644 docs/_site/formatters/tap/index.html create mode 100644 docs/_site/formatters/verbose/index.html create mode 100644 docs/_site/formatters/vso/index.html create mode 100644 docs/_site/index.html create mode 100644 docs/_site/news/index.html create mode 100644 docs/_site/rules/adjacent-overload-signatures/index.html create mode 100644 docs/_site/rules/align/index.html create mode 100644 docs/_site/rules/array-type/index.html create mode 100644 docs/_site/rules/arrow-parens/index.html create mode 100644 docs/_site/rules/arrow-return-shorthand/index.html create mode 100644 docs/_site/rules/await-promise/index.html create mode 100644 docs/_site/rules/ban-comma-operator/index.html create mode 100644 docs/_site/rules/ban-types/index.html create mode 100644 docs/_site/rules/ban/index.html create mode 100644 docs/_site/rules/binary-expression-operand-order/index.html create mode 100644 docs/_site/rules/callable-types/index.html create mode 100644 docs/_site/rules/class-name/index.html create mode 100644 docs/_site/rules/comment-format/index.html create mode 100644 docs/_site/rules/completed-docs/index.html create mode 100644 docs/_site/rules/curly/index.html create mode 100644 docs/_site/rules/cyclomatic-complexity/index.html create mode 100644 docs/_site/rules/deprecation/index.html create mode 100644 docs/_site/rules/encoding/index.html create mode 100644 docs/_site/rules/eofline/index.html create mode 100644 docs/_site/rules/file-header/index.html create mode 100644 docs/_site/rules/forin/index.html create mode 100644 docs/_site/rules/import-blacklist/index.html create mode 100644 docs/_site/rules/import-spacing/index.html create mode 100644 docs/_site/rules/indent/index.html create mode 100644 docs/_site/rules/index.html create mode 100644 docs/_site/rules/interface-name/index.html create mode 100644 docs/_site/rules/interface-over-type-literal/index.html create mode 100644 docs/_site/rules/jsdoc-format/index.html create mode 100644 docs/_site/rules/label-position/index.html create mode 100644 docs/_site/rules/linebreak-style/index.html create mode 100644 docs/_site/rules/match-default-export-name/index.html create mode 100644 docs/_site/rules/max-classes-per-file/index.html create mode 100644 docs/_site/rules/max-file-line-count/index.html create mode 100644 docs/_site/rules/max-line-length/index.html create mode 100644 docs/_site/rules/member-access/index.html create mode 100644 docs/_site/rules/member-ordering/index.html create mode 100644 docs/_site/rules/new-parens/index.html create mode 100644 docs/_site/rules/newline-before-return/index.html create mode 100644 docs/_site/rules/newline-per-chained-call/index.html create mode 100644 docs/_site/rules/no-angle-bracket-type-assertion/index.html create mode 100644 docs/_site/rules/no-any/index.html create mode 100644 docs/_site/rules/no-arg/index.html create mode 100644 docs/_site/rules/no-bitwise/index.html create mode 100644 docs/_site/rules/no-boolean-literal-compare/index.html create mode 100644 docs/_site/rules/no-conditional-assignment/index.html create mode 100644 docs/_site/rules/no-consecutive-blank-lines/index.html create mode 100644 docs/_site/rules/no-console/index.html create mode 100644 docs/_site/rules/no-construct/index.html create mode 100644 docs/_site/rules/no-debugger/index.html create mode 100644 docs/_site/rules/no-default-export/index.html create mode 100644 docs/_site/rules/no-duplicate-imports/index.html create mode 100644 docs/_site/rules/no-duplicate-super/index.html create mode 100644 docs/_site/rules/no-duplicate-switch-case/index.html create mode 100644 docs/_site/rules/no-duplicate-variable/index.html create mode 100644 docs/_site/rules/no-dynamic-delete/index.html create mode 100644 docs/_site/rules/no-empty-interface/index.html create mode 100644 docs/_site/rules/no-empty/index.html create mode 100644 docs/_site/rules/no-eval/index.html create mode 100644 docs/_site/rules/no-floating-promises/index.html create mode 100644 docs/_site/rules/no-for-in-array/index.html create mode 100644 docs/_site/rules/no-implicit-dependencies/index.html create mode 100644 docs/_site/rules/no-import-side-effect/index.html create mode 100644 docs/_site/rules/no-inferrable-types/index.html create mode 100644 docs/_site/rules/no-inferred-empty-object-type/index.html create mode 100644 docs/_site/rules/no-internal-module/index.html create mode 100644 docs/_site/rules/no-invalid-template-strings/index.html create mode 100644 docs/_site/rules/no-invalid-this/index.html create mode 100644 docs/_site/rules/no-irregular-whitespace/index.html create mode 100644 docs/_site/rules/no-magic-numbers/index.html create mode 100644 docs/_site/rules/no-mergeable-namespace/index.html create mode 100644 docs/_site/rules/no-misused-new/index.html create mode 100644 docs/_site/rules/no-namespace/index.html create mode 100644 docs/_site/rules/no-non-null-assertion/index.html create mode 100644 docs/_site/rules/no-null-keyword/index.html create mode 100644 docs/_site/rules/no-object-literal-type-assertion/index.html create mode 100644 docs/_site/rules/no-parameter-properties/index.html create mode 100644 docs/_site/rules/no-parameter-reassignment/index.html create mode 100644 docs/_site/rules/no-redundant-jsdoc/index.html create mode 100644 docs/_site/rules/no-reference-import/index.html create mode 100644 docs/_site/rules/no-reference/index.html create mode 100644 docs/_site/rules/no-require-imports/index.html create mode 100644 docs/_site/rules/no-return-await/index.html create mode 100644 docs/_site/rules/no-shadowed-variable/index.html create mode 100644 docs/_site/rules/no-sparse-arrays/index.html create mode 100644 docs/_site/rules/no-string-literal/index.html create mode 100644 docs/_site/rules/no-string-throw/index.html create mode 100644 docs/_site/rules/no-submodule-imports/index.html create mode 100644 docs/_site/rules/no-switch-case-fall-through/index.html create mode 100644 docs/_site/rules/no-this-assignment/index.html create mode 100644 docs/_site/rules/no-trailing-whitespace/index.html create mode 100644 docs/_site/rules/no-unbound-method/index.html create mode 100644 docs/_site/rules/no-unnecessary-callback-wrapper/index.html create mode 100644 docs/_site/rules/no-unnecessary-class/index.html create mode 100644 docs/_site/rules/no-unnecessary-initializer/index.html create mode 100644 docs/_site/rules/no-unnecessary-qualifier/index.html create mode 100644 docs/_site/rules/no-unnecessary-type-assertion/index.html create mode 100644 docs/_site/rules/no-unsafe-any/index.html create mode 100644 docs/_site/rules/no-unsafe-finally/index.html create mode 100644 docs/_site/rules/no-unused-expression/index.html create mode 100644 docs/_site/rules/no-unused-variable/index.html create mode 100644 docs/_site/rules/no-use-before-declare/index.html create mode 100644 docs/_site/rules/no-var-keyword/index.html create mode 100644 docs/_site/rules/no-var-requires/index.html create mode 100644 docs/_site/rules/no-void-expression/index.html create mode 100644 docs/_site/rules/number-literal-format/index.html create mode 100644 docs/_site/rules/object-literal-key-quotes/index.html create mode 100644 docs/_site/rules/object-literal-shorthand/index.html create mode 100644 docs/_site/rules/object-literal-sort-keys/index.html create mode 100644 docs/_site/rules/one-line/index.html create mode 100644 docs/_site/rules/one-variable-per-declaration/index.html create mode 100644 docs/_site/rules/only-arrow-functions/index.html create mode 100644 docs/_site/rules/ordered-imports/index.html create mode 100644 docs/_site/rules/prefer-conditional-expression/index.html create mode 100644 docs/_site/rules/prefer-const/index.html create mode 100644 docs/_site/rules/prefer-for-of/index.html create mode 100644 docs/_site/rules/prefer-function-over-method/index.html create mode 100644 docs/_site/rules/prefer-method-signature/index.html create mode 100644 docs/_site/rules/prefer-object-spread/index.html create mode 100644 docs/_site/rules/prefer-readonly/index.html create mode 100644 docs/_site/rules/prefer-switch/index.html create mode 100644 docs/_site/rules/prefer-template/index.html create mode 100644 docs/_site/rules/promise-function-async/index.html create mode 100644 docs/_site/rules/quotemark/index.html create mode 100644 docs/_site/rules/radix/index.html create mode 100644 docs/_site/rules/restrict-plus-operands/index.html create mode 100644 docs/_site/rules/return-undefined/index.html create mode 100644 docs/_site/rules/semicolon/index.html create mode 100644 docs/_site/rules/space-before-function-paren/index.html create mode 100644 docs/_site/rules/space-within-parens/index.html create mode 100644 docs/_site/rules/strict-boolean-expressions/index.html create mode 100644 docs/_site/rules/strict-type-predicates/index.html create mode 100644 docs/_site/rules/switch-default/index.html create mode 100644 docs/_site/rules/switch-final-break/index.html create mode 100644 docs/_site/rules/trailing-comma/index.html create mode 100644 docs/_site/rules/triple-equals/index.html create mode 100644 docs/_site/rules/type-literal-delimiter/index.html create mode 100644 docs/_site/rules/typedef-whitespace/index.html create mode 100644 docs/_site/rules/typedef/index.html create mode 100644 docs/_site/rules/typeof-compare/index.html create mode 100644 docs/_site/rules/unified-signatures/index.html create mode 100644 docs/_site/rules/use-default-type-parameter/index.html create mode 100644 docs/_site/rules/use-isnan/index.html create mode 100644 docs/_site/rules/variable-name/index.html create mode 100644 docs/_site/rules/whitespace/index.html create mode 100644 docs/_site/usage/cli/index.html create mode 100644 docs/_site/usage/configuration/index.html create mode 100644 docs/_site/usage/library/index.html create mode 100644 docs/_site/usage/rule-flags/index.html create mode 100644 docs/_site/usage/third-party-tools/index.html create mode 100644 docs/_site/usage/type-checking/index.html diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100644 index 00000000000..3eaa6478c32 --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,238 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.2.9) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorator (1.1.0) + commonmarker (0.17.7.1) + ruby-enum (~> 0.5) + concurrent-ruby (1.0.5) + ethon (0.11.0) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) + ffi (1.9.18) + forwardable-extended (2.6.0) + gemoji (3.0.0) + github-pages (172) + activesupport (= 4.2.9) + github-pages-health-check (= 1.3.5) + jekyll (= 3.6.2) + jekyll-avatar (= 0.5.0) + jekyll-coffeescript (= 1.0.2) + jekyll-commonmark-ghpages (= 0.1.3) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.9.2) + jekyll-gist (= 1.4.1) + jekyll-github-metadata (= 2.9.3) + jekyll-mentions (= 1.2.0) + jekyll-optional-front-matter (= 0.3.0) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.2.0) + jekyll-redirect-from (= 0.12.1) + jekyll-relative-links (= 0.5.2) + jekyll-remote-theme (= 0.2.3) + jekyll-sass-converter (= 1.5.0) + jekyll-seo-tag (= 2.3.0) + jekyll-sitemap (= 1.1.1) + jekyll-swiss (= 0.4.0) + jekyll-theme-architect (= 0.1.0) + jekyll-theme-cayman (= 0.1.0) + jekyll-theme-dinky (= 0.1.0) + jekyll-theme-hacker (= 0.1.0) + jekyll-theme-leap-day (= 0.1.0) + jekyll-theme-merlot (= 0.1.0) + jekyll-theme-midnight (= 0.1.0) + jekyll-theme-minimal (= 0.1.0) + jekyll-theme-modernist (= 0.1.0) + jekyll-theme-primer (= 0.5.2) + jekyll-theme-slate (= 0.1.0) + jekyll-theme-tactile (= 0.1.0) + jekyll-theme-time-machine (= 0.1.0) + jekyll-titles-from-headings (= 0.5.0) + jemoji (= 0.8.1) + kramdown (= 1.14.0) + liquid (= 4.0.0) + listen (= 3.0.6) + mercenary (~> 0.3) + minima (= 2.1.1) + rouge (= 2.2.1) + terminal-table (~> 1.4) + github-pages-health-check (1.3.5) + addressable (~> 2.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 2.0) + typhoeus (~> 0.7) + html-pipeline (2.7.1) + activesupport (>= 2) + nokogiri (>= 1.4) + i18n (0.9.1) + concurrent-ruby (~> 1.0) + jekyll (3.6.2) + addressable (~> 2.4) + colorator (~> 1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.14) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 3) + safe_yaml (~> 1.0) + jekyll-avatar (0.5.0) + jekyll (~> 3.0) + jekyll-coffeescript (1.0.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.1.0) + commonmarker (~> 0.14) + jekyll (>= 3.0, < 4.0) + jekyll-commonmark-ghpages (0.1.3) + commonmarker (~> 0.17.6) + jekyll-commonmark (~> 1) + rouge (~> 2) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.9.2) + jekyll (~> 3.3) + jekyll-gist (1.4.1) + octokit (~> 4.2) + jekyll-github-metadata (2.9.3) + jekyll (~> 3.1) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.2.0) + activesupport (~> 4.0) + html-pipeline (~> 2.3) + jekyll (~> 3.0) + jekyll-optional-front-matter (0.3.0) + jekyll (~> 3.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.2.0) + jekyll (~> 3.0) + jekyll-redirect-from (0.12.1) + jekyll (~> 3.3) + jekyll-relative-links (0.5.2) + jekyll (~> 3.3) + jekyll-remote-theme (0.2.3) + jekyll (~> 3.5) + rubyzip (>= 1.2.1, < 3.0) + typhoeus (>= 0.7, < 2.0) + jekyll-sass-converter (1.5.0) + sass (~> 3.4) + jekyll-seo-tag (2.3.0) + jekyll (~> 3.3) + jekyll-sitemap (1.1.1) + jekyll (~> 3.3) + jekyll-swiss (0.4.0) + jekyll-theme-architect (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.5.2) + jekyll (~> 3.5) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.2) + jekyll-theme-slate (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.0) + jekyll (~> 3.3) + jekyll-watch (1.5.1) + listen (~> 3.0) + jemoji (0.8.1) + activesupport (~> 4.0, >= 4.2.9) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0) + kramdown (1.14.0) + liquid (4.0.0) + listen (3.0.6) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) + mercenary (0.3.6) + mini_portile2 (2.3.0) + minima (2.1.1) + jekyll (~> 3.3) + minitest (5.10.3) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + pathutil (0.16.1) + forwardable-extended (~> 2.6) + public_suffix (2.0.5) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (2.2.1) + ruby-enum (0.7.1) + i18n + rubyzip (1.2.1) + safe_yaml (1.0.4) + sass (3.5.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.4) + thread_safe (~> 0.1) + unicode-display_width (1.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + github-pages + +BUNDLED WITH + 1.16.1 diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html index 9a7af5b5346..42ea25a5518 100644 --- a/docs/_layouts/rule.html +++ b/docs/_layouts/rule.html @@ -42,23 +42,21 @@
Schema
{% if page.codeExamples %} -

Code examples:

{% for codeExample in page.codeExamples %}
{{ codeExample.description }}
{{ codeExample.config | markdownify }}
Passes
-
+
{{ codeExample.pass | markdownify }}
{% if codeExample.fail %} -
Fails
-
+
Fails
+
{{ codeExample.fail | markdownify }}
{% endif %}
{% endfor %} -
{% endif %} diff --git a/docs/_sass/_base.scss b/docs/_sass/_base.scss index 7b470804d79..a1e7726d4de 100644 --- a/docs/_sass/_base.scss +++ b/docs/_sass/_base.scss @@ -174,23 +174,29 @@ figcaption { } } - .wrapper__code-examples { - & .wrapper__code-example { - margin-bottom: 64px; - &:last-of-type { - margin-bottom: 24px; +.wrapper__code-example { + margin-bottom: 64px; + + &:last-of-type { + margin-bottom: 24px; + } + + h6.heading-fail { + // Strong red + color: #d14; + } + + .code-example { + // Light green + background-color: #f1fff1; + + &.code-example-fail { + // Light red + background-color: #fff5f5; } - } - /* Overwrite default code-block styling */ - & .code-example { - & pre, & .highlight { + + pre, .highlight { background: transparent; } } - & .code-example.pass { - background-color: #f1fff1; - } - & .code-example.fail { - background-color: #fff5f5; - } - } +} diff --git a/docs/_site/2015/12/10/a-new-tslint-website.html b/docs/_site/2015/12/10/a-new-tslint-website.html new file mode 100644 index 00000000000..f362acb439e --- /dev/null +++ b/docs/_site/2015/12/10/a-new-tslint-website.html @@ -0,0 +1,122 @@ + + + + + + + + + A New TSLint Website + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

A New TSLint Website

+ +
+ +
+

As TSLint has grown in usage and popularity alongside of TypeScript, it also has +evolved in terms of functionality and complexity. Today, all sorts of projects and products, +from Angular 2 to the TypeScript compiler itself use TSLint +to help keep their code high-quality.

+ +

Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. +For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long TSLint README. +Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. +There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.

+ +

This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:

+ +
    +
  • A documentation overhaul that will provide +more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.
  • +
  • A new --init feature in the TSLint CLI that will make it easier to +generate a sensible initial tslint.json config file.
  • +
  • An improved contributor experience that will make things easier for those who want to contribute code to TSLint.
  • +
+ +

Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!

+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/2016/03/31/sharable-configurations-rules.html b/docs/_site/2016/03/31/sharable-configurations-rules.html new file mode 100644 index 00000000000..065d65b4638 --- /dev/null +++ b/docs/_site/2016/03/31/sharable-configurations-rules.html @@ -0,0 +1,203 @@ + + + + + + + + + Sharable Configurations and Rules + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

Sharable Configurations and Rules

+ +
+ +
+

With the release of TSLint v3.7.0 comes a few new features that will make configuration files (aka tslint.json files) +easier to maintain and share. The crux of the changes is a new extends field, which when provided indicates that a configuration +file augments another configuration file.

+ +

Example

+ +

Let’s imagine you’ve created some custom rules and want to share them with others. +You also have a couple of configurations for them you want to share.

+ +

Here’s the layout of our NPM package, which we’ll call shared-tslint-rules. We have a directory with rules, +as well as a few different config files for TSLint.

+ +
shared-tslint-rules
+├── package.json
+├── rules
+│   ├── noAdditionRule.js
+│   ├── noErrorsRule.js
+│   └── noExcessiveCommentingRule.js
+├── tslint-base.json
+├── tslint-config.json
+└── tslint-crazy-config.js
+
+ +

Our starting-point config file just references the directory the custom rules are in +but doesn’t enable any of them:

+ +

tslint-base.json:

+ +
{
+    "rulesDirectory": "./rules"
+}
+
+ +

We also want to provide a sane default config for our rules. +Notice how it extends our base config, so we don’t have to redeclare rulesDirectory here:

+ +

tslint-config.json:

+ +
{
+    "extends": "./tslint-base.json",
+    "rules": {
+        "no-errors": true,
+        "no-addition": false
+    }
+}
+
+ +

Finally, we can even make a crazy config file for fun that gives you back a different config +each time you run TSLint. Notice how this is a .js file that exports an object:

+ +

tslint-crazy-config.js

+ +
module.exports = {
+    extends: "./tslint-base.json",
+    rules: {
+        "no-excessive-commenting": [true, {maxComments: Math.random() * 10}]
+    }
+};
+
+ +

Finally, we have our package.json file which references our base config file through its main field:

+ +

package.json:

+ +
{
+  "name": "shared-tslint-rules",
+  "version": "1.0.0",
+  "description": "Some TSLint rules that are great!",
+  "main": "tslint-base.json",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "MIT"
+}
+
+ +

We can publish our package on NPM to let the world use it!

+ +
+ +

Now let’s say we’re a user, and we want to use the custom rules above to lint our code. +First, we’ll make sure we have the necessary npm packages installed:

+ +
npm install -g tslint shared-tslint-rules
+
+ +

Then, in our tslint.json file for our project, we can reference the package of custom rules with extends:

+ +
{
+    "extends": "shared-tslint-rules/tslint-config",
+    "rules": {
+        "no-addition": true
+    }
+}
+
+ +

and that’s all we have to do to use the custom rules! +We can now run TSLint as we would normally and see any lint errors produced by the custom rules:

+ +
tslint -c path/to/tslint.json my/files/**/to/lint.ts
+
+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/2016/11/17/new-for-4.0.html b/docs/_site/2016/11/17/new-for-4.0.html new file mode 100644 index 00000000000..55be6d39ddc --- /dev/null +++ b/docs/_site/2016/11/17/new-for-4.0.html @@ -0,0 +1,163 @@ + + + + + + + + + TSLint 4.0 Released + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

TSLint 4.0 Released

+ +
+ +
+

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

+ + + +
+ +

Create your own fixer

+

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

+ +

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+const fix = new Lint.Fix("no-imports", [replacement]);
+
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/Gemfile b/docs/_site/Gemfile new file mode 100644 index 00000000000..053c27dc351 --- /dev/null +++ b/docs/_site/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'github-pages' diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock new file mode 100644 index 00000000000..3eaa6478c32 --- /dev/null +++ b/docs/_site/Gemfile.lock @@ -0,0 +1,238 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.2.9) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorator (1.1.0) + commonmarker (0.17.7.1) + ruby-enum (~> 0.5) + concurrent-ruby (1.0.5) + ethon (0.11.0) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) + ffi (1.9.18) + forwardable-extended (2.6.0) + gemoji (3.0.0) + github-pages (172) + activesupport (= 4.2.9) + github-pages-health-check (= 1.3.5) + jekyll (= 3.6.2) + jekyll-avatar (= 0.5.0) + jekyll-coffeescript (= 1.0.2) + jekyll-commonmark-ghpages (= 0.1.3) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.9.2) + jekyll-gist (= 1.4.1) + jekyll-github-metadata (= 2.9.3) + jekyll-mentions (= 1.2.0) + jekyll-optional-front-matter (= 0.3.0) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.2.0) + jekyll-redirect-from (= 0.12.1) + jekyll-relative-links (= 0.5.2) + jekyll-remote-theme (= 0.2.3) + jekyll-sass-converter (= 1.5.0) + jekyll-seo-tag (= 2.3.0) + jekyll-sitemap (= 1.1.1) + jekyll-swiss (= 0.4.0) + jekyll-theme-architect (= 0.1.0) + jekyll-theme-cayman (= 0.1.0) + jekyll-theme-dinky (= 0.1.0) + jekyll-theme-hacker (= 0.1.0) + jekyll-theme-leap-day (= 0.1.0) + jekyll-theme-merlot (= 0.1.0) + jekyll-theme-midnight (= 0.1.0) + jekyll-theme-minimal (= 0.1.0) + jekyll-theme-modernist (= 0.1.0) + jekyll-theme-primer (= 0.5.2) + jekyll-theme-slate (= 0.1.0) + jekyll-theme-tactile (= 0.1.0) + jekyll-theme-time-machine (= 0.1.0) + jekyll-titles-from-headings (= 0.5.0) + jemoji (= 0.8.1) + kramdown (= 1.14.0) + liquid (= 4.0.0) + listen (= 3.0.6) + mercenary (~> 0.3) + minima (= 2.1.1) + rouge (= 2.2.1) + terminal-table (~> 1.4) + github-pages-health-check (1.3.5) + addressable (~> 2.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 2.0) + typhoeus (~> 0.7) + html-pipeline (2.7.1) + activesupport (>= 2) + nokogiri (>= 1.4) + i18n (0.9.1) + concurrent-ruby (~> 1.0) + jekyll (3.6.2) + addressable (~> 2.4) + colorator (~> 1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.14) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 3) + safe_yaml (~> 1.0) + jekyll-avatar (0.5.0) + jekyll (~> 3.0) + jekyll-coffeescript (1.0.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.1.0) + commonmarker (~> 0.14) + jekyll (>= 3.0, < 4.0) + jekyll-commonmark-ghpages (0.1.3) + commonmarker (~> 0.17.6) + jekyll-commonmark (~> 1) + rouge (~> 2) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.9.2) + jekyll (~> 3.3) + jekyll-gist (1.4.1) + octokit (~> 4.2) + jekyll-github-metadata (2.9.3) + jekyll (~> 3.1) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.2.0) + activesupport (~> 4.0) + html-pipeline (~> 2.3) + jekyll (~> 3.0) + jekyll-optional-front-matter (0.3.0) + jekyll (~> 3.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.2.0) + jekyll (~> 3.0) + jekyll-redirect-from (0.12.1) + jekyll (~> 3.3) + jekyll-relative-links (0.5.2) + jekyll (~> 3.3) + jekyll-remote-theme (0.2.3) + jekyll (~> 3.5) + rubyzip (>= 1.2.1, < 3.0) + typhoeus (>= 0.7, < 2.0) + jekyll-sass-converter (1.5.0) + sass (~> 3.4) + jekyll-seo-tag (2.3.0) + jekyll (~> 3.3) + jekyll-sitemap (1.1.1) + jekyll (~> 3.3) + jekyll-swiss (0.4.0) + jekyll-theme-architect (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.5.2) + jekyll (~> 3.5) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.2) + jekyll-theme-slate (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.0) + jekyll (~> 3.3) + jekyll-watch (1.5.1) + listen (~> 3.0) + jemoji (0.8.1) + activesupport (~> 4.0, >= 4.2.9) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0) + kramdown (1.14.0) + liquid (4.0.0) + listen (3.0.6) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) + mercenary (0.3.6) + mini_portile2 (2.3.0) + minima (2.1.1) + jekyll (~> 3.3) + minitest (5.10.3) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + pathutil (0.16.1) + forwardable-extended (~> 2.6) + public_suffix (2.0.5) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (2.2.1) + ruby-enum (0.7.1) + i18n + rubyzip (1.2.1) + safe_yaml (1.0.4) + sass (3.5.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.4) + thread_safe (~> 0.1) + unicode-display_width (1.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + github-pages + +BUNDLED WITH + 1.16.1 diff --git a/docs/_site/circle.yml b/docs/_site/circle.yml new file mode 100644 index 00000000000..1e8b5a738ae --- /dev/null +++ b/docs/_site/circle.yml @@ -0,0 +1,7 @@ +machine: + ruby: + # see available versions here: https://circleci.com/docs/build-image-precise/#ruby + version: 2.2.3 +test: + override: + - bundle exec jekyll build diff --git a/docs/_site/css/main.css b/docs/_site/css/main.css new file mode 100644 index 00000000000..f8b2fda7512 --- /dev/null +++ b/docs/_site/css/main.css @@ -0,0 +1,989 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ +html { + font-family: sans-serif; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ } + +/** + * Remove default margin. + */ +body { + margin: 0; } + +/* HTML5 display definitions + ========================================================================== */ +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; } + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ + vertical-align: baseline; + /* 2 */ } + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +audio:not([controls]) { + display: none; + height: 0; } + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ +[hidden], +template { + display: none; } + +/* Links + ========================================================================== */ +/** + * Remove the gray background color from active links in IE 10. + */ +a { + background-color: transparent; } + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ +a:active, +a:hover { + outline: 0; } + +/* Text-level semantics + ========================================================================== */ +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ +abbr[title] { + border-bottom: 1px dotted; } + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ +b, +strong { + font-weight: bold; } + +/** + * Address styling not present in Safari and Chrome. + */ +dfn { + font-style: italic; } + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ +h1 { + font-size: 2em; + margin: 0.67em 0; } + +/** + * Address styling not present in IE 8/9. + */ +mark { + background: #ff0; + color: #000; } + +/** + * Address inconsistent and variable font size in all browsers. + */ +small { + font-size: 80%; } + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +/* Embedded content + ========================================================================== */ +/** + * Remove border when inside `a` element in IE 8/9/10. + */ +img { + border: 0; } + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +svg:not(:root) { + overflow: hidden; } + +/* Grouping content + ========================================================================== */ +/** + * Address margin not present in IE 8/9 and Safari. + */ +figure { + margin: 1em 40px; } + +/** + * Address differences between Firefox and other browsers. + */ +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; } + +/** + * Contain overflow in all browsers. + */ +pre { + overflow: auto; } + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; } + +/* Forms + ========================================================================== */ +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +button, +input, +optgroup, +select, +textarea { + color: inherit; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ } + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +button { + overflow: visible; } + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +button, +select { + text-transform: none; } + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ } + +/** + * Re-set default cursor for disabled elements. + */ +button[disabled], +html input[disabled] { + cursor: default; } + +/** + * Remove inner padding and border in Firefox 4+. + */ +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; } + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ +input { + line-height: normal; } + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; } + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ +input[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + /* 2 */ + box-sizing: content-box; } + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +/** + * Define consistent border, margin, and padding. + */ +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; } + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ +legend { + border: 0; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ +textarea { + overflow: auto; } + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +optgroup { + font-weight: bold; } + +/* Tables + ========================================================================== */ +/** + * Remove most spacing between table cells. + */ +table { + border-collapse: collapse; + border-spacing: 0; } + +td, +th { + padding: 0; } + +/** + * Reset some basic elements + */ +body, h1, h2, h3, h4, h5, h6, +p, blockquote, pre, hr, +dl, dd, ol, ul, figure { + margin: 0; + padding: 0; } + +/** + * Set `margin-bottom` to maintain vertical rhythm + */ +h1, h2, h3, h4, h5, h6, +p, blockquote, pre, +ul, ol, dl, figure, +.highlight { + margin-bottom: 1rem; } + +/** + * Images + */ +img { + max-width: 100%; + vertical-align: middle; } + +/** + * Figures + */ +figure > img { + display: block; } + +figcaption { + font-size: 14px; } + +/** + * Clearfix + */ +.site-header:after, .page:after, .footer-col-wrapper:after { + content: ""; + display: table; + clear: both; } + +/** + * Icons + */ +.icon > svg { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: middle; } + .icon > svg path { + fill: #606c71; } + +/** + * Rules & Feature Badges + */ +.rules-list { + list-style: none; + margin: 0 !important; } + .rules-list > li:nth-child(odd) a { + background-color: rgba(0, 0, 0, 0.03); } + .rules-list > li a { + display: block; + border-left: 3px solid transparent; + text-decoration: none; + padding: .75rem; } + .rules-list > li a:hover { + background-color: rgba(0, 0, 0, 0.075); + border-left-color: #159957; } + +.rule-features { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; } + +.feature { + display: inline-block; + margin-right: 2px; + padding: 2px 4px; + font-weight: 700; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border: 1px solid transparent; + border-radius: .25rem; + cursor: help; } + .feature:before { + display: inline-block; + margin-right: 2px; } + .feature.feature-sm { + padding: 1px 3px; + font-size: 75%; } + .feature.feature-ts-only { + background-color: #FCF8E3; + border-color: #FAF2CC; + color: #8A6D3B; } + .feature.feature-ts-only:before { + content: "\1F4C4"; } + .feature.feature-fixer { + background-color: #DFF0D8; + border-color: #D0E9C6; + color: #3C763D; } + .feature.feature-fixer:before { + content: "\1f527"; } + .feature.feature-requires-type-info { + background-color: #F2DEDE; + border-color: #EBCCCC; + color: #A94442; } + .feature.feature-requires-type-info:before { + content: "\2139"; + border-radius: 50%; + background: #0078D7; + color: #FFF; + width: 1em; } + +.wrapper__code-example { + margin-bottom: 64px; } + .wrapper__code-example:last-of-type { + margin-bottom: 24px; } + .wrapper__code-example h6.heading-fail { + color: #d14; } + .wrapper__code-example .code-example { + background-color: #f1fff1; } + .wrapper__code-example .code-example.code-example-fail { + background-color: #fff5f5; } + .wrapper__code-example .code-example pre, .wrapper__code-example .code-example .highlight { + background: transparent; } + +* { + box-sizing: border-box; } + +body { + padding: 0; + margin: 0; + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; + color: #606c71; } + +a { + color: #1e6bb8; + text-decoration: none; } + a:hover { + text-decoration: underline; } + a:visited { + color: #7d0ce8; } + +h1 { + font-size: 2.5rem; } + +h2 { + font-size: 2rem; } + +h3 { + font-size: 1.6rem; } + +h4 { + font-size: 1.4rem; } + +h5 { + font-size: 1.2rem; } + +h6 { + font-size: 1rem; } + +/** + * Site header + */ +.site-header { + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + padding: 0 20px; + min-height: 56px; } + +.site-title { + font-size: 26px; + line-height: 56px; + margin-bottom: 0; + float: left; } + .site-title, .site-title:visited { + color: rgba(255, 255, 255, 0.7); } + .site-title:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; } + @media screen and (max-width: 36em) { + .site-title { + display: block; + text-align: left; } } + +.site-nav { + float: right; + line-height: 56px; } + .site-nav .page-link { + line-height: 1.5; } + .site-nav .page-link, .site-nav .page-link:visited { + color: rgba(255, 255, 255, 0.7); } + .site-nav .page-link:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; } + .site-nav .page-link:not(:first-child) { + margin-left: 20px; } + @media screen and (max-width: 36em) { + .site-nav .page-link { + display: block; + text-align: left; } + .site-nav .page-link:not(:first-child) { + margin-left: 0; } } + +.btn { + display: inline-block; + margin-bottom: 1rem; + background-color: rgba(255, 255, 255, 0.08); + border-color: rgba(255, 255, 255, 0.2); + border-style: solid; + border-width: 1px; + border-radius: 0.3rem; + transition: color 0.2s, background-color 0.2s, border-color 0.2s; } + .btn, .btn:visited { + color: rgba(255, 255, 255, 0.7); } + .btn:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; + background-color: rgba(255, 255, 255, 0.2); + border-color: rgba(255, 255, 255, 0.3); } + .btn + .btn { + margin-left: 1rem; } + @media screen and (min-width: 64em) { + .btn { + padding: 0.75rem 1rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .btn { + padding: 0.6rem 0.9rem; + font-size: 0.9rem; } } + @media screen and (max-width: 36em) { + .btn { + display: block; + width: 100%; + padding: 0.75rem; + font-size: 0.9rem; } + .btn + .btn { + margin-top: 1rem; + margin-left: 0; } } + +.header { + color: #fff; + text-align: center; + background-color: #159957; + background-image: linear-gradient(120deg, #155799, #159957); } + +@media screen and (min-width: 64em) { + .page-header { + padding: 3rem; } } +@media screen and (min-width: 36em) and (max-width: 64em) { + .page-header { + padding: 2rem; } } +@media screen and (max-width: 36em) { + .page-header { + padding: 1rem; } } + +.project-name { + margin-top: 0; + margin-bottom: 0.1rem; } + @media screen and (min-width: 64em) { + .project-name { + font-size: 3.25rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .project-name { + font-size: 2.25rem; } } + @media screen and (max-width: 36em) { + .project-name { + font-size: 1.75rem; } } + +.project-tagline { + margin-bottom: 2rem; + font-weight: normal; + opacity: 0.7; } + @media screen and (min-width: 64em) { + .project-tagline { + font-size: 1.25rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .project-tagline { + font-size: 1.15rem; } } + @media screen and (max-width: 36em) { + .project-tagline { + font-size: 1rem; } } + +.main-content :first-child { + margin-top: 0; } +@media screen and (min-width: 64em) { + .main-content { + max-width: 68rem; + padding: 2rem 6rem; + margin: 0 auto; + font-size: 1.1rem; } } +@media screen and (min-width: 36em) and (max-width: 64em) { + .main-content { + padding: 2rem 4rem; + font-size: 1.1rem; } } +@media screen and (max-width: 36em) { + .main-content { + padding: 2rem 1rem; + font-size: 1rem; } } +.main-content img { + max-width: 100%; } +.main-content h1, +.main-content h2, +.main-content h3, +.main-content h4, +.main-content h5, +.main-content h6 { + margin-top: 2rem; + margin-bottom: 1rem; + font-weight: normal; + color: #159957; } +.main-content p { + margin-bottom: 1rem; } +.main-content code { + padding: 2px 4px; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 0.9rem; + color: #383e41; + background-color: #f3f6fa; + border-radius: 0.3rem; } +.main-content pre { + padding: 0.8rem; + margin-top: 0; + margin-bottom: 1rem; + font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; + color: #567482; + word-wrap: normal; + background-color: #f3f6fa; + border: solid 1px #dce6f0; + border-radius: 0.3rem; } + .main-content pre > code { + padding: 0; + margin: 0; + font-size: 0.9rem; + color: #567482; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; } +.main-content .highlight { + margin-bottom: 1rem; } + .main-content .highlight pre { + margin-bottom: 0; + word-break: normal; } +.main-content .highlight pre, +.main-content pre { + padding: 0.8rem; + overflow: auto; + font-size: 0.9rem; + line-height: 1.45; + border-radius: 0.3rem; + -webkit-overflow-scrolling: touch; } +.main-content pre code, +.main-content pre tt { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; } + .main-content pre code:before, .main-content pre code:after, + .main-content pre tt:before, + .main-content pre tt:after { + content: normal; } +.main-content ul, +.main-content ol { + margin-top: 0; + margin-left: 30px; + margin-bottom: 1rem; } + .main-content ul ul, + .main-content ul ol, + .main-content ol ul, + .main-content ol ol { + margin-bottom: 0; } +.main-content blockquote { + padding: 0 1rem; + margin-left: 0; + color: #819198; + border-left: 0.3rem solid #dce6f0; } + .main-content blockquote > :first-child { + margin-top: 0; } + .main-content blockquote > :last-child { + margin-bottom: 0; } +.main-content table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; + -webkit-overflow-scrolling: touch; } + .main-content table th { + font-weight: bold; } + .main-content table th, + .main-content table td { + padding: 0.5rem 1rem; + border: 1px solid #e9ebec; } +.main-content dl { + padding: 0; } + .main-content dl dt { + padding: 0; + margin-top: 1rem; + font-size: 1rem; + font-weight: bold; } + .main-content dl dd { + padding: 0; + margin-bottom: 1rem; } +.main-content hr { + height: 2px; + padding: 0; + margin: 1rem 0; + background-color: #eff0f1; + border: 0; } + +.page { + width: 100%; } + +.page-content { + width: 80%; + padding: 1rem; + float: left; } + +.page-sidebar { + width: 20%; + padding: 1rem; + float: left; } + .page-sidebar .active { + font-style: italic; } + +.sidebar-title { + border-bottom: 1px solid #159957; } + +ul.sidebar-links { + list-style: none; + margin-left: 0; } + ul.sidebar-links h6 { + margin-bottom: 0.33rem; } + +/** + * Posts + */ +ul.post-list { + margin-left: 0; + list-style: none; } + ul.post-list > li { + margin-bottom: 1rem; } + +.post-meta { + font-size: 14px; + color: #828282; + font-style: italic; } + +.post-link { + display: inline-block; + color: inherit; } + +.post-header { + margin-bottom: 2rem; } + +.post-title { + letter-spacing: -1px; + line-height: 1; } + +/** + * Site footer + */ +.site-footer { + padding-top: 2rem; + margin-top: 2rem; + border-top: solid 1px #eff0f1; + font-size: 0.9rem; } + +ul.contact-list, +ul.social-media-list { + list-style: none; + margin-left: 0; } + +.footer-col { + float: left; } + +.footer-col-2 { + float: right; } + @media screen and (max-width: 36em) { + .footer-col-2 { + float: left; } } + +/** + * Syntax highlighting styles + */ +.highlight { + background: #fff; } + .highlight .c { + color: #998; + font-style: italic; } + .highlight .err { + color: #a61717; + background-color: #e3d2d2; } + .highlight .k { + font-weight: bold; } + .highlight .o { + font-weight: bold; } + .highlight .cm { + color: #998; + font-style: italic; } + .highlight .cp { + color: #999; + font-weight: bold; } + .highlight .c1 { + color: #998; + font-style: italic; } + .highlight .cs { + color: #999; + font-weight: bold; + font-style: italic; } + .highlight .gd { + color: #000; + background-color: #fdd; } + .highlight .gd .x { + color: #000; + background-color: #faa; } + .highlight .ge { + font-style: italic; } + .highlight .gr { + color: #a00; } + .highlight .gh { + color: #999; } + .highlight .gi { + color: #000; + background-color: #dfd; } + .highlight .gi .x { + color: #000; + background-color: #afa; } + .highlight .go { + color: #888; } + .highlight .gp { + color: #555; } + .highlight .gs { + font-weight: bold; } + .highlight .gu { + color: #aaa; } + .highlight .gt { + color: #a00; } + .highlight .kc { + font-weight: bold; } + .highlight .kd { + font-weight: bold; } + .highlight .kp { + font-weight: bold; } + .highlight .kr { + font-weight: bold; } + .highlight .kt { + color: #458; + font-weight: bold; } + .highlight .m { + color: #099; } + .highlight .s { + color: #d14; } + .highlight .na { + color: #008080; } + .highlight .nb { + color: #0086B3; } + .highlight .nc { + color: #458; + font-weight: bold; } + .highlight .no { + color: #008080; } + .highlight .ni { + color: #800080; } + .highlight .ne { + color: #900; + font-weight: bold; } + .highlight .nf { + color: #900; + font-weight: bold; } + .highlight .nn { + color: #555; } + .highlight .nt { + color: #000080; } + .highlight .nv { + color: #008080; } + .highlight .ow { + font-weight: bold; } + .highlight .w { + color: #bbb; } + .highlight .mf { + color: #099; } + .highlight .mh { + color: #099; } + .highlight .mi { + color: #099; } + .highlight .mo { + color: #099; } + .highlight .sb { + color: #d14; } + .highlight .sc { + color: #d14; } + .highlight .sd { + color: #d14; } + .highlight .s2 { + color: #d14; } + .highlight .se { + color: #d14; } + .highlight .sh { + color: #d14; } + .highlight .si { + color: #d14; } + .highlight .sx { + color: #d14; } + .highlight .sr { + color: #009926; } + .highlight .s1 { + color: #d14; } + .highlight .ss { + color: #990073; } + .highlight .bp { + color: #999; } + .highlight .vc { + color: #008080; } + .highlight .vg { + color: #008080; } + .highlight .vi { + color: #008080; } + .highlight .il { + color: #099; } diff --git a/docs/_site/develop/contributing/index.html b/docs/_site/develop/contributing/index.html new file mode 100644 index 00000000000..407c93a6cd2 --- /dev/null +++ b/docs/_site/develop/contributing/index.html @@ -0,0 +1,178 @@ + + + + + + + + + Contributing to TSLint + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Contributing to TSLint

+

+
+ + +

To develop TSLint, clone the repository and install its dependencies:

+ +
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf
+yarn
+yarn compile
+yarn test
+
+ +

Running a specific test

+ +

You can test a specific test by using the --test command line parameter followed by your test directory. For example:

+
// global tslint
+// point to a dir that has tslint.json and .lint files
+tslint --test test/rules/semicolon/always
+
+// locally built tslint
+./bin/tslint --test test/rules/semicolon/always
+
+ +

Debugging in Visual Studio Code

+ +

Configuration files to work with Visual Studio Code are included when you check out the source code. These files live in the .vscode directory. To run TSLint in the debugger, switch to Debug view and use the dropdown at the top of the Debug pane to select the launch configuration (specified in .vscode/launch.json). Press F5 to debug. You should be able to set breakpoints and debug as usual.

+ +

The current debug configurations are:

+ +
    +
  • Debug CLI: Used to debug TSLint using command line arguments. Modify the args array in .vscode/launch.json to add arguments.
  • +
  • Debug Mocha Tests: Runs non-rule tests
  • +
  • Debug Rule Tests: Runs rule tests (under test/rules)
  • +
  • Debug Document Generation: Debug the scripts/buildDocs.ts script.
  • +
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-formatters/index.html b/docs/_site/develop/custom-formatters/index.html new file mode 100644 index 00000000000..d91b99b9aff --- /dev/null +++ b/docs/_site/develop/custom-formatters/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Custom Formatters + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Custom Formatters

+

+
+ + +

Just like custom rules, additional formatters can also be supplied to TSLint via --formatters-dir on the CLI or formattersDirectory option on the library or grunt-tslint. Writing a new formatter is simpler than writing a new rule, as shown in the JSON formatter’s code.

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Formatter extends Lint.Formatters.AbstractFormatter {
+    public format(failures: Lint.RuleFailure[]): string {
+        var failuresJSON = failures.map((failure: Lint.RuleFailure) => failure.toJson());
+        return JSON.stringify(failuresJSON);
+    }
+}
+
+ +

Such custom formatters can also be written in Javascript. Additionally, formatter files are always named with the suffix Formatter, and referenced from TSLint without its suffix.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/index.html b/docs/_site/develop/custom-rules/index.html new file mode 100644 index 00000000000..41b32272a14 --- /dev/null +++ b/docs/_site/develop/custom-rules/index.html @@ -0,0 +1,224 @@ + + + + + + + + + Developing TSLint rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Developing TSLint rules

+

+
+ + +

TSLint ships with a set of core rules that can be configured. However, users are also allowed to write their own rules, which allows them to enforce specific behavior not covered by the core of TSLint. TSLint’s internal rules are itself written to be pluggable, so adding a new rule is as simple as creating a new rule file named by convention. New rules can be written in either TypeScript or JavaScript; if written in TypeScript, the code must be compiled to JavaScript before invoking TSLint.

+ +

Let us take the example of how to write a new rule to forbid all import statements (you know, for science). Let us name the rule file noImportsRule.ts. Rules are referenced in tslint.json with their kebab-cased identifer, so "no-imports": true would configure the rule.

+ +

Important conventions:

+ +
    +
  • Rule identifiers are always kebab-cased.
  • +
  • Rule files are always camel-cased (camelCasedRule.ts).
  • +
  • Rule files must contain the suffix Rule.
  • +
  • The exported class must always be named Rule and extend from Lint.Rules.AbstractRule.
  • +
+ +

Now, let us first write the rule in TypeScript:

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "import statement forbidden";
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        return this.applyWithWalker(new NoImportsWalker(sourceFile, this.getOptions()));
+    }
+}
+
+// The walker takes care of all the work.
+class NoImportsWalker extends Lint.RuleWalker {
+    public visitImportDeclaration(node: ts.ImportDeclaration) {
+        // create a failure at the current position
+        this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
+
+        // call the base version of this visitor to actually parse this node
+        super.visitImportDeclaration(node);
+    }
+}
+
+ +

Given a walker, TypeScript’s parser visits the AST using the visitor pattern. So the rule walkers only need to override the appropriate visitor methods to enforce its checks. For reference, the base walker can be found in syntaxWalker.ts. To see what your Typescript file or snippet looks like as an AST, visit astexplorer.net (note: current version of TypeScript may not be supported, yet).

+ +

We still need to hook up this new rule to TSLint. First make sure to compile noImportsRule.ts:

+ +
tsc noImportsRule.ts
+
+ +

Then, if using the CLI, provide the directory that contains this rule as an option to --rules-dir. If using TSLint as a library or via grunt-tslint, the options hash must contain "rulesDirectory": "...". If you run the linter, you’ll see that we have now successfully banned all import statements via TSLint!

+ +

Finally, add a line to your tslint.json config file for each of your custom rules.

+ +
+ +

Now that you’re written a rule to detect problems, let’s modify it to fix them.

+ +

Instantiate a Fix object and pass it in as an argument to addFailure. This snippet replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const fix = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+
+// create a failure at the current position
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+
+

Final notes:

+ +
    +
  • Core rules cannot be overwritten with a custom implementation.
  • +
  • Custom rules can also take in options just like core rules (retrieved via this.getOptions()).
  • +
  • As of TSLint v5.7.0 you no longer need to compile your custom rules before using them. You need to tell node.js how to load .ts files for example by using ts-node:
  • +
+ +
ts-node node_modules/.bin/tslint <your options>
+# or
+node -r ts-node/register node_modules/.bin/tslint <your options>
+# or
+NODE_OPTIONS="-r ts-node/register" tslint <your options>
+
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/performance-tips.html b/docs/_site/develop/custom-rules/performance-tips.html new file mode 100644 index 00000000000..82660c2df98 --- /dev/null +++ b/docs/_site/develop/custom-rules/performance-tips.html @@ -0,0 +1,295 @@ + + + + + + + + + TSLint performance tips + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint performance tips

+

+
+ + +

As TSLint has matured, we have developed some best practices for making rules run faster. TSLint 5.0 was a particularly +significant release that featured many performance enhancements using the below tips (some codebases experienced lint times +cut in half).

+ +

Use the TypeChecker only when needed

+ +

The TypeChecker is a really mighty tool, but that comes with a cost. To create a TypeChecker the Program first has to locate, read, parse and bind all SourceFiles referenced. +To avoid that cost, try to avoid the TypeChecker where possible.

+ +

If you are interested in the JSDoc of a function for example, you could ask the TypeChecker. +But there’s another way: call .getChildren() on the FunctionDeclaration and search for nodes of kind ts.SyntaxKind.JSDocComment. +Those nodes will precede other nodes in the array.

+ +

Avoid walking the AST if possible

+ +

Some rules work directly on the content of the source file.

+ +

For example, max-file-line-count and linebreak-style don’t need to walk the AST at all.

+ +

Other rules define exceptions: no-consecutive-blank-lines ignores template strings. +To optimize for the best case, this rule can first look for failures in the source. +If and only if there are any failures, walk the AST to find the location of all template strings to filter the failures.

+ +

Implement your own walking algorithm

+ +

Convenience comes with a price. When using SyntaxWalker or any subclass thereof like RuleWalker you pay the price for the +big switch statement in visitNode which then calls the appropriate visitXXX method for every node in the AST, even if you don’t use them.

+ +

Use AbstractWalker instead and implement the walk method to fit the needs of your rule. +It’s as simple as this:

+ +
class MyWalker extends Lint.AbstractWalker<MyOptionsType> {
+    public walk(sourceFile: ts.SourceFile) {
+        const cb = (node: ts.Node): void => {
+            if (someCondition) {
+                // do stuff
+            }
+            // Wondering why return is used below? Refer to "Make use of tail calls"
+            return ts.forEachChild(node, cb); // recurse deeper
+        };
+        return ts.forEachChild(sourceFile, cb); // start recursion with children of sourceFile
+    }
+
+ +

Don’t walk the whole AST if possible

+ +

The language specification is your friend: +The language spec defines where each statement can occur. +For example, if you are interested in import statements, you only need to search in sourceFile.statements and nested NamespaceDeclarations.

+ +

Don’t visit AST branches you’re not interested in: +For example, no-null-keyword creates no failure if the null keyword is part of another type. +There are two ways to achieve this:

+ +
    +
  • Recurse into the AST until you find a token of kind NullKeyword and then walk up its parent chain to find out if it is part of a type node.
  • +
  • Stop recursing deeper into that branch as soon as you hit a type node (preferred).
  • +
+ +

Avoid frequently creating one-time closures in the hot path

+
class SomeClass {
+    // this is a simplified version of what SyntaxWalker does under the hood
+    doStuff(node: ts.Node) {
+        // do stuff ...
+
+        ts.forEachChild(node, (n) => this.doStuff(n));
+                           // ~~~~~~~~~~~~~~~~~~~~~~ [a new closure is created for EVERY node in the AST and remains on the call stack
+                           //                         until processing of all children is done]
+    }
+}
+
+ +

Instead use the same closure for every call like the example above in Implement your own walking algorithm.

+ +

Create small specialized functions / methods

+ +

Instead of stuffing the whole logic in a single closure, consider splitting it up into smaller functions or methods. +Each function should handle similar kinds of nodes. Don’t worry too much about the function call, since V8 eventually inlines the function +if possible.

+ +

The AST nodes have different properties, therefore they have a different hidden class in V8. A function can only be optimized for a certain +amount of different hidden classes. Above that threshold the function will be deoptimized and is never optimized again.

+ +

Supply the optional sourceFile parameter

+ +

There are serveral methods that have an optional parameter sourceFile. Don’t omit this parameter if you care for performance. +If ommitted, typescript needs to walk up the node’s parent chain until it reaches the SourceFile. This can be quite costly when done +frequently on deeply nested nodes.

+ +

Some examples:

+ +
    +
  • node.getStart()
  • +
  • node.getWidth()
  • +
  • node.getText()
  • +
  • node.getChildren()
  • +
  • node.getFirstToken()
  • +
  • node.getLeadingTriviaWidth()
  • +
+ +

Avoid excessive calls to node.getStart(), node.getWidth() and node.getText()

+ +

node.getStart() scans the source to skip all the leading trivia. Although barely noticeable, this operation is not for free. +If you need the start position of a node more than once per function, consider caching it.

+ +

node.getWidth() is most of the time used together with node.getStart() to get the node’s span. Internally it uses node.getEnd() - node.getStart() which effectively doubles the calls to node.getStart(). Consider using node.getEnd() instead and calculate the width yourself if necessary.

+ +

node.getText() calculates the start of the node and returns a substring until the end of the token. +Most of the time this not needed, because this substring is already contained in the node.

+ +
declare node: ts.Identifier;
+node.getText() === node.text; // prefer node.text where available
+
+ +

Bonus points: If you know the width of the node (either from the text property or because it is a keyword of known width), +you can use node.getEnd() - width to calculate the node’s start. +node.getEnd() is effectively for free as it only returns the end property. This way you avoid the cost of skipping leading trivia.

+ +

Make use of tail calls

+ +

Tail calls are function or method calls at the end of the control flow of a function. It’s only a tail call if the return value of that call +is directly returned unchanged. Browsers can optimize this pattern for performance. +Further optimization is specced in ES2015 as “Proper Tail Calls”. +With proper tail calls the browser reuses the stack frame of the current function. When done right this allows for infinite recursion.

+ +
function foo() {
+    if (condition)
+        return bar(); // tail call
+    if (someOtherCondition)
+        return foo() + 1; // no tail call, return value is modified
+    return baz(); // tail call
+}
+
+function bas() {
+    if (cond)
+        return someGlobalVariable = bar(); // no tail call, return value is stored in value before it is returned
+    foo(); // no tail call because there is no return
+}
+
+ +

Typeguards

+ +

Typeguard functions are very small by default. These functions will be inlined into the containing function. +After inlining you no longer pay the cost of the function call.

+ +

But beware of the inlining limit. If a function is big enough or already has many inlined functions, V8 will stop inlining other functions.

+ +

Try to use a discriminated union if possible. A typeguard makes sense if you can save up multiple type assertions.

+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/walker-design.html b/docs/_site/develop/custom-rules/walker-design.html new file mode 100644 index 00000000000..bb02ca8fb15 --- /dev/null +++ b/docs/_site/develop/custom-rules/walker-design.html @@ -0,0 +1,320 @@ + + + + + + + + + Designing rule walkers + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Designing rule walkers

+

+
+ + +

Using WalkContext and applyWithFunction

+ +

If you have a rule with a pretty simple implementation, you don’t need to declare a class which extends the Walker class. Instead, you can define a callback function that accepts following argument:

+ +
    +
  • ctx: WalkContext<T>: An object containing rule information, an object options: T containing the parsed rule arguments, the ts.sourceFile object, and functions for adding failures
  • +
+ +

Use this callback as an argument to applyWithFunction. You can also pass your parsed rule arguments as optional 3rd parameter.

+ +

Let’s look at no-null-keyword as an example:

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "Use 'undefined' instead of 'null'";
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        // Call `applyWithFunction` with your callback function, `walk`.
+        // This creates a `WalkContext<T>` and passes it in as an argument.
+        // An optional 3rd parameter allows you to pass in a parsed version of `this.ruleArguments`. If used, it is not recommended to
+        //     simply pass in `this.getOptions()`, but to parse it into a more useful object instead.
+        return this.applyWithFunction(sourceFile, walk);
+    }
+}
+
+// Here, the options object type is `void` because we don't pass any options in this example.
+function walk(ctx: Lint.WalkContext<void>) {
+    // Recursively walk the AST starting with root node, `ctx.sourceFile`.
+    // Call the function `cb` (defined below) for each child.
+    return ts.forEachChild(ctx.sourceFile, cb);
+    
+    function cb(node: ts.Node): void {
+        // Stop recursing further into the AST by returning early. Here, we ignore type nodes.
+        if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) {
+            return;
+        }
+        
+        // Add failures using the `WalkContext<T>` object. Here, we add a failure if we find the null keyword.
+        if (node.kind === ts.SyntaxKind.NullKeyword) {
+            return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+        }
+        
+        // Continue recursion into the AST by calling function `cb` for every child of the current node.
+        return ts.forEachChild(node, cb);
+    }
+}
+
+ +

Using AbstractWalker

+ +

If your rule implementation is a bit more involved than the above example, you can also implement it as a class. +Simply extend AbstractWalker<T> and implement the walk method.

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "'magic numbers' are not allowed";
+
+    public static ALLOWED_NODES = new Set<ts.SyntaxKind>([
+        ...
+    ]);
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        // We convert the `ruleArguments` into a useful format before passing it to the constructor of AbstractWalker.
+        return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String))));
+    }
+}
+
+// The type parameter of AbstractWalker corresponds to the third constructor parameter.
+class NoMagicNumbersWalker extends Lint.AbstractWalker<Set<string>> {
+    public walk(sourceFile: ts.SourceFile) {
+        const cb = (node: ts.Node): void => {
+            // Finds specific node types and do checking.
+            if (node.kind === ts.SyntaxKind.NumericLiteral) {
+                this.checkNumericLiteral(node, (node as ts.NumericLiteral).text);
+            } else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression &&
+                       (node as ts.PrefixUnaryExpression).operator === ts.SyntaxKind.MinusToken) {
+                this.checkNumericLiteral(node, "-" + ((node as ts.PrefixUnaryExpression).operand as ts.NumericLiteral).text);
+            } else {
+                // Continue rescursion: call function `cb` for all children of the current node.
+                return ts.forEachChild(node, cb);
+            }
+        };
+        
+        // Start recursion for all children of `sourceFile`.
+        return ts.forEachChild(sourceFile, cb);
+    }
+
+    private checkNumericLiteral(node: ts.Node, num: string) {
+        // `this.options` is the third constructor parameter from above (the Set we created in `Rule.apply`)
+        if (!Rule.ALLOWED_NODES.has(node.parent!.kind) && !this.options.has(num)) {
+            // Add failures to the Walker.
+            this.addFailureAtNode(node, Rule.FAILURE_STRING);
+        }
+    }
+}
+
+ +

Migrating from RuleWalker to AbstractWalker

+ +

The main difference between RuleWalker and AbstractWalker is that you need to implement the AST recursion yourself. But why would you want to do that? +Performance! RuleWalker wants to be “one walker to rule them all” (pun intended). It’s easy to use but that convenience +makes it slow by default. When implementing the walking yourself, you only need to do as much work as needed.

+ +

Besides that you should convert the ruleArguments to a useful format before passing it to AbstractWalker as seen above.

+ +

This table describes the equivalent methods between the two classes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleWalkerAbstractWalker
this.createFailure() and this.addFailure()this.addFailureAt()
this.addFailureFromStartToEnd()this.addFailure()
this.createReplacement()new Lint.Replacement()
this.deleteText()Lint.Replacement.deleteText()
this.deleteFromTo()Lint.Replacement.deleteFromTo()
this.appendText()Lint.Replacement.appendText()
this.hasOption() and this.getOptions()use this.options directly
this.getLineAndCharacterOfPosition()ts.getLineAndCharacterOfPosition(this.sourceFile, ...)
this.getLimit()this.sourceFile.end
this.getSourceFile()is available to be compatible, but prefer this.sourceFile
this.getFailures()is available to be compatible, but prefer this.failures
this.skip()just don’t use it, it’s a noop
this.getRuleName()this.ruleName
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/docs/index.html b/docs/_site/develop/docs/index.html new file mode 100644 index 00000000000..5d03263cfc0 --- /dev/null +++ b/docs/_site/develop/docs/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Docs Development + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Docs Development

+

+
+ + +

This docs site is a Jekyll site hosted on GitHub pages. +It is maintained in the /docs directory of TSLint. +To contribute to the docs, whether it be better styling, functionality, or content, just create a PR as you would for any code contribution.

+ +

Updating Rule Documentation

+

The documentation for rules is automatically generated from the metadata supplied by each rule in its corresponding .ts file. +If you’d like to help improve documentation for them, simply file a PR improving a rule’s metadata and a project collaborator will take care of regenerating the docs site once your PR is merged.

+ +

Running the npm run docs command will regenerate the rules docs based off of the metadata provided in the code. This is normally done each release so that the public docs site is up to date with the latest release.

+ +

Creating New Pages

+

To create a new page, follow the pattern of existing pages. You’ll also need to add appropriate metadata in the _data/*_sidebar.json data file if you want it to show up in a sidebar.

+ +

Creating News Posts

+

To create a new news post, simply add a new markdown file to the _posts directory, following the same pattern as existing ones.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/testing-rules/index.html b/docs/_site/develop/testing-rules/index.html new file mode 100644 index 00000000000..bece43db06c --- /dev/null +++ b/docs/_site/develop/testing-rules/index.html @@ -0,0 +1,322 @@ + + + + + + + + + Testing Rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Testing Rules

+

+
+ + +

Every TSLint rule has a corresponding directory inside test/rules/ which contains one or more test cases for the rule.

+ +

Each test case contains:

+ +
    +
  • A tslint.json file which specifies the configuration for TSLint to use
  • +
  • .ts.lint test files which contain TypeScript code and a special markup which indicate where lint failures should be found
  • +
+ +

The test system lints the .ts.lint files with the settings specified in tslint.json and makes sure that failures generated by the TSLint match the failures marked in the .ts.lint files.

+ +

Example

+ +
Testing a New Rule
+ +

Say we’re contributing a new rule to TSLint that bans the use of animal variable names and we now need to test it. First we create our configuration file which enables only the rule to be tested:

+ +

test/rules/no-animal-variable-names/default/tslint.json:

+ +
{
+  "rules": {
+    "no-animal-variable-names": true
+  }
+}
+
+ +

In this case, we placed our configuration inside no-animal-variable-names/default to indicate that we’re testing the default configuration for our rule.

+ +

Now let’s make the actual test file:

+ +

test/rules/no-animal-variable-names/default/test.ts.lint:

+ +
const octopus = 5;
+      ~~~~~~~      [Variables named after animals are not allowed!]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [Variables named after animals are not allowed!]
+                     ~~~~~  [Variables named after animals are not allowed!]
+
+const tree = 5;
+const skyscraper = 100;
+
+ +

In the above file, ~ characters “underline” where our rule should generate a lint failure +and the message that should be produced appears in brackets afterwards.

+ +

If multiple lint failures occur on the same line of TypeScript code, the markup for them is placed on consecutive lines, +as shown in the above example with the line let giraffe: number, tiger: number;

+ +

Notice how we also include lines of code that shouldn’t generate lint failures. +This is important to ensure that the rule isn’t creating false-positives.

+ +

We can now run yarn compile:test && yarn test:rules to make sure that our rule produces the output we expect.

+ +
Testing a New Rule Option
+ +

Let’s look at one more example. Say we’ve added an also-no-plants option to our rule above that disallows variable names that are plants. We should add a test for this new option:

+ +

test/rules/no-animal-variable-names/also-no-plants/tslint.json:

+ +
{
+  "rules": {
+    "no-animal-variable-names": [true, "also-no-plants"]
+  }
+}
+
+ +

test/rules/no-animal-variable-names/also-no-plants/test.ts.lint:

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal]
+                     ~~~~~  [no-animal]
+
+const tree = 5;
+      ~~~~      [no-plant]
+const skyscraper = 100;
+
+[no-animal]: Variables named after animals are not allowed!
+[no-plant]: Variables named after plants are not allowed!
+
+ +

We’ve now used a special message shorthand syntax so we don’t have to type out the same failure message over and over. +Instead of writing out the full lint failure message after each occurance of it, we instead just specify a shortcut name. +(Shortcut names can only consist of letters, numbers, underscores, and hyphens.) +Then, at the bottom of our test file, we specify what full message each shortcut should expand to.

+ +

Again, we can run yarn compile:test && yarn test:rules to make sure our rule is producing the output we expect. If it isn’t we’ll see the difference between the output from the rule and the output we marked.

+ +

You can also use placeholders to format messages. That’s useful if the error message contains non-static parts, e.g. variable names. But let’s stick to the above example for now.

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal]
+                     ~~~~~  [no-animal]
+
+const tree = 5;
+      ~~~~      [error % ("plants")]
+const skyscraper = 100;
+
+[error] Variables named after %s are not allowed!
+[no-animal]: error % ('animals')
+
+ +

We created a message template called error which has one placeholder %s. For a complete list of supported placeholders, please refer to the documentation of node’s util.format(). +To use the template for formatting, you need to use a special syntax: template_name % ('substitution1' [, "substitution2" [, ...]]). +Substitutions are passed as comma separated list of javascript string literals. The strings need to be wrapped in single or double quotes. Escaping characters works like you would expect in javascript.

+ +

You may have noticed that the template is used for formatting in two different places. Use it in inline errors to pass another substitution every time. +If you use formatting in another message shorthand (like we did for [no-animal]), you need to make sure the template is defined before its use. That means swapping the lines of [error] and [no-animal] will not work. There are no restrictions for the use of [no-animal] in inline errors, though.

+ +

Now let’s pretend the rule changed its error message to include the variable name at the end. The following example shows how to substitute multiple placeholders.

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal % ('octopus')]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal % ('giraffe')]
+                     ~~~~~  [no-animal % ('tiger')]
+
+const tree = 5;
+      ~~~~      [error % ("plants", "tree")]
+const skyscraper = 100;
+
+[error] Variables named after %s are not allowed: '%s'
+[no-animal]: error % ('animals')
+
+ +
Typescript version requirement
+ +

Sometimes a rule requires a minimum version of the typescript compiler or your test contains syntax that older versions of the typescript parser cannot handle. +When testing with multiple versions of typescript - like tslint does in CI - those tests will fail.

+ +

To avoid failing tests, each test file can specify a version requirement for typescript in the first line. If you don’t specify one, the test will always be executed.

+ +

Example:

+
[typescript]: >= 2.1.0
+
+ +

The syntax should look familiar, because it is basically the shorthand syntax from the chapter above. It needs to start with [typescript]:. +The following part can be any version range. The prerelease suffix will be removed before matching to allow testing with nightly builds.

+ +

Tips & Tricks

+ +
    +
  • +

    You can use this system to test rules outside of the TSLint build! Use the tslint --test path/to/dir command to test your own custom rules. +You can specify one or more paths to tslint.json files or directories containing a tslint.json. Glob patterns are also supported. +Besides the tslint.json each directory you pass should contain *.ts.lint files. You can try this out on the TSLint rule test cases, for example, tslint --test path/to/tslint-code/test/rules/quotemark/single. +If you want to test all of your rules at once, you can use it like this: tslint --test rules/test/**/tslint.json

    +
  • +
  • +

    To test rules that need type information, you can simply add a tsconfig.json with the desired configuration next to tslint.json.

    +
  • +
  • +

    Lint failures sometimes span over multiple lines. To handle this case, don’t specify a message until the end of the error. For example:

    +
  • +
+ +
for (let key in obj) {
+~~~~~~~~~~~~~~~~~~~~~~
+  console.log(key);
+~~~~~~~~~~~~~~~~~~~
+}
+~ [for-in loops are not allowed]
+
+ +
    +
  • If for some reason your lint rule generates a failure that has zero width, you can use the ~nil mark to indicate this.
  • +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/feed.xml b/docs/_site/feed.xml new file mode 100644 index 00000000000..e4ba5bba4b8 --- /dev/null +++ b/docs/_site/feed.xml @@ -0,0 +1,232 @@ + + + + TSLint + TSLint documentation. A linter for the TypeScript language. + + http://localhost:4000/tslint/ + + Mon, 09 Apr 2018 09:06:25 -0400 + Mon, 09 Apr 2018 09:06:25 -0400 + Jekyll v3.6.2 + + + TSLint 4.0 Released + <p>TSLint 4.0 has been released! With this release comes a few exciting <a href="https://github.com/palantir/tslint/releases">changes</a>. Some of the highlights:</p> + +<ul> + <li><strong>Fixers</strong>. Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we’ll fix them for you. To use this feature, run <code class="highlighter-rouge">tslint</code> with the <code class="highlighter-rouge">--fix</code> option. Rules that support the <code class="highlighter-rouge">--fix</code> feature: + <ul> + <li><a href="/tslint/rules/array-type">array-type</a></li> + <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> + <li><a href="/tslint/rules/no-unused-variable">no-unused-variable</a> (for imports)</li> + <li><a href="/tslint/rules/no-var-keyword">no-var-keyword</a></li> + <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> + <li><a href="/tslint/rules/semicolon">semicolon</a></li> + <li><a href="/tslint/rules/trailing-comma">trailing-comma</a></li> + </ul> + </li> + <li> + <p><strong>Linting <code class="highlighter-rouge">.js</code> files</strong>. <em>A much-requested feature from our community</em>. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a <code class="highlighter-rouge">jsRules</code> <a href="https://raw.githubusercontent.com/palantir/tslint/master/src/configs/recommended.ts">section</a> to your <code class="highlighter-rouge">tslint.json</code> file, and TSLint will lint your JavaScript files.</p> + </li> + <li><strong>TypeScript 2.0+ required</strong>. This lets us deprecate/remove rules that are checked by the compiler. Problematic code that once violated these rules now cause compilation errors in <code class="highlighter-rouge">tsc</code>: + <ul> + <li>no-duplicate-key</li> + <li>no-unreachable</li> + <li>no-unused-variable</li> + </ul> + </li> + <li> + <p><strong>Node.js API Change</strong>. <a href="https://github.com/palantir/tslint/pull/1720">Moved and renamed</a> some things to make more sense. Get it all when you use <code class="highlighter-rouge">import * as TSLint from "tslint"</code>.</p> + </li> + <li><strong><a href="https://github.com/palantir/tslint/pull/1717/files#diff-6e3940e8ec3d59837c4435f32975ed2c">Recommended Rules Updated</a></strong> + <ul> + <li><a href="/tslint/rules/adjacent-overload-signatures">adjacent-overload-signatures</a></li> + <li><a href="/tslint/rules/array-type">array-type</a></li> + <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> + <li><a href="/tslint/rules/max-classes-per-file">max-classes-per-file</a></li> + <li><a href="/tslint/rules/no-unsafe-finally">no-unsafe-finally</a></li> + <li><a href="/tslint/rules/object-literal-key-quotes">object-literal-key-quotes</a> (as needed)</li> + <li><a href="/tslint/rules/object-literal-shorthand">object-literal-shorthand</a></li> + <li><a href="/tslint/rules/only-arrow-functions">only-arrow-functions</a></li> + <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> + <li><a href="/tslint/rules/prefer-for-of">prefer-for-of</a></li> + </ul> + </li> + <li><strong>Other rules you might find handy</strong>: + <ul> + <li><a href="/tslint/rules/completed-docs">completed-docs</a></li> + <li><a href="/tslint/rules/cyclomatic-complexity">cyclomatic-complexity</a></li> + </ul> + </li> +</ul> + +<hr /> + +<h2 id="create-your-own-fixer">Create your own fixer</h2> +<p>To create your own fixer, instantiate a <code class="highlighter-rouge">Fix</code> object and pass it in as an argument to <code class="highlighter-rouge">addFailure</code>.</p> + +<p>This snippet updates the <a href="/tslint/develop/custom-rules">sample custom rule</a> by adding a fixer which replaces the offending import statement with an empty string:</p> + +<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// create a fixer for this failure</span> +<span class="kd">const</span> <span class="nx">replacement</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Replacement</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="s2">""</span><span class="p">);</span> +<span class="kd">const</span> <span class="nx">fix</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Fix</span><span class="p">(</span><span class="s2">"no-imports"</span><span class="p">,</span> <span class="p">[</span><span class="nx">replacement</span><span class="p">]);</span> + +<span class="k">this</span><span class="p">.</span><span class="nx">addFailure</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">createFailure</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="nx">Rule</span><span class="p">.</span><span class="nx">FAILURE_STRING</span><span class="p">,</span> <span class="nx">fix</span><span class="p">));</span> +</code></pre></div></div> + + + Thu, 17 Nov 2016 10:19:00 -0500 + http://localhost:4000/tslint/2016/11/17/new-for-4.0.html + http://localhost:4000/tslint/2016/11/17/new-for-4.0.html + + + + + + Sharable Configurations and Rules + <p>With the release of <a href="https://github.com/palantir/tslint/releases">TSLint v3.7.0</a> comes a few new features that will make configuration files (aka <a href="/tslint/usage/tslint-json"><code class="highlighter-rouge">tslint.json</code> files</a>) +easier to maintain and share. The crux of the changes is a new <code class="highlighter-rouge">extends</code> field, which when provided indicates that a configuration +file augments another configuration file.</p> + +<h3 id="example">Example</h3> + +<p>Let’s imagine you’ve created some custom rules and want to share them with others. +You also have a couple of configurations for them you want to share.</p> + +<p>Here’s the layout of our NPM package, which we’ll call <code class="highlighter-rouge">shared-tslint-rules</code>. We have a directory with rules, +as well as a few different config files for TSLint.</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>shared-tslint-rules +├── package.json +├── rules +│   ├── noAdditionRule.js +│   ├── noErrorsRule.js +│   └── noExcessiveCommentingRule.js +├── tslint-base.json +├── tslint-config.json +└── tslint-crazy-config.js +</code></pre></div></div> + +<p>Our starting-point config file just references the directory the custom rules are in +but doesn’t enable any of them:</p> + +<p><strong>tslint-base.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"rulesDirectory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./rules"</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>We also want to provide a sane default config for our rules. +Notice how it extends our base config, so we don’t have to redeclare <code class="highlighter-rouge">rulesDirectory</code> here:</p> + +<p><strong>tslint-config.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"extends"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./tslint-base.json"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"rules"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> + </span><span class="s2">"no-errors"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> + </span><span class="s2">"no-addition"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> + </span><span class="p">}</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>Finally, we can even make a crazy config file for fun that gives you back a different config +each time you run TSLint. Notice how this is a <code class="highlighter-rouge">.js</code> file that exports an object:</p> + +<p><strong>tslint-crazy-config.js</strong></p> + +<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">{</span> + <span class="na">extends</span><span class="p">:</span> <span class="s2">"./tslint-base.json"</span><span class="p">,</span> + <span class="na">rules</span><span class="p">:</span> <span class="p">{</span> + <span class="s2">"no-excessive-commenting"</span><span class="p">:</span> <span class="p">[</span><span class="kc">true</span><span class="p">,</span> <span class="p">{</span><span class="na">maxComments</span><span class="p">:</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="mi">10</span><span class="p">}]</span> + <span class="p">}</span> +<span class="p">};</span> +</code></pre></div></div> + +<p>Finally, we have our <code class="highlighter-rouge">package.json</code> file which references our base config file through its <code class="highlighter-rouge">main</code> field:</p> + +<p><strong>package.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shared-tslint-rules"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Some TSLint rules that are great!"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"main"</span><span class="p">:</span><span class="w"> </span><span class="s2">"tslint-base.json"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"scripts"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> + </span><span class="s2">"test"</span><span class="p">:</span><span class="w"> </span><span class="s2">"echo </span><span class="se">\"</span><span class="s2">Error: no test specified</span><span class="se">\"</span><span class="s2"> &amp;&amp; exit 1"</span><span class="w"> + </span><span class="p">},</span><span class="w"> + </span><span class="s2">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> + </span><span class="s2">"license"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MIT"</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>We can publish our package on NPM to let the world use it!</p> + +<hr /> + +<p>Now let’s say we’re a user, and we want to use the custom rules above to lint our code. +First, we’ll make sure we have the necessary npm packages installed:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install -g tslint shared-tslint-rules +</code></pre></div></div> + +<p>Then, in our <code class="highlighter-rouge">tslint.json</code> file for our project, we can reference the package of custom rules with <code class="highlighter-rouge">extends</code>:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ + "extends": "shared-tslint-rules/tslint-config", + "rules": { + "no-addition": true + } +} +</code></pre></div></div> + +<p>and that’s all we have to do to use the custom rules! +We can now run TSLint as we would normally and see any lint errors produced by the custom rules:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tslint -c path/to/tslint.json my/files/**/to/lint.ts +</code></pre></div></div> + + + Thu, 31 Mar 2016 11:19:00 -0400 + http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html + http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html + + + + + + A New TSLint Website + <p>As TSLint has grown in usage and popularity alongside of TypeScript, it also has +evolved in terms of functionality and complexity. Today, all sorts of projects and products, +from <a href="https://angular.io/">Angular 2</a> to the <a href="https://github.com/Microsoft/TypeScript">TypeScript compiler itself</a> use TSLint +to help keep their code high-quality.</p> + +<p>Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. +For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long <a href="https://github.com/palantir/tslint/blob/409aa6e4aa4b63da11fd61e15b26b0100cf1e845/README.md">TSLint README</a>. +Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. +There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.</p> + +<p>This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:</p> + +<ul> + <li><a href="https://github.com/palantir/tslint/issues/830">A documentation overhaul</a> that will provide +more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.</li> + <li><a href="https://github.com/palantir/tslint/pull/871">A new <code class="highlighter-rouge">--init</code> feature</a> in the TSLint CLI that will make it easier to +generate a sensible initial <code class="highlighter-rouge">tslint.json</code> config file.</li> + <li><a href="https://github.com/palantir/tslint/issues/831">An improved contributor experience</a> that will make things easier for those who want to contribute code to TSLint.</li> +</ul> + +<p>Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!</p> + + + Thu, 10 Dec 2015 15:15:21 -0500 + http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html + http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html + + + + + + diff --git a/docs/_site/formatters/checkstyle/index.html b/docs/_site/formatters/checkstyle/index.html new file mode 100644 index 00000000000..d97cd74a7c6 --- /dev/null +++ b/docs/_site/formatters/checkstyle/index.html @@ -0,0 +1,130 @@ + + + + + + + + + TSLint formatter: checkstyle + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: checkstyle

+

+
+ + +

Formats errors as through they were Checkstyle output.

+ + + +

Imitates the XMLLogger from Checkstyle 4.3. All failures have the ‘warning’ severity.

+ + + +
Sample Output
+
+

<?xml version="1.0" encoding="utf-8"?> +<checkstyle version="4.3"> + <file name="myFile.ts"> + <error line="1" column="14" severity="warning" message="Missing semicolon" source="failure.tslint.semicolon" /> + </file> +</checkstyle>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/codeFrame/index.html b/docs/_site/formatters/codeFrame/index.html new file mode 100644 index 00000000000..646aee20242 --- /dev/null +++ b/docs/_site/formatters/codeFrame/index.html @@ -0,0 +1,134 @@ + + + + + + + + + TSLint formatter: codeFrame + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: codeFrame

+

+
+ + +

Framed formatter which creates a frame of error code.

+ + + +

Prints syntax highlighted code in a frame with a pointer to where +exactly lint error is happening.

+ + + +
Sample Output
+
+

src/components/Payment.tsx +Parentheses are required around the parameters of an arrow function definition (arrow-parens) + 21 | public componentDidMount() { + 22 | this.input.focus(); +> 23 | loadStripe().then(Stripe => Stripe.pay()); + | ^ + 24 | } + 25 | + 26 | public render() {

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/filesList/index.html b/docs/_site/formatters/filesList/index.html new file mode 100644 index 00000000000..7b62038c1bb --- /dev/null +++ b/docs/_site/formatters/filesList/index.html @@ -0,0 +1,120 @@ + + + + + + + + + TSLint formatter: filesList + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: filesList

+

+
+ + +

Lists files containing lint errors.

+ + + +
Sample Output
+

directory/myFile.ts

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/index.html b/docs/_site/formatters/index.html new file mode 100644 index 00000000000..98e0245ee62 --- /dev/null +++ b/docs/_site/formatters/index.html @@ -0,0 +1,155 @@ + + + + + + + + + TSLint core formatters + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint core formatters

+

+
+ + +

Lint formatters allow for transformation of lint results into various forms before outputting to stdout or a file.

+ +

Built-in formatters

+ +
    +
  • +

    checkstyle - Formats errors as through they were Checkstyle output.

    +
  • +
  • +

    codeFrame - Framed formatter which creates a frame of error code.

    +
  • +
  • +

    filesList - Lists files containing lint errors.

    +
  • +
  • +

    json - Formats errors as simple JSON.

    +
  • +
  • +

    junit - Formats errors as through they were JUnit output.

    +
  • +
  • +

    msbuild - Formats errors for consumption by msbuild.

    +
  • +
  • +

    pmd - Formats errors as through they were PMD output.

    +
  • +
  • +

    prose - The default formatter which outputs simple human-readable messages.

    +
  • +
  • +

    stylish - Human-readable formatter which creates stylish messages.

    +
  • +
  • +

    tap - Formats output as TAP stream.

    +
  • +
  • +

    verbose - The human-readable formatter which includes the rule name in messages.

    +
  • +
  • +

    vso - Formats output as VSO/TFS logging commands.

    +
  • +
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/json/index.html b/docs/_site/formatters/json/index.html new file mode 100644 index 00000000000..c78ec762b77 --- /dev/null +++ b/docs/_site/formatters/json/index.html @@ -0,0 +1,142 @@ + + + + + + + + + TSLint formatter: json + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: json

+

+
+ + +

Formats errors as simple JSON.

+ + + +
Sample Output
+
+

[ + { + "endPosition": { + "character": 13, + "line": 0, + "position": 13 + }, + "failure": "Missing semicolon", + "fix": { + "innerStart": 13, + "innerLength": 0, + "innerText": ";" + }, + "name": "myFile.ts", + "ruleName": "semicolon", + "startPosition": { + "character": 13, + "line": 0, + "position": 13 + } + } +]

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/junit/index.html b/docs/_site/formatters/junit/index.html new file mode 100644 index 00000000000..c250017c108 --- /dev/null +++ b/docs/_site/formatters/junit/index.html @@ -0,0 +1,132 @@ + + + + + + + + + TSLint formatter: junit + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: junit

+

+
+ + +

Formats errors as through they were JUnit output.

+ + + +

Imitates the JUnit XML Output

+ + + +
Sample Output
+
+

<?xml version="1.0" encoding="utf-8"?> +<testsuites package="tslint"> + <testsuite name="myFile.ts"> + <testcase name="Line 1, Column 14: semicolon"> + <failure type="warning">Missing semicolon</failure> + </testcase> + </testsuite> +</testsuites>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/msbuild/index.html b/docs/_site/formatters/msbuild/index.html new file mode 100644 index 00000000000..1fd56587a41 --- /dev/null +++ b/docs/_site/formatters/msbuild/index.html @@ -0,0 +1,123 @@ + + + + + + + + + TSLint formatter: msbuild + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: msbuild

+

+
+ + +

Formats errors for consumption by msbuild.

+ + +

The output is compatible with both msbuild and Visual Studio.

+ + + +
Sample Output
+

myFile.ts(1,14): warning: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/pmd/index.html b/docs/_site/formatters/pmd/index.html new file mode 100644 index 00000000000..1cbfa0afbd9 --- /dev/null +++ b/docs/_site/formatters/pmd/index.html @@ -0,0 +1,128 @@ + + + + + + + + + TSLint formatter: pmd + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: pmd

+

+
+ + +

Formats errors as through they were PMD output.

+ + +

Imitates the XML output from PMD. All errors have a priority of 1.

+ + + +
Sample Output
+
+

<pmd version="tslint"> + <file name="myFile.ts"> + <violation begincolumn="14" beginline="1" priority="3" rule="Missing semicolon"></violation> + </file> +</pmd>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/prose/index.html b/docs/_site/formatters/prose/index.html new file mode 100644 index 00000000000..9f2f5064551 --- /dev/null +++ b/docs/_site/formatters/prose/index.html @@ -0,0 +1,120 @@ + + + + + + + + + TSLint formatter: prose + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: prose

+

+
+ + +

The default formatter which outputs simple human-readable messages.

+ + + +
Sample Output
+

ERROR: myFile.ts[1, 14]: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/stylish/index.html b/docs/_site/formatters/stylish/index.html new file mode 100644 index 00000000000..2a5a45e35b2 --- /dev/null +++ b/docs/_site/formatters/stylish/index.html @@ -0,0 +1,127 @@ + + + + + + + + + TSLint formatter: stylish + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: stylish

+

+
+ + +

Human-readable formatter which creates stylish messages.

+ + + +

The output matches what is produced by ESLint’s stylish formatter. +Its readability is enhanced through spacing and colouring.

+ + + +
Sample Output
+
+

myFile.ts +1:14 semicolon Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/tap/index.html b/docs/_site/formatters/tap/index.html new file mode 100644 index 00000000000..2d49c37147a --- /dev/null +++ b/docs/_site/formatters/tap/index.html @@ -0,0 +1,137 @@ + + + + + + + + + TSLint formatter: tap + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: tap

+

+
+ + +

Formats output as TAP stream.

+ + +

Provides error messages output in TAP13 format which can be consumed by any TAP formatter.

+ + + +
Sample Output
+
+

TAP version 13 +1..1 +not ok 1 - Some error + — + message: Variable has any type + severity: error + data: + ruleName: no-any + fileName: test-file.ts + line: 10 + character: 10 + failureString: Some error + rawLines: Some raw output + …

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/verbose/index.html b/docs/_site/formatters/verbose/index.html new file mode 100644 index 00000000000..e4a50b64168 --- /dev/null +++ b/docs/_site/formatters/verbose/index.html @@ -0,0 +1,123 @@ + + + + + + + + + TSLint formatter: verbose + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: verbose

+

+
+ + +

The human-readable formatter which includes the rule name in messages.

+ + +

The output is the same as the prose formatter with the rule name included

+ + + +
Sample Output
+

ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/vso/index.html b/docs/_site/formatters/vso/index.html new file mode 100644 index 00000000000..9d75a798dd9 --- /dev/null +++ b/docs/_site/formatters/vso/index.html @@ -0,0 +1,125 @@ + + + + + + + + + TSLint formatter: vso + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: vso

+

+
+ + +

Formats output as VSO/TFS logging commands.

+ + + +

Integrates with Visual Studio Online and Team Foundation Server by outputting errors +as ‘warning’ logging commands.

+ + + +
Sample Output
+

##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/index.html b/docs/_site/index.html new file mode 100644 index 00000000000..783c4e542bc --- /dev/null +++ b/docs/_site/index.html @@ -0,0 +1,117 @@ + + + + + + + + + TSLint + + + + + + + + + + + +
+ + + + +
+ + +
+

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.

+ +

Quick start

+ +
# Install the global CLI and its peer dependency
+yarn global add tslint typescript
+
+# Navigate to to your sources folder
+cd path/to/project
+
+# Generate a basic configuration file
+tslint --init
+
+# Lint TypeScript source globs
+tslint -c tslint.json 'src/**/*.ts'
+
+ +

Check out the full usage guide to learn more.

+ + + + +
+ + + + diff --git a/docs/_site/news/index.html b/docs/_site/news/index.html new file mode 100644 index 00000000000..6f757ed92e5 --- /dev/null +++ b/docs/_site/news/index.html @@ -0,0 +1,202 @@ + + + + + + + + + News + + + + + + + + + + + +
+ + +
+ + +
+
+
+ + + +
+

TSLint 4.0 Released

+ +
+
+

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

+ + + +
+ +

Create your own fixer

+

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

+ +

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+const fix = new Lint.Fix("no-imports", [replacement]);
+
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+ + +
+ +
+ + +

Also Read...

+ + + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/adjacent-overload-signatures/index.html b/docs/_site/rules/adjacent-overload-signatures/index.html new file mode 100644 index 00000000000..bac8513a733 --- /dev/null +++ b/docs/_site/rules/adjacent-overload-signatures/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: adjacent-overload-signatures + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: adjacent-overload-signatures

+

+
+ + +

Enforces function overloads to be consecutive.

+ + + + +
Rationale
+

Improves readability and organization by grouping naturally related items together.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"adjacent-overload-signatures": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/align/index.html b/docs/_site/rules/align/index.html new file mode 100644 index 00000000000..4f02cdd3092 --- /dev/null +++ b/docs/_site/rules/align/index.html @@ -0,0 +1,174 @@ + + + + + + + + + Rule: align + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: align

+

+
+ + +

Enforces vertical alignment.

+ + + + +
Rationale
+

Helps maintain a readable, consistent style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "parameters" checks alignment of function parameters.
  • +
  • "arguments" checks alignment of function call arguments.
  • +
  • "statements" checks alignment of statements.
  • +
  • "members" checks alignment of members of classes, interfaces, type literal, object literals and +object destructuring.
  • +
  • "elements" checks alignment of elements of array iterals, array destructuring and tuple types.
  • +
+ + +
Config examples
+ +
+"align": [true, "parameters", "statements"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "arguments",
+      "elements",
+      "members",
+      "parameters",
+      "statements"
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/array-type/index.html b/docs/_site/rules/array-type/index.html new file mode 100644 index 00000000000..d4a3ee2a3bf --- /dev/null +++ b/docs/_site/rules/array-type/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: array-type + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: array-type

+

+
+ + +

Requires using either ‘T[]’ or ‘Array' for arrays.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • "array" enforces use of T[] for all types T.
  • +
  • "generic" enforces use of Array<T> for all types T.
  • +
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
  • +
+ + +
Config examples
+ +
+"array-type": [true, "array"]
+
+ +
+"array-type": [true, "generic"]
+
+ +
+"array-type": [true, "array-simple"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "array",
+    "generic",
+    "array-simple"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/arrow-parens/index.html b/docs/_site/rules/arrow-parens/index.html new file mode 100644 index 00000000000..d3a3ac56769 --- /dev/null +++ b/docs/_site/rules/arrow-parens/index.html @@ -0,0 +1,161 @@ + + + + + + + + + Rule: arrow-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: arrow-parens

+

+
+ + +

Requires parentheses around the parameters of arrow function definitions.

+ + + + +
Rationale
+

Maintains stylistic consistency with other arrow function definitions.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If ban-single-arg-parens is specified, then arrow functions with one parameter +must not have parentheses if removing them is allowed by TypeScript.

+ + +
Config examples
+ +
+"arrow-parens": true
+
+ +
+"arrow-parens": [true, "ban-single-arg-parens"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ban-single-arg-parens"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/arrow-return-shorthand/index.html b/docs/_site/rules/arrow-return-shorthand/index.html new file mode 100644 index 00000000000..6dacef1b99b --- /dev/null +++ b/docs/_site/rules/arrow-return-shorthand/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: arrow-return-shorthand + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: arrow-return-shorthand

+

+
+ + +

Suggests to convert () => { return x; } to () => x.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If multiline is specified, then this will warn even if the function spans multiple lines.

+ + +
Config examples
+ +
+"arrow-return-shorthand": true
+
+ +
+"arrow-return-shorthand": [true, "multiline"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "multiline"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/await-promise/index.html b/docs/_site/rules/await-promise/index.html new file mode 100644 index 00000000000..d1a701b8ed7 --- /dev/null +++ b/docs/_site/rules/await-promise/index.html @@ -0,0 +1,173 @@ + + + + + + + + + Rule: await-promise + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: await-promise

+

+
+ + +

Warns for an awaited value that is not a Promise.

+ + + + +
Rationale
+ +

While it is valid TypeScript to await a non-Promise-like value (it will resolve immediately), +this pattern is often a programmer error and the resulting semantics can be unintuitive.

+ + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

A list of ‘string’ names of any additional classes that should also be treated as Promises. +For example, if you are using a class called ‘Future’ that implements the Thenable interface, +you might tell the rule to consider type references with the name ‘Future’ as valid Promise-like +types. Note that this rule doesn’t check for type assignability or compatibility; it just checks +type reference names.

+ + + +
Config examples
+ +
+"await-promise": true
+
+ +
+"await-promise": [true, "Thenable"]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban-comma-operator/index.html b/docs/_site/rules/ban-comma-operator/index.html new file mode 100644 index 00000000000..d5d006d0c53 --- /dev/null +++ b/docs/_site/rules/ban-comma-operator/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: ban-comma-operator + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban-comma-operator

+

+
+ + +

Disallows the comma operator to be used.

+ + +

Read more about the comma operator here.

+ + + + +
Rationale
+ +

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

+ +

Examples

+
foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
+
+ +
switch (foo) {
+    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
+        return true;
+    case 3:
+        return false;
+}
+
+ +
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
+
+ + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ + + +
Config examples
+ +
+"ban-comma-operator": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban-types/index.html b/docs/_site/rules/ban-types/index.html new file mode 100644 index 00000000000..e59fdf5938f --- /dev/null +++ b/docs/_site/rules/ban-types/index.html @@ -0,0 +1,160 @@ + + + + + + + + + Rule: ban-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban-types

+

+
+ + + +

Bans specific types from being used. Does not ban the +corresponding runtime objects from being used.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

A list of ["regex", "optional explanation here"], which bans +types that match regex

+ + +
Config examples
+ +
+"ban-types": [true, ["Object", "Use {} instead."], ["String"]]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "minLength": 1,
+    "maxLength": 2
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban/index.html b/docs/_site/rules/ban/index.html new file mode 100644 index 00000000000..e47ac88aa1d --- /dev/null +++ b/docs/_site/rules/ban/index.html @@ -0,0 +1,212 @@ + + + + + + + + + Rule: ban + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban

+

+
+ + +

Bans the use of specific functions or global methods.

+ + + + + + + +

Config

+ +

A list of banned functions or methods in the following format:

+ +
    +
  • banning functions: +
      +
    • just the name of the function: "functionName"
    • +
    • the name of the function in an array with one element: ["functionName"]
    • +
    • an object in the following format: {"name": "functionName", "message": "optional explanation message"}
    • +
    +
  • +
  • banning methods: +
      +
    • an array with the object name, method name and optional message: ["functionName", "methodName", "optional message"]
    • +
    • an object in the following format: {"name": ["objectName", "methodName"], "message": "optional message"} +
        +
      • you can also ban deeply nested methods: {"name": ["foo", "bar", "baz"]} bans foo.bar.baz()
      • +
      • the first element can contain a wildcard (*) that matches everything. {"name": ["*", "forEach"]} bans [].forEach(...), $(...).forEach(...), arr.forEach(...), etc.
      • +
      +
    • +
    +
  • +
+ + +
Config examples
+ +
+"ban": [
+  true,
+  "eval",
+  {"name": "$", "message": "please don't"},
+  ["describe", "only"],
+  {"name": ["it", "only"], "message": "don't focus tests"},
+  {
+    "name": ["chai", "assert", "equal"],
+    "message": "Use 'strictEqual' instead."
+  },
+  {"name": ["*", "forEach"], "message": "Use a regular for loop instead."}
+]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "anyOf": [
+      {
+        "type": "string"
+      },
+      {
+        "type": "array",
+        "items": {
+          "type": "string"
+        },
+        "minLength": 1,
+        "maxLength": 3
+      },
+      {
+        "type": "object",
+        "properties": {
+          "name": {
+            "anyOf": [
+              {
+                "type": "string"
+              },
+              {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                },
+                "minLength": 1
+              }
+            ]
+          },
+          "message": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "name"
+        ]
+      }
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/binary-expression-operand-order/index.html b/docs/_site/rules/binary-expression-operand-order/index.html new file mode 100644 index 00000000000..c47cfd681c5 --- /dev/null +++ b/docs/_site/rules/binary-expression-operand-order/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: binary-expression-operand-order + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: binary-expression-operand-order

+

+
+ + + +

In a binary expression, a literal should always be on the right-hand side if possible. +For example, prefer ‘x + 1’ over ‘1 + x’.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"binary-expression-operand-order": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/callable-types/index.html b/docs/_site/rules/callable-types/index.html new file mode 100644 index 00000000000..939ef40dffe --- /dev/null +++ b/docs/_site/rules/callable-types/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: callable-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: callable-types

+

+
+ + +

An interface or literal type with just a call signature can be written as a function type.

+ + + + +
Rationale
+

style

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/class-name/index.html b/docs/_site/rules/class-name/index.html new file mode 100644 index 00000000000..a7b3db2ee23 --- /dev/null +++ b/docs/_site/rules/class-name/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: class-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: class-name

+

+
+ + +

Enforces PascalCased class and interface names.

+ + + + +
Rationale
+

Makes it easy to differentiate classes from regular variables at a glance.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"class-name": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/comment-format/index.html b/docs/_site/rules/comment-format/index.html new file mode 100644 index 00000000000..4b8e4d9bea6 --- /dev/null +++ b/docs/_site/rules/comment-format/index.html @@ -0,0 +1,201 @@ + + + + + + + + + Rule: comment-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: comment-format

+

+
+ + +

Enforces formatting rules for single-line comments.

+ + + + +
Rationale
+

Helps maintain a consistent, readable style in your codebase.

+ + + + + +

Config

+ +

Three arguments may be optionally provided:

+ +
    +
  • "check-space" requires that all single-line comments must begin with a space, as in // comment +
      +
    • note that for comments starting with multiple slashes, e.g. ///, leading slashes are ignored
    • +
    • TypeScript reference comments are ignored completely
    • +
    +
  • +
  • "check-lowercase" requires that the first non-whitespace character of a comment must be lowercase, if applicable.
  • +
  • "check-uppercase" requires that the first non-whitespace character of a comment must be uppercase, if applicable.
  • +
+ +

Exceptions to "check-lowercase" or "check-uppercase" can be managed with object that may be passed as last argument.

+ +

One of two options can be provided in this object:

+ +
* `"ignore-words"`  - array of strings - words that will be ignored at the beginning of the comment.
+* `"ignore-pattern"` - string - RegExp pattern that will be ignored at the beginning of the comment.
+
+ + +
Config examples
+ +
+"comment-format": [true, "check-space", "check-uppercase"]
+
+ +
+"comment-format": [true, "check-lowercase", {"ignore-words": ["TODO", "HACK"]}]
+
+ +
+"comment-format": [true, "check-lowercase", {"ignore-pattern": "STD\\w{2,3}\\b"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "anyOf": [
+      {
+        "type": "string",
+        "enum": [
+          "check-space",
+          "check-lowercase",
+          "check-uppercase"
+        ]
+      },
+      {
+        "type": "object",
+        "properties": {
+          "ignore-words": {
+            "type": "array",
+            "items": {
+              "type": "string"
+            }
+          },
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "minProperties": 1,
+        "maxProperties": 1
+      }
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 4
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/completed-docs/index.html b/docs/_site/rules/completed-docs/index.html new file mode 100644 index 00000000000..f2482b31f7b --- /dev/null +++ b/docs/_site/rules/completed-docs/index.html @@ -0,0 +1,553 @@ + + + + + + + + + Rule: completed-docs + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: completed-docs

+

+
+ + +

Enforces documentation for important items be filled out.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ +

true to enable for [classes, functions, methods, properties]], +or an array with each item in one of two formats:

+ +
    +
  • string to enable for that type
  • +
  • object keying types to when their documentation is required: +
      +
    • "methods" and "properties" may specify: +
        +
      • "privacies": +
          +
        • "all"
        • +
        • "private"
        • +
        • "protected"
        • +
        • "public"
        • +
        +
      • +
      • "locations": +
          +
        • "all"
        • +
        • "instance"
        • +
        • "static"
        • +
        +
      • +
      +
    • +
    • Other types may specify "visibilities": +
        +
      • "all"
      • +
      • "exported"
      • +
      • "internal"
      • +
      +
    • +
    • All types may also provide "tags" +with members specifying tags that allow the docs to not have a body. +
        +
      • "content": Object mapping tags to RegExp bodies content allowed to count as complete docs.
      • +
      • "existence": Array of tags that must only exist to count as complete docs.
      • +
      +
    • +
    +
  • +
+ +

Types that may be enabled are:

+ +
    +
  • "classes"
  • +
  • "enums"
  • +
  • "enum-members"
  • +
  • "functions"
  • +
  • "interfaces"
  • +
  • "methods"
  • +
  • "namespaces"
  • +
  • "properties"
  • +
  • "types"
  • +
  • "variables"
  • +
+ + +
Config examples
+ +
+"completed-docs": true
+
+ +
+"completed-docs": [true, "enums", "functions", "methods"]
+
+ +
+"completed-docs": [
+  true,
+  {
+    "enums": true,
+    "functions": {"visibilities": ["exported"]},
+    "methods": {"locations": "instance", "privacies": ["public", "protected"]},
+    "tags": {"content": {"see": ["#.*"]}, "existence": ["inheritdoc"]}
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "anyOf": [
+      {
+        "options": [
+          "classes",
+          "enums",
+          "functions",
+          "interfaces",
+          "methods",
+          "namespaces",
+          "properties",
+          "types",
+          "variables"
+        ],
+        "type": "string"
+      },
+      {
+        "type": "object",
+        "properties": {
+          "classes": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "enums": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "enum-members": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "functions": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "interfaces": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "methods": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "locations": {
+                "enum": [
+                  "all",
+                  "instance",
+                  "static"
+                ],
+                "type": "string"
+              },
+              "privacies": {
+                "enum": [
+                  "all",
+                  "private",
+                  "protected",
+                  "public"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "namespaces": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "properties": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "locations": {
+                "enum": [
+                  "all",
+                  "instance",
+                  "static"
+                ],
+                "type": "string"
+              },
+              "privacies": {
+                "enum": [
+                  "all",
+                  "private",
+                  "protected",
+                  "public"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "types": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "variables": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          }
+        }
+      }
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/curly/index.html b/docs/_site/rules/curly/index.html new file mode 100644 index 00000000000..25253cf1293 --- /dev/null +++ b/docs/_site/rules/curly/index.html @@ -0,0 +1,263 @@ + + + + + + + + + Rule: curly + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: curly

+

+
+ + +

Enforces braces for if/for/do/while statements.

+ + + + +
Rationale
+ +
if (foo === bar)
+    foo++;
+    bar++;
+
+ +

In the code above, the author almost certainly meant for both foo++ and bar++ +to be executed only if foo === bar. However, they forgot braces and bar++ will be executed +no matter what. This rule could prevent such a mistake.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following options may be provided:

+ +
    +
  • "as-needed" forbids any unnecessary curly braces.
  • +
  • "ignore-same-line" skips checking braces for control-flow statements +that are on one line and start on the same line as their control-flow keyword
  • +
+ + + +
Config examples
+ +
+"curly": true
+
+ +
+"curly": [true, "ignore-same-line"]
+
+ +
+"curly": [true, "as-needed"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "as-needed",
+      "ignore-same-line"
+    ]
+  }
+}
+
+ + +

Code examples:

+ +
+
Require curly braces whenever possible (default)
+
"rules": { "curly": true }
+
+ +
Passes
+
+
if (x > 0) {
+    doStuff();
+}
+
+ +
+ +
Fails
+
+
if (x > 0)
+    doStuff();
+
+if (x > 0) doStuff();
+
+ +
+ +
+ +
+
Make an exception for single-line instances
+
"rules": { "curly": [true, "ignore-same-line"] }
+
+ +
Passes
+
+
if (x > 0) doStuff();
+
+ +
+ +
Fails
+
+
if (x > 0)
+    doStuff()
+
+ +
+ +
+ +
+
Error on unnecessary curly braces
+
"rules": { "curly": [true, "as-needed"] }
+
+ +
Passes
+
+
if (x > 0)
+    doStuff();
+
+if (x > 0) {
+    customerUpdates.push(getInfo(customerId));
+    return customerUpdates;
+}
+
+ +
+ +
Fails
+
+
if (x > 0) {
+    doStuff();
+}
+
+ +
+ +
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/cyclomatic-complexity/index.html b/docs/_site/rules/cyclomatic-complexity/index.html new file mode 100644 index 00000000000..1d6423fdb9e --- /dev/null +++ b/docs/_site/rules/cyclomatic-complexity/index.html @@ -0,0 +1,168 @@ + + + + + + + + + Rule: cyclomatic-complexity + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: cyclomatic-complexity

+

+
+ + +

Enforces a threshold of cyclomatic complexity.

+ + + +

Cyclomatic complexity is assessed for each function of any type. A starting value of 0 +is assigned and this value is then incremented for every statement which can branch the +control flow within the function. The following statements and expressions contribute +to cyclomatic complexity:

+
    +
  • catch
  • +
  • if and ? :
  • +
  • || and && due to short-circuit evaluation
  • +
  • for, for in and for of loops
  • +
  • while and do while loops
  • +
  • case clauses that contain statements
  • +
+ + + + +
Rationale
+ +

Cyclomatic complexity is a code metric which indicates the level of complexity in a +function. High cyclomatic complexity indicates confusing code which may be prone to +errors or difficult to modify.

+ + + + + +

Config

+ +

An optional upper limit for cyclomatic complexity can be specified. If no limit option +is provided a default value of 20 will be used.

+ + +
Config examples
+ +
+"cyclomatic-complexity": true
+
+ +
+"cyclomatic-complexity": [true, 20]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/deprecation/index.html b/docs/_site/rules/deprecation/index.html new file mode 100644 index 00000000000..6b290335b9a --- /dev/null +++ b/docs/_site/rules/deprecation/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: deprecation + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: deprecation

+

+
+ + +

Warns when deprecated APIs are used.

+ + +

Any usage of an identifier + with the @deprecated JSDoc annotation will trigger a warning. + See http://usejsdoc.org/tags-deprecated.html

+ + + + +
Rationale
+

Deprecated APIs should be avoided, and usage updated.

+ + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ + + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/encoding/index.html b/docs/_site/rules/encoding/index.html new file mode 100644 index 00000000000..d0613e55711 --- /dev/null +++ b/docs/_site/rules/encoding/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: encoding + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: encoding

+

+
+ + +

Enforces UTF-8 file encoding.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"encoding": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/eofline/index.html b/docs/_site/rules/eofline/index.html new file mode 100644 index 00000000000..51b2108440c --- /dev/null +++ b/docs/_site/rules/eofline/index.html @@ -0,0 +1,153 @@ + + + + + + + + + Rule: eofline + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: eofline

+

+
+ + +

Ensures the file ends with a newline.

+ + +

Fix for single-line files is not supported.

+ + + + +
Rationale
+

It is a standard convention to end files with a newline.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"eofline": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/file-header/index.html b/docs/_site/rules/file-header/index.html new file mode 100644 index 00000000000..b4710fc3412 --- /dev/null +++ b/docs/_site/rules/file-header/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: file-header + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: file-header

+

+
+ + +

Enforces a certain header comment for all files, matched by a regular expression.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

The first option, which is mandatory, is a regular expression that all headers should match. +The second argument, which is optional, is a string that should be inserted as a header comment +if fixing is enabled and no header that matches the first argument is found.

+ + +
Config examples
+ +
+"file-header": [true, "Copyright \\d{4}", "Copyright 2017"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string"
+    },
+    {
+      "type": "string"
+    }
+  ],
+  "additionalItems": false,
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/forin/index.html b/docs/_site/rules/forin/index.html new file mode 100644 index 00000000000..1f122885be1 --- /dev/null +++ b/docs/_site/rules/forin/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: forin + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: forin

+

+
+ + +

Requires a for ... in statement to be filtered with an if statement.

+ + + + +
Rationale
+ +
for (let key in someObject) {
+    if (someObject.hasOwnProperty(key)) {
+        // code here
+    }
+}
+
+

Prevents accidental iteration over properties inherited from an object’s prototype. +See MDN’s for...in +documentation for more information about for...in loops.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"forin": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/import-blacklist/index.html b/docs/_site/rules/import-blacklist/index.html new file mode 100644 index 00000000000..7d2743b197b --- /dev/null +++ b/docs/_site/rules/import-blacklist/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: import-blacklist + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: import-blacklist

+

+
+ + + +

Disallows importing the specified modules directly via import and require. +Instead only sub modules may be imported from that module.

+ + + + +
Rationale
+ +

Some libraries allow importing their submodules instead of the entire module. +This is good practise as it avoids loading unused modules.

+ + + + + +

Config

+

A list of blacklisted modules.

+ + +
Config examples
+ +
+"import-blacklist": true
+
+ +
+"import-blacklist": [true, "rxjs", "lodash"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "minLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/import-spacing/index.html b/docs/_site/rules/import-spacing/index.html new file mode 100644 index 00000000000..8d712d11753 --- /dev/null +++ b/docs/_site/rules/import-spacing/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: import-spacing + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: import-spacing

+

+
+ + +

Ensures proper spacing between import statement keywords

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"import-spacing": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/indent/index.html b/docs/_site/rules/indent/index.html new file mode 100644 index 00000000000..b65104e5a91 --- /dev/null +++ b/docs/_site/rules/indent/index.html @@ -0,0 +1,197 @@ + + + + + + + + + Rule: indent + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: indent

+

+
+ + +

Enforces indentation with tabs or spaces.

+ + + + +
Rationale
+ +

Using only one of tabs or spaces for indentation leads to more consistent editor behavior, +cleaner diffs in version control, and easier programmatic manipulation.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • spaces enforces consistent spaces.
  • +
  • tabs enforces consistent tabs.
  • +
+ +

A second optional argument specifies indentation size:

+ +
    +
  • 2 enforces 2 space indentation.
  • +
  • 4 enforces 4 space indentation.
  • +
+ +

Indentation size is required for auto-fixing, but not for rule checking.

+ +

NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

+ + +
Config examples
+ +
+"indent": [true, "spaces"]
+
+ +
+"indent": [true, "spaces", 4]
+
+ +
+"indent": [true, "tabs", 2]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string",
+      "enum": [
+        "tabs",
+        "spaces"
+      ]
+    },
+    {
+      "type": "number",
+      "enum": [
+        2,
+        4
+      ]
+    }
+  ],
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/index.html b/docs/_site/rules/index.html new file mode 100644 index 00000000000..1404635d114 --- /dev/null +++ b/docs/_site/rules/index.html @@ -0,0 +1,2129 @@ + + + + + + + + + TSLint core rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint core rules

+

+
+ + +

Lint rules encode logic for syntactic & semantic checks of TypeScript source code.

+ +

TypeScript-specific

+ +

These rules find errors related to TypeScript features:

+ + + +

Functionality

+ +

These rules catch common errors in JS programming or otherwise confusing constructs that are prone to producing bugs:

+ + + +

Maintainability

+ +

These rules make code maintenance easier:

+ + + +

Style

+ +

These rules enforce consistent style across your codebase:

+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/interface-name/index.html b/docs/_site/rules/interface-name/index.html new file mode 100644 index 00000000000..924f15b4961 --- /dev/null +++ b/docs/_site/rules/interface-name/index.html @@ -0,0 +1,166 @@ + + + + + + + + + Rule: interface-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: interface-name

+

+
+ + +

Requires interface names to begin with a capital ‘I’

+ + + + +
Rationale
+

Makes it easy to differentiate interfaces from regular classes at a glance.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

One of the following two options must be provided:

+ +
    +
  • "always-prefix" requires interface names to start with an “I”
  • +
  • "never-prefix" requires interface names to not have an “I” prefix
  • +
+ + +
Config examples
+ +
+"interface-name": [true, "always-prefix"]
+
+ +
+"interface-name": [true, "never-prefix"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always-prefix",
+    "never-prefix"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/interface-over-type-literal/index.html b/docs/_site/rules/interface-over-type-literal/index.html new file mode 100644 index 00000000000..68ef94ccc0e --- /dev/null +++ b/docs/_site/rules/interface-over-type-literal/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: interface-over-type-literal + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: interface-over-type-literal

+

+
+ + +

Prefer an interface declaration over a type literal (type T = { ... })

+ + + + +
Rationale
+

Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"interface-over-type-literal": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/jsdoc-format/index.html b/docs/_site/rules/jsdoc-format/index.html new file mode 100644 index 00000000000..efbb195d859 --- /dev/null +++ b/docs/_site/rules/jsdoc-format/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: jsdoc-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: jsdoc-format

+

+
+ + +

Enforces basic format rules for JSDoc comments.

+ + + +

The following rules are enforced for JSDoc comments (comments starting with /**):

+ +
    +
  • each line contains an asterisk and asterisks must be aligned
  • +
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • +
  • the only characters before the asterisk on each line must be whitespace characters
  • +
  • one line comments must start with /** and end with */
  • +
  • multiline comments don’t allow text after /** in the first line (with option "check-multiline-start")
  • +
+ + + + + +
Rationale
+

Helps maintain a consistent, readable style for JSDoc comments.

+ + + + + +

Config

+ +

You can optionally specify the option "check-multiline-start" to enforce the first line of a +multiline JSDoc comment to be empty.

+ + + +
Config examples
+ +
+"jsdoc-format": true
+
+ +
+"jsdoc-format": [true, "check-multiline-start"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "minItems": 0,
+  "maxItems": 1,
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-multiline-start"
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/label-position/index.html b/docs/_site/rules/label-position/index.html new file mode 100644 index 00000000000..e46696204ce --- /dev/null +++ b/docs/_site/rules/label-position/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: label-position + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: label-position

+

+
+ + +

Only allows labels in sensible locations.

+ + +

This rule only allows labels to be on do/for/while/switch statements.

+ + + + +
Rationale
+ +

Labels in JavaScript only can be used in conjunction with break or continue, +constructs meant to be used for loop flow control. While you can theoretically use +labels on any block statement in JS, it is considered poor code structure to do so.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"label-position": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/linebreak-style/index.html b/docs/_site/rules/linebreak-style/index.html new file mode 100644 index 00000000000..f597372c0a1 --- /dev/null +++ b/docs/_site/rules/linebreak-style/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: linebreak-style + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: linebreak-style

+

+
+ + +

Enforces a consistent linebreak style.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following options must be provided:

+ +
    +
  • "LF" requires LF (\n) linebreaks
  • +
  • "CRLF" requires CRLF (\r\n) linebreaks
  • +
+ + +
Config examples
+ +
+"linebreak-style": [true, "LF"]
+
+ +
+"linebreak-style": [true, "CRLF"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "LF",
+    "CRLF"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/match-default-export-name/index.html b/docs/_site/rules/match-default-export-name/index.html new file mode 100644 index 00000000000..4c91ce493c2 --- /dev/null +++ b/docs/_site/rules/match-default-export-name/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: match-default-export-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: match-default-export-name

+

+
+ + + +

Requires that a default import have the same name as the declaration it imports. +Does nothing for anonymous default exports.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"match-default-export-name": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-classes-per-file/index.html b/docs/_site/rules/max-classes-per-file/index.html new file mode 100644 index 00000000000..69ab82fb2e0 --- /dev/null +++ b/docs/_site/rules/max-classes-per-file/index.html @@ -0,0 +1,167 @@ + + + + + + + + + Rule: max-classes-per-file + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-classes-per-file

+

+
+ + + +

A file may not contain more than the specified number of classes

+ + + + +
Rationale
+ +

Ensures that files have a single responsibility so that that classes each exist in their own files

+ + + + + +

Config

+ +

The one required argument is an integer indicating the maximum number of classes that can appear in a +file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions +from the overall class count.

+ + +
Config examples
+ +
+"max-classes-per-file": [true, 1]
+
+ +
+"max-classes-per-file": [true, 5, "exclude-class-expressions"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "number",
+      "minimum": 1
+    },
+    {
+      "type": "string",
+      "enum": [
+        "exclude-class-expressions"
+      ]
+    }
+  ],
+  "additionalItems": false,
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-file-line-count/index.html b/docs/_site/rules/max-file-line-count/index.html new file mode 100644 index 00000000000..562c9284102 --- /dev/null +++ b/docs/_site/rules/max-file-line-count/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: max-file-line-count + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-file-line-count

+

+
+ + +

Requires files to remain under a certain number of lines

+ + + + +
Rationale
+ +

Limiting the number of lines allowed in a file allows files to remain small, +single purpose, and maintainable.

+ + + + + +

Config

+

An integer indicating the maximum number of lines.

+ + +
Config examples
+ +
+"max-file-line-count": [true, 300]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": "1"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-line-length/index.html b/docs/_site/rules/max-line-length/index.html new file mode 100644 index 00000000000..2f3b787f5df --- /dev/null +++ b/docs/_site/rules/max-line-length/index.html @@ -0,0 +1,191 @@ + + + + + + + + + Rule: max-line-length + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-line-length

+

+
+ + +

Requires lines to be under a certain max length.

+ + + + +
Rationale
+ +

Limiting the length of a line of code improves code readability. +It also makes comparing code side-by-side easier and improves compatibility with +various editors, IDEs, and diff viewers.

+ + + + + +

Config

+ +

It can take one argument, which can be any of the following:

+
    +
  • integer indicating maximum length of lines.
  • +
  • object with keys: +
      +
    • limit - number < 0 defining max line length
    • +
    • ignore-pattern - string defining ignore pattern for this rule, being parsed by new RegExp(). +For example: +
        +
      • // pattern will ignore all in-line comments.
      • +
      • ^import pattern will ignore all import statements.
      • +
      • ^export {(.*?)} pattern will ignore all multiple export statements.
      • +
      • class [a-zA-Z] implements pattern will ignore all class declarations implementing interfaces.
      • +
      • ^import |^export {(.*?)}|class [a-zA-Z] implements |// pattern will ignore all the cases listed above.
      • +
      +
    • +
    +
  • +
+ + + +
Config examples
+ +
+"max-line-length": [true, 120]
+
+ +
+"max-line-length": [true, {"limit": 120, "ignore-pattern": "^import |^export {(.*?)}"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "oneOf": [
+      {
+        "type": "number"
+      },
+      {
+        "type": "object",
+        "properties": {
+          "limit": {
+            "type": "number"
+          },
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false
+      }
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/member-access/index.html b/docs/_site/rules/member-access/index.html new file mode 100644 index 00000000000..d6a99a3913d --- /dev/null +++ b/docs/_site/rules/member-access/index.html @@ -0,0 +1,181 @@ + + + + + + + + + Rule: member-access + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: member-access

+

+
+ + +

Requires explicit visibility declarations for class members.

+ + + + +
Rationale
+

Explicit visibility declarations can make code more readable and accessible for those new to TS.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

These arguments may be optionally provided:

+ +
    +
  • "no-public" forbids public accessibility to be specified, because this is the default.
  • +
  • "check-accessor" enforces explicit visibility on get/set accessors
  • +
  • "check-constructor" enforces explicit visibility on constructors
  • +
  • "check-parameter-property" enforces explicit visibility on parameter properties
  • +
+ + +
Config examples
+ +
+"member-access": true
+
+ +
+"member-access": [true, "no-public"]
+
+ +
+"member-access": [true, "check-accessor"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "no-public",
+      "check-accessor",
+      "check-constructor",
+      "check-parameter-property"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 4
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/member-ordering/index.html b/docs/_site/rules/member-ordering/index.html new file mode 100644 index 00000000000..1ecb56d9037 --- /dev/null +++ b/docs/_site/rules/member-ordering/index.html @@ -0,0 +1,266 @@ + + + + + + + + + Rule: member-ordering + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: member-ordering

+

+
+ + +

Enforces member ordering.

+ + + + +
Rationale
+

A consistent ordering for class members can make classes easier to read, navigate, and edit.

+ + + + + +

Config

+ +

One argument, which is an object, must be provided. It should contain an order property. +The order property should have a value of one of the following strings:

+ +
    +
  • fields-first
  • +
  • instance-sandwich
  • +
  • statics-first
  • +
+ +

Alternatively, the value for order maybe be an array consisting of the following strings:

+ +
    +
  • public-static-field
  • +
  • public-static-method
  • +
  • protected-static-field
  • +
  • protected-static-method
  • +
  • private-static-field
  • +
  • private-static-method
  • +
  • public-instance-field
  • +
  • protected-instance-field
  • +
  • private-instance-field
  • +
  • public-constructor
  • +
  • protected-constructor
  • +
  • private-constructor
  • +
  • public-instance-method
  • +
  • protected-instance-method
  • +
  • private-instance-method
  • +
+ +

You can also omit the access modifier to refer to “public-“, “protected-“, and “private-“ all at once; for example, “static-field”.

+ +

You can also make your own categories by using an object instead of a string:

+ +
{
+    "name": "static non-private",
+    "kinds": [
+        "public-static-field",
+        "protected-static-field",
+        "public-static-method",
+        "protected-static-method"
+    ]
+}
+
+ +

The ‘alphabetize’ option will enforce that members within the same category should be alphabetically sorted by name.

+ + +
Config examples
+ +
+"member-ordering": [true, {"order": "fields-first"}]
+
+ +
+"member-ordering": [
+  true,
+  {
+    "order": [
+      "public-static-field",
+      "public-instance-field",
+      "public-constructor",
+      "private-static-field",
+      "private-instance-field",
+      "private-constructor",
+      "public-instance-method",
+      "protected-instance-method",
+      "private-instance-method"
+    ]
+  }
+]
+
+ +
+"member-ordering": [
+  true,
+  {
+    "order": [
+      {
+        "name": "static non-private",
+        "kinds": [
+          "public-static-field",
+          "protected-static-field",
+          "public-static-method",
+          "protected-static-method"
+        ]
+      },
+      "constructor"
+    ]
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "order": {
+      "oneOf": [
+        {
+          "type": "string",
+          "enum": [
+            "fields-first",
+            "instance-sandwich",
+            "statics-first"
+          ]
+        },
+        {
+          "type": "array",
+          "items": {
+            "type": "string",
+            "enum": [
+              "public-static-field",
+              "public-static-method",
+              "protected-static-field",
+              "protected-static-method",
+              "private-static-field",
+              "private-static-method",
+              "public-instance-field",
+              "protected-instance-field",
+              "private-instance-field",
+              "public-constructor",
+              "protected-constructor",
+              "private-constructor",
+              "public-instance-method",
+              "protected-instance-method",
+              "private-instance-method"
+            ]
+          },
+          "maxLength": 13
+        }
+      ]
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/new-parens/index.html b/docs/_site/rules/new-parens/index.html new file mode 100644 index 00000000000..d35725f0c0e --- /dev/null +++ b/docs/_site/rules/new-parens/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: new-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: new-parens

+

+
+ + +

Requires parentheses when invoking a constructor via the new keyword.

+ + + + +
Rationale
+

Maintains stylistic consistency with other function calls.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"new-parens": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/newline-before-return/index.html b/docs/_site/rules/newline-before-return/index.html new file mode 100644 index 00000000000..32cda592847 --- /dev/null +++ b/docs/_site/rules/newline-before-return/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: newline-before-return + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: newline-before-return

+

+
+ + +

Enforces blank line before return when not the only line in the block.

+ + + + +
Rationale
+

Helps maintain a readable style in your codebase.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"newline-before-return": true
+
+ + +
Schema
+
+{}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/newline-per-chained-call/index.html b/docs/_site/rules/newline-per-chained-call/index.html new file mode 100644 index 00000000000..d01b1ed0ebd --- /dev/null +++ b/docs/_site/rules/newline-per-chained-call/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: newline-per-chained-call + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: newline-per-chained-call

+

+
+ + + +

Requires that chained method calls be broken apart onto separate lines.

+ + + + +
Rationale
+ +

This style helps to keep code ‘vertical’, avoiding the need for side-scrolling in IDEs or text editors.

+ + + + + +

Config

+

Not configurable

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-angle-bracket-type-assertion/index.html b/docs/_site/rules/no-angle-bracket-type-assertion/index.html new file mode 100644 index 00000000000..9d51974a0ce --- /dev/null +++ b/docs/_site/rules/no-angle-bracket-type-assertion/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-angle-bracket-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-angle-bracket-type-assertion

+

+
+ + +

Requires the use of as Type for type assertions instead of <Type>.

+ + + + +
Rationale
+ +

Both formats of type assertions have the same effect, but only as type assertions +work in .tsx files. This rule ensures that you have a consistent type assertion style +across your codebase.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-angle-bracket-type-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-any/index.html b/docs/_site/rules/no-any/index.html new file mode 100644 index 00000000000..83d82049eba --- /dev/null +++ b/docs/_site/rules/no-any/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-any + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-any

+

+
+ + +

Disallows usages of any as a type declaration.

+ + + + +
Rationale
+

Using any as a type declaration nullifies the compile-time benefits of the type system.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-any": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-arg/index.html b/docs/_site/rules/no-arg/index.html new file mode 100644 index 00000000000..6243eaa30c3 --- /dev/null +++ b/docs/_site/rules/no-arg/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-arg + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-arg

+

+
+ + +

Disallows use of arguments.callee.

+ + + + +
Rationale
+ +

Using arguments.callee makes various performance optimizations impossible. +See MDN +for more details on why to avoid arguments.callee.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-arg": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-bitwise/index.html b/docs/_site/rules/no-bitwise/index.html new file mode 100644 index 00000000000..27022219ed5 --- /dev/null +++ b/docs/_site/rules/no-bitwise/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: no-bitwise + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-bitwise

+

+
+ + +

Disallows bitwise operators.

+ + + +

Specifically, the following bitwise operators are banned: +&, &=, |, |=, +^, ^=, <<, <<=, +>>, >>=, >>>, >>>=, and ~. +This rule does not ban the use of & and | for intersection and union types.

+ + + + +
Rationale
+ +

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. +They also can be an indicator of overly clever code which decreases maintainability.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-bitwise": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-boolean-literal-compare/index.html b/docs/_site/rules/no-boolean-literal-compare/index.html new file mode 100644 index 00000000000..2e6c26a7fd0 --- /dev/null +++ b/docs/_site/rules/no-boolean-literal-compare/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-boolean-literal-compare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-boolean-literal-compare

+

+
+ + +

Warns on comparison to a boolean literal, as in x === true.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-boolean-literal-compare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-conditional-assignment/index.html b/docs/_site/rules/no-conditional-assignment/index.html new file mode 100644 index 00000000000..4e53b57141e --- /dev/null +++ b/docs/_site/rules/no-conditional-assignment/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-conditional-assignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-conditional-assignment

+

+
+ + +

Disallows any type of assignment in conditionals.

+ + +

This applies to do-while, for, if, and while statements and conditional (ternary) expressions.

+ + + + +
Rationale
+ +

Assignments in conditionals are often typos: +for example if (var1 = var2) instead of if (var1 == var2). +They also can be an indicator of overly clever code which decreases maintainability.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-conditional-assignment": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-consecutive-blank-lines/index.html b/docs/_site/rules/no-consecutive-blank-lines/index.html new file mode 100644 index 00000000000..2c1a526b122 --- /dev/null +++ b/docs/_site/rules/no-consecutive-blank-lines/index.html @@ -0,0 +1,159 @@ + + + + + + + + + Rule: no-consecutive-blank-lines + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-consecutive-blank-lines

+

+
+ + +

Disallows one or more blank lines in a row.

+ + + + +
Rationale
+

Helps maintain a readable style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

An optional number of maximum allowed sequential blanks can be specified. If no value +is provided, a default of 1 will be used.

+ + +
Config examples
+ +
+"no-consecutive-blank-lines": true
+
+ +
+"no-consecutive-blank-lines": [true, 2]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": "1"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-console/index.html b/docs/_site/rules/no-console/index.html new file mode 100644 index 00000000000..d492a144d4f --- /dev/null +++ b/docs/_site/rules/no-console/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-console + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-console

+

+
+ + +

Bans the use of specified console methods.

+ + + + +
Rationale
+

In general, console methods aren’t appropriate for production code.

+ + + + + +

Config

+

A list of method names to ban. If no method names are provided, all console methods are banned.

+ + +
Config examples
+ +
+"no-console": [true, "log", "error"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-construct/index.html b/docs/_site/rules/no-construct/index.html new file mode 100644 index 00000000000..0a3bffd6d41 --- /dev/null +++ b/docs/_site/rules/no-construct/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-construct + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-construct

+

+
+ + +

Disallows access to the constructors of String, Number, and Boolean.

+ + +

Disallows constructor use such as new Number(foo) but does not disallow Number(foo).

+ + + + +
Rationale
+ +

There is little reason to use String, Number, or Boolean as constructors. +In almost all cases, the regular function-call version is more appropriate. +More details are available on StackOverflow.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-construct": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-debugger/index.html b/docs/_site/rules/no-debugger/index.html new file mode 100644 index 00000000000..d91a7c8195b --- /dev/null +++ b/docs/_site/rules/no-debugger/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-debugger + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-debugger

+

+
+ + +

Disallows debugger statements.

+ + + + +
Rationale
+

In general, debugger statements aren’t appropriate for production code.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-debugger": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-default-export/index.html b/docs/_site/rules/no-default-export/index.html new file mode 100644 index 00000000000..bd289c5e62e --- /dev/null +++ b/docs/_site/rules/no-default-export/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-default-export + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-default-export

+

+
+ + +

Disallows default exports in ES6-style modules.

+ + +

Use named exports instead.

+ + + + +
Rationale
+ +

Named imports/exports promote clarity. +In addition, current tooling differs on the correct way to handle default imports/exports. +Avoiding them all together can help avoid tooling bugs and conflicts.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-default-export": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-imports/index.html b/docs/_site/rules/no-duplicate-imports/index.html new file mode 100644 index 00000000000..3b843d0d02e --- /dev/null +++ b/docs/_site/rules/no-duplicate-imports/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-duplicate-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-imports

+

+
+ + + +

Disallows multiple import statements from the same module.

+ + + + +
Rationale
+ +

Using a single import statement per module will make the code clearer because you can see everything being imported +from that module on one line.

+ + + + + +

Config

+

Not configurable

+ + +
Config examples
+ +
+"no-duplicate-imports": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-super/index.html b/docs/_site/rules/no-duplicate-super/index.html new file mode 100644 index 00000000000..637a74d625e --- /dev/null +++ b/docs/_site/rules/no-duplicate-super/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-duplicate-super + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-super

+

+
+ + +

Warns if ‘super()’ appears twice in a constructor.

+ + + + +
Rationale
+

The second call to ‘super()’ will fail at runtime.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-duplicate-super": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-switch-case/index.html b/docs/_site/rules/no-duplicate-switch-case/index.html new file mode 100644 index 00000000000..1882ea04451 --- /dev/null +++ b/docs/_site/rules/no-duplicate-switch-case/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-duplicate-switch-case + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-switch-case

+

+
+ + +

Prevents duplicate cases in switch statements.

+ + + + + + + +

Config

+ + + +
Config examples
+ +
+"no-duplicate-switch-case": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-variable/index.html b/docs/_site/rules/no-duplicate-variable/index.html new file mode 100644 index 00000000000..9c8c627124a --- /dev/null +++ b/docs/_site/rules/no-duplicate-variable/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-duplicate-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-variable

+

+
+ + +

Disallows duplicate variable declarations in the same block scope.

+ + + +

This rule is only useful when using the var keyword - +the compiler will detect redeclarations of let and const variables.

+ + + + +
Rationale
+ +

A variable can be reassigned if necessary - +there’s no good reason to have a duplicate variable declaration.

+ + + + + +

Config

+

You can specify "check-parameters" to check for variables with the same name as a parameter.

+ + +
Config examples
+ +
+"no-duplicate-variable": true
+
+ +
+"no-duplicate-variable": [true, "check-parameters"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "check-parameters"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-dynamic-delete/index.html b/docs/_site/rules/no-dynamic-delete/index.html new file mode 100644 index 00000000000..3e7ac893867 --- /dev/null +++ b/docs/_site/rules/no-dynamic-delete/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: no-dynamic-delete + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-dynamic-delete

+

+
+ + +

Bans usage of the delete operator with computed key expressions.

+ + + + +
Rationale
+ +

Deleting dynamically computed keys is dangerous and not well optimized.

+ +

Also consider using a Map +or Set +if you’re storing collections of objects. +Using Objects can cause occasional edge case bugs, such as if a key is named “hasOwnProperty”.

+ + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-dynamic-delete": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-empty-interface/index.html b/docs/_site/rules/no-empty-interface/index.html new file mode 100644 index 00000000000..283c1caf315 --- /dev/null +++ b/docs/_site/rules/no-empty-interface/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-empty-interface + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-empty-interface

+

+
+ + +

Forbids empty interfaces.

+ + + + +
Rationale
+

An empty interface is equivalent to its supertype (or {}).

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-empty/index.html b/docs/_site/rules/no-empty/index.html new file mode 100644 index 00000000000..f2d4935079e --- /dev/null +++ b/docs/_site/rules/no-empty/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-empty + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-empty

+

+
+ + +

Disallows empty blocks.

+ + +

Blocks with a comment inside are not considered empty.

+ + + + +
Rationale
+

Empty blocks are often indicators of missing code.

+ + + + + +

Config

+ +

If allow-empty-catch is specified, then catch blocks are allowed to be empty.

+ + +
Config examples
+ +
+"no-empty": true
+
+ +
+"no-empty": [true, "allow-empty-catch"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-empty-catch"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-eval/index.html b/docs/_site/rules/no-eval/index.html new file mode 100644 index 00000000000..a061bb8633a --- /dev/null +++ b/docs/_site/rules/no-eval/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-eval + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-eval

+

+
+ + +

Disallows eval function invocations.

+ + + + +
Rationale
+ +

eval() is dangerous as it allows arbitrary code execution with full privileges. There are +alternatives +for most of the use cases for eval().

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-eval": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-floating-promises/index.html b/docs/_site/rules/no-floating-promises/index.html new file mode 100644 index 00000000000..a7aa472656d --- /dev/null +++ b/docs/_site/rules/no-floating-promises/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: no-floating-promises + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-floating-promises

+

+
+ + +

Promises returned by functions must be handled appropriately.

+ + +

Use no-unused-expression in addition to this rule to reveal even more floating promises.

+ + + + +
Rationale
+

Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.

+ + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

A list of ‘string’ names of any additional classes that should also be handled as Promises.

+ + + +
Config examples
+ +
+"no-floating-promises": true
+
+ +
+"no-floating-promises": [true, "JQueryPromise"]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-for-in-array/index.html b/docs/_site/rules/no-for-in-array/index.html new file mode 100644 index 00000000000..d330bfea921 --- /dev/null +++ b/docs/_site/rules/no-for-in-array/index.html @@ -0,0 +1,161 @@ + + + + + + + + + Rule: no-for-in-array + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-for-in-array

+

+
+ + +

Disallows iterating over an array with a for-in loop.

+ + + +

A for-in loop (for (var k in o)) iterates over the properties of an Object.

+ +

While it is legal to use for-in loops with array types, it is not common. +for-in will iterate over the indices of the array as strings, omitting any “holes” in +the array.

+ +

More common is to use for-of, which iterates over the values of an array. +If you want to iterate over the indices, alternatives include:

+ +

array.forEach((value, index) => { … }); +for (const [index, value] of array.entries()) { … } +for (let i = 0; i < array.length; i++) { … }

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-for-in-array": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-implicit-dependencies/index.html b/docs/_site/rules/no-implicit-dependencies/index.html new file mode 100644 index 00000000000..3fb7e0d8a63 --- /dev/null +++ b/docs/_site/rules/no-implicit-dependencies/index.html @@ -0,0 +1,165 @@ + + + + + + + + + Rule: no-implicit-dependencies + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-implicit-dependencies

+

+
+ + +

Disallows importing modules that are not listed as dependency in the project’s package.json

+ + + +

Disallows importing transient dependencies and modules installed above your package’s root directory.

+ + + + + + + + +

Config

+ +

By default the rule looks at "dependencies" and "peerDependencies". +By adding the "dev" option the rule looks at "devDependencies" instead of "peerDependencies". +By adding the "optional" option the rule also looks at "optionalDependencies".

+ + + +
Config examples
+ +
+"no-implicit-dependencies": true
+
+ +
+"no-implicit-dependencies": [true, "dev"]
+
+ +
+"no-implicit-dependencies": [true, "optional"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "dev",
+      "optional"
+    ]
+  },
+  "minItems": 0,
+  "maxItems": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-import-side-effect/index.html b/docs/_site/rules/no-import-side-effect/index.html new file mode 100644 index 00000000000..9ccd1ea5bec --- /dev/null +++ b/docs/_site/rules/no-import-side-effect/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: no-import-side-effect + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-import-side-effect

+

+
+ + +

Avoid import statements with side-effect.

+ + + + +
Rationale
+

Imports with side effects may have behavior which is hard for static verification.

+ + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • ignore-module allows to specify a regex and ignore modules which it matches.
  • +
+ + +
Config examples
+ +
+"no-import-side-effect": true
+
+ +
+"no-import-side-effect": [true, {"ignore-module": "(\\.html|\\.css)$"}]
+
+ + +
Schema
+
+{
+  "items": {
+    "properties": {
+      "ignore-module": {
+        "type": "string"
+      }
+    },
+    "type": "object"
+  },
+  "maxLength": 1,
+  "minLength": 0,
+  "type": "array"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-inferrable-types/index.html b/docs/_site/rules/no-inferrable-types/index.html new file mode 100644 index 00000000000..31729be771b --- /dev/null +++ b/docs/_site/rules/no-inferrable-types/index.html @@ -0,0 +1,178 @@ + + + + + + + + + Rule: no-inferrable-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-inferrable-types

+

+
+ + +

Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.

+ + + + +
Rationale
+

Explicit types where they can be easily inferred by the compiler make code more verbose.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • ignore-params allows specifying an inferrable type annotation for function params. +This can be useful when combining with the typedef rule.
  • +
  • ignore-properties allows specifying an inferrable type annotation for class properties.
  • +
+ + +
Config examples
+ +
+"no-inferrable-types": true
+
+ +
+"no-inferrable-types": [true, "ignore-params"]
+
+ +
+"no-inferrable-types": [true, "ignore-params", "ignore-properties"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-params",
+      "ignore-properties"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-inferred-empty-object-type/index.html b/docs/_site/rules/no-inferred-empty-object-type/index.html new file mode 100644 index 00000000000..3d5fe55a4d8 --- /dev/null +++ b/docs/_site/rules/no-inferred-empty-object-type/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: no-inferred-empty-object-type + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-inferred-empty-object-type

+

+
+ + +

Disallow type inference of {} (empty object type) at function and constructor call sites

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-inferred-empty-object-type": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-internal-module/index.html b/docs/_site/rules/no-internal-module/index.html new file mode 100644 index 00000000000..d4ba5ba4467 --- /dev/null +++ b/docs/_site/rules/no-internal-module/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-internal-module + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-internal-module

+

+
+ + +

Disallows internal module

+ + + + +
Rationale
+

Using module leads to a confusion of concepts with external modules. Use the newer namespace keyword instead.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-internal-module": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-invalid-template-strings/index.html b/docs/_site/rules/no-invalid-template-strings/index.html new file mode 100644 index 00000000000..df9e1905b3f --- /dev/null +++ b/docs/_site/rules/no-invalid-template-strings/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-invalid-template-strings + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-invalid-template-strings

+

+
+ + +

Warns on use of ${ in non-template strings.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-invalid-template-strings": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-invalid-this/index.html b/docs/_site/rules/no-invalid-this/index.html new file mode 100644 index 00000000000..dec83b55801 --- /dev/null +++ b/docs/_site/rules/no-invalid-this/index.html @@ -0,0 +1,160 @@ + + + + + + + + + Rule: no-invalid-this + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-invalid-this

+

+
+ + +

Disallows using the this keyword outside of classes.

+ + + + +
Rationale
+

See the rule’s author’s rationale here.

+ + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • check-function-in-method disallows using the this keyword in functions within class methods.
  • +
+ + +
Config examples
+ +
+"no-invalid-this": true
+
+ +
+"no-invalid-this": [true, "check-function-in-method"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-function-in-method"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-irregular-whitespace/index.html b/docs/_site/rules/no-irregular-whitespace/index.html new file mode 100644 index 00000000000..148af75f96d --- /dev/null +++ b/docs/_site/rules/no-irregular-whitespace/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-irregular-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-irregular-whitespace

+

+
+ + +

Disallow irregular whitespace outside of strings and comments

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-irregular-whitespace": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-magic-numbers/index.html b/docs/_site/rules/no-magic-numbers/index.html new file mode 100644 index 00000000000..6320e02a021 --- /dev/null +++ b/docs/_site/rules/no-magic-numbers/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-magic-numbers + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-magic-numbers

+

+
+ + + +

Disallows the use constant number values outside of variable assignments. +When no list of allowed values is specified, -1, 0 and 1 are allowed by default.

+ + + + +
Rationale
+ +

Magic numbers should be avoided as they often lack documentation, forcing +them to be stored in variables gives them implicit documentation.

+ + + + + +

Config

+

A list of allowed numbers.

+ + +
Config examples
+ +
+"no-magic-numbers": true
+
+ +
+"no-magic-numbers": [true, 1, 2, 3]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "number"
+  },
+  "minLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-mergeable-namespace/index.html b/docs/_site/rules/no-mergeable-namespace/index.html new file mode 100644 index 00000000000..7261ea23cb3 --- /dev/null +++ b/docs/_site/rules/no-mergeable-namespace/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-mergeable-namespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-mergeable-namespace

+

+
+ + +

Disallows mergeable namespaces in the same file.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-mergeable-namespace": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-misused-new/index.html b/docs/_site/rules/no-misused-new/index.html new file mode 100644 index 00000000000..66b1dd18dcf --- /dev/null +++ b/docs/_site/rules/no-misused-new/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-misused-new + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-misused-new

+

+
+ + +

Warns on apparent attempts to define constructors for interfaces or new for classes.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-misused-new": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-namespace/index.html b/docs/_site/rules/no-namespace/index.html new file mode 100644 index 00000000000..a31424cc42a --- /dev/null +++ b/docs/_site/rules/no-namespace/index.html @@ -0,0 +1,174 @@ + + + + + + + + + Rule: no-namespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-namespace

+

+
+ + +

Disallows use of internal modules and namespaces.

+ + +

This rule still allows the use of declare module ... {}

+ + + + +
Rationale
+ +

ES6-style external modules are the standard way to modularize code. +Using module {} and namespace {} are outdated ways to organize TypeScript code.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • allow-declarations allows declare namespace ... {} to describe external APIs.
  • +
+ + +
Config examples
+ +
+"no-namespace": true
+
+ +
+"no-namespace": [true, "allow-declarations"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-declarations"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-non-null-assertion/index.html b/docs/_site/rules/no-non-null-assertion/index.html new file mode 100644 index 00000000000..38965c1b2d4 --- /dev/null +++ b/docs/_site/rules/no-non-null-assertion/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-non-null-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-non-null-assertion

+

+
+ + +

Disallows non-null assertions using the ! postfix operator.

+ + + + +
Rationale
+

Using non-null assertion cancels the benefits of the strict null checking mode.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-non-null-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-null-keyword/index.html b/docs/_site/rules/no-null-keyword/index.html new file mode 100644 index 00000000000..0f2bb6581f2 --- /dev/null +++ b/docs/_site/rules/no-null-keyword/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-null-keyword + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-null-keyword

+

+
+ + +

Disallows use of the null keyword literal.

+ + + + +
Rationale
+ +

Instead of having the dual concepts of null andundefined in a codebase, +this rule ensures that only undefined is used.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-null-keyword": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-object-literal-type-assertion/index.html b/docs/_site/rules/no-object-literal-type-assertion/index.html new file mode 100644 index 00000000000..47ebbb0f87d --- /dev/null +++ b/docs/_site/rules/no-object-literal-type-assertion/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-object-literal-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-object-literal-type-assertion

+

+
+ + + +

Forbids an object literal to appear in a type assertion expression. +Casting to any is still allowed.

+ + + + +
Rationale
+ +

Always prefer const x: T = { ... }; to const x = { ... } as T;. +The type assertion in the latter case is either unnecessary or hides an error. +The compiler will warn for excess properties with this syntax, but not missing required fields. +For example: const x: { foo: number } = {} will fail to compile, but +const x = {} as { foo: number } will succeed.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-object-literal-type-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-parameter-properties/index.html b/docs/_site/rules/no-parameter-properties/index.html new file mode 100644 index 00000000000..1e63a106a7c --- /dev/null +++ b/docs/_site/rules/no-parameter-properties/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-parameter-properties + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-parameter-properties

+

+
+ + +

Disallows parameter properties in class constructors.

+ + + + +
Rationale
+ +

Parameter properties can be confusing to those new to TS as they are less explicit +than other ways of declaring and initializing class members.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-parameter-properties": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-parameter-reassignment/index.html b/docs/_site/rules/no-parameter-reassignment/index.html new file mode 100644 index 00000000000..a5b844547ad --- /dev/null +++ b/docs/_site/rules/no-parameter-reassignment/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-parameter-reassignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-parameter-reassignment

+

+
+ + +

Disallows reassigning parameters.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-parameter-reassignment": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-redundant-jsdoc/index.html b/docs/_site/rules/no-redundant-jsdoc/index.html new file mode 100644 index 00000000000..a4988e8ba0e --- /dev/null +++ b/docs/_site/rules/no-redundant-jsdoc/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-redundant-jsdoc + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-redundant-jsdoc

+

+
+ + +

Forbids JSDoc which duplicates TypeScript functionality.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-redundant-jsdoc": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-reference-import/index.html b/docs/_site/rules/no-reference-import/index.html new file mode 100644 index 00000000000..0ac920697b5 --- /dev/null +++ b/docs/_site/rules/no-reference-import/index.html @@ -0,0 +1,142 @@ + + + + + + + + + Rule: no-reference-import + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-reference-import

+

+
+ + +

Don’t <reference types="foo" /> if you import foo anyway.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-reference/index.html b/docs/_site/rules/no-reference/index.html new file mode 100644 index 00000000000..6dadb22541b --- /dev/null +++ b/docs/_site/rules/no-reference/index.html @@ -0,0 +1,143 @@ + + + + + + + + + Rule: no-reference + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-reference

+

+
+ + +

Disallows /// <reference path=> imports (use ES6-style imports instead).

+ + + + +
Rationale
+ +

Using /// <reference path=> comments to load other files is outdated. +Use ES6-style imports to reference other files.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-reference": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-require-imports/index.html b/docs/_site/rules/no-require-imports/index.html new file mode 100644 index 00000000000..353eae206d2 --- /dev/null +++ b/docs/_site/rules/no-require-imports/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-require-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-require-imports

+

+
+ + +

Disallows invocation of require().

+ + + + +
Rationale
+

Prefer the newer ES6-style imports over require().

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-require-imports": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-return-await/index.html b/docs/_site/rules/no-return-await/index.html new file mode 100644 index 00000000000..07484172174 --- /dev/null +++ b/docs/_site/rules/no-return-await/index.html @@ -0,0 +1,153 @@ + + + + + + + + + Rule: no-return-await + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-return-await

+

+
+ + +

Disallows unnecessary return await.

+ + + + +
Rationale
+ +

An async function always wraps the return value in a Promise. +Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.

+ + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-return-await": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-shadowed-variable/index.html b/docs/_site/rules/no-shadowed-variable/index.html new file mode 100644 index 00000000000..b9b771ba95b --- /dev/null +++ b/docs/_site/rules/no-shadowed-variable/index.html @@ -0,0 +1,213 @@ + + + + + + + + + Rule: no-shadowed-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-shadowed-variable

+

+
+ + +

Disallows shadowing variable declarations.

+ + + + +
Rationale
+

Shadowing a variable masks access to it and obscures to what value an identifier actually refers.

+ + + + + +

Config

+ +

You can optionally pass an object to disable checking for certain kinds of declarations. +Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" +and "typeParameter". Just set the value to false for the check you want to disable. +All checks default to true, i.e. are enabled by default. +Note that you cannot disable variables and parameters.

+ +

The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their +temporal dead zone. When set to false parameters, classes, enums and variables declared +with let or const are not considered shadowed if the shadowing occurs within their +temporal dead zone.

+ +

The following example shows how the "temporalDeadZone" option changes the linting result:

+ +
function fn(value) {
+    if (value) {
+        const tmp = value; // no error on this line if "temporalDeadZone" is false
+        return tmp;
+    }
+    let tmp = undefined;
+    if (!value) {
+        const tmp = value; // this line always contains an error
+        return tmp;
+    }
+}
+
+ + + +
Config examples
+ +
+"no-shadowed-variable": true
+
+ +
+"no-shadowed-variable": [
+  true,
+  {
+    "class": true,
+    "enum": true,
+    "function": true,
+    "interface": false,
+    "namespace": true,
+    "typeAlias": false,
+    "typeParameter": false
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "class": {
+      "type": "boolean"
+    },
+    "enum": {
+      "type": "boolean"
+    },
+    "function": {
+      "type": "boolean"
+    },
+    "import": {
+      "type": "boolean"
+    },
+    "interface": {
+      "type": "boolean"
+    },
+    "namespace": {
+      "type": "boolean"
+    },
+    "typeAlias": {
+      "type": "boolean"
+    },
+    "typeParameter": {
+      "type": "boolean"
+    },
+    "temporalDeadZone": {
+      "type": "boolean"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-sparse-arrays/index.html b/docs/_site/rules/no-sparse-arrays/index.html new file mode 100644 index 00000000000..dee04a79850 --- /dev/null +++ b/docs/_site/rules/no-sparse-arrays/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-sparse-arrays + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-sparse-arrays

+

+
+ + +

Forbids array literals to contain missing elements.

+ + + + +
Rationale
+

Missing elements are probably an accidentally duplicated comma.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-sparse-arrays": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-string-literal/index.html b/docs/_site/rules/no-string-literal/index.html new file mode 100644 index 00000000000..44babe9fca7 --- /dev/null +++ b/docs/_site/rules/no-string-literal/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-string-literal + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-string-literal

+

+
+ + + +

Forbids unnecessary string literal property access. +Allows obj["prop-erty"] (can’t be a regular property access). +Disallows obj["property"] (should be obj.property).

+ + + + +
Rationale
+ +

If --noImplicitAny is turned off, +property access via a string literal will be ‘any’ if the property does not exist.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-string-literal": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-string-throw/index.html b/docs/_site/rules/no-string-throw/index.html new file mode 100644 index 00000000000..f01098bb394 --- /dev/null +++ b/docs/_site/rules/no-string-throw/index.html @@ -0,0 +1,142 @@ + + + + + + + + + Rule: no-string-throw + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-string-throw

+

+
+ + +

Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-submodule-imports/index.html b/docs/_site/rules/no-submodule-imports/index.html new file mode 100644 index 00000000000..be3f5182f1f --- /dev/null +++ b/docs/_site/rules/no-submodule-imports/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-submodule-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-submodule-imports

+

+
+ + + +

Disallows importing any submodule.

+ + + + +
Rationale
+ +

Submodules of some packages are treated as private APIs and the import +paths may change without deprecation periods. It’s best to stick with +top-level package exports.

+ + + + + +

Config

+

A list of whitelisted package or submodule names.

+ + +
Config examples
+ +
+"no-submodule-imports": true
+
+ +
+"no-submodule-imports": [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-switch-case-fall-through/index.html b/docs/_site/rules/no-switch-case-fall-through/index.html new file mode 100644 index 00000000000..cd6c370339a --- /dev/null +++ b/docs/_site/rules/no-switch-case-fall-through/index.html @@ -0,0 +1,166 @@ + + + + + + + + + Rule: no-switch-case-fall-through + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-switch-case-fall-through

+

+
+ + +

Disallows falling through case statements.

+ + + +

For example, the following is not allowed:

+ +
switch(foo) {
+    case 1:
+        someFunc(foo);
+    case 2:
+        someOtherFunc(foo);
+}
+
+ +

However, fall through is allowed when case statements are consecutive or +a magic /* falls through */ comment is present. The following is valid:

+ +
switch(foo) {
+    case 1:
+        someFunc(foo);
+        /* falls through */
+    case 2:
+    case 3:
+        someOtherFunc(foo);
+}
+
+ + + + +
Rationale
+

Fall though in switch statements is often unintentional and a bug.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-switch-case-fall-through": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-this-assignment/index.html b/docs/_site/rules/no-this-assignment/index.html new file mode 100644 index 00000000000..ab7ec59beca --- /dev/null +++ b/docs/_site/rules/no-this-assignment/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: no-this-assignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-this-assignment

+

+
+ + +

Disallows unnecessary references to this.

+ + + + +
Rationale
+

Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not manging scope well.

+ + + + + +

Config

+ +

Two options may be provided on an object:

+ +
    +
  • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
  • +
  • allowed-names may be specified as a list of regular expressions to match allowed variable names.
  • +
+ + +
Config examples
+ +
+"no-this-assignment": true
+
+ +
+"no-this-assignment": [true, {"allowed-names": ["^self$"], "allow-destructuring": true}]
+
+ + +
Schema
+
+{
+  "additionalProperties": false,
+  "properties": {
+    "allow-destructuring": {
+      "type": "boolean"
+    },
+    "allowed-names": {
+      "listType": "string",
+      "type": "list"
+    }
+  },
+  "type": "object"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-trailing-whitespace/index.html b/docs/_site/rules/no-trailing-whitespace/index.html new file mode 100644 index 00000000000..c99e817afa9 --- /dev/null +++ b/docs/_site/rules/no-trailing-whitespace/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: no-trailing-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-trailing-whitespace

+

+
+ + +

Disallows trailing whitespace at the end of a line.

+ + + + +
Rationale
+

Keeps version control diffs clean as it prevents accidental whitespace from being committed.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Possible settings are:

+ +
    +
  • "ignore-template-strings": Allows trailing whitespace in template strings.
  • +
  • "ignore-comments": Allows trailing whitespace in comments.
  • +
  • "ignore-jsdoc": Allows trailing whitespace only in JSDoc comments.
  • +
  • "ignore-blank-lines": Allows trailing whitespace on empty lines.
  • +
+ + +
Config examples
+ +
+"no-trailing-whitespace": true
+
+ +
+"no-trailing-whitespace": [true, "ignore-comments"]
+
+ +
+"no-trailing-whitespace": [true, "ignore-jsdoc"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-comments",
+      "ignore-jsdoc",
+      "ignore-template-strings",
+      "ignore-blank-lines"
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unbound-method/index.html b/docs/_site/rules/no-unbound-method/index.html new file mode 100644 index 00000000000..679558ef442 --- /dev/null +++ b/docs/_site/rules/no-unbound-method/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-unbound-method + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unbound-method

+

+
+ + +

Warns when a method is used as outside of a method call.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

You may optionally pass “ignore-static” to ignore static methods.

+ + +
Config examples
+ +
+"no-unbound-method": true
+
+ +
+"no-unbound-method": [true, "ignore-static"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ignore-static"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html new file mode 100644 index 00000000000..2db62dbb7a7 --- /dev/null +++ b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: no-unnecessary-callback-wrapper + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-callback-wrapper

+

+
+ + + +

Replaces x => f(x) with just f. +To catch more cases, enable only-arrow-functions and arrow-return-shorthand too.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-callback-wrapper": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-class/index.html b/docs/_site/rules/no-unnecessary-class/index.html new file mode 100644 index 00000000000..7bed761e88f --- /dev/null +++ b/docs/_site/rules/no-unnecessary-class/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: no-unnecessary-class + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-class

+

+
+ + + +

Disallows classes that are not strictly necessary.

+ + + + +
Rationale
+ +

Users who come from a Java-style OO language may wrap +their utility functions in an extra class, instead of +putting them at the top level.

+ + + + + +

Config

+ +

Three arguments may be optionally provided:

+ +
    +
  • "allow-constructor-only" ignores classes whose members are constructors.
  • +
  • "allow-empty-class" ignores class DemoClass {}.
  • +
  • "allow-static-only" ignores classes whose members are static.
  • +
+ + +
Config examples
+ +
+"no-unnecessary-class": true
+
+ +
+"no-unnecessary-class": ["allow-empty-class", "allow-constructor-only"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-initializer/index.html b/docs/_site/rules/no-unnecessary-initializer/index.html new file mode 100644 index 00000000000..dbd6e26171d --- /dev/null +++ b/docs/_site/rules/no-unnecessary-initializer/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-unnecessary-initializer + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-initializer

+

+
+ + +

Forbids a ‘var’/’let’ statement or destructuring initializer to be initialized to ‘undefined’.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-initializer": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-qualifier/index.html b/docs/_site/rules/no-unnecessary-qualifier/index.html new file mode 100644 index 00000000000..ca3aabac10f --- /dev/null +++ b/docs/_site/rules/no-unnecessary-qualifier/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-unnecessary-qualifier + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-qualifier

+

+
+ + +

Warns when a namespace qualifier (A.x) is unnecessary.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-qualifier": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-type-assertion/index.html b/docs/_site/rules/no-unnecessary-type-assertion/index.html new file mode 100644 index 00000000000..5a2a395a3d1 --- /dev/null +++ b/docs/_site/rules/no-unnecessary-type-assertion/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-unnecessary-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-type-assertion

+

+
+ + +

Warns if a type assertion does not change the type of an expression.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

A list of whitelisted assertion types to ignore

+ + +
Config examples
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unsafe-any/index.html b/docs/_site/rules/no-unsafe-any/index.html new file mode 100644 index 00000000000..c134d81b2fa --- /dev/null +++ b/docs/_site/rules/no-unsafe-any/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-unsafe-any + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unsafe-any

+

+
+ + + +

Warns when using an expression of type ‘any’ in a dynamic way. +Uses are only allowed if they would work for {} | null | undefined. +Type casts and tests are allowed. +Expressions that work on all values (such as "" + x) are allowed.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unsafe-any": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unsafe-finally/index.html b/docs/_site/rules/no-unsafe-finally/index.html new file mode 100644 index 00000000000..239dd8b4d8d --- /dev/null +++ b/docs/_site/rules/no-unsafe-finally/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-unsafe-finally + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unsafe-finally

+

+
+ + + +

Disallows control flow statements, such as return, continue, +break and throws in finally blocks.

+ + + + + + + +
Rationale
+ +

When used inside finally blocks, control flow statements, +such as return, continue, break and throws +override any other control flow statements in the same try/catch scope. +This is confusing and unexpected behavior.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unsafe-finally": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unused-expression/index.html b/docs/_site/rules/no-unused-expression/index.html new file mode 100644 index 00000000000..1fe05f0da72 --- /dev/null +++ b/docs/_site/rules/no-unused-expression/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: no-unused-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unused-expression

+

+
+ + +

Disallows unused expression statements.

+ + + +

Unused expressions are expression statements which are not assignments or function calls +(and thus usually no-ops).

+ + + + +
Rationale
+ +

Detects potential errors where an assignment or function call was intended.

+ + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform +method or function calls for side effects (e.g. e && e.preventDefault()).
  • +
  • allow-new allows ‘new’ expressions for side effects (e.g. new ModifyGlobalState();.
  • +
  • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
  • +
+ + +
Config examples
+ +
+"no-unused-expression": true
+
+ +
+"no-unused-expression": [true, "allow-fast-null-checks"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-fast-null-checks",
+      "allow-new",
+      "allow-tagged-template"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unused-variable/index.html b/docs/_site/rules/no-unused-variable/index.html new file mode 100644 index 00000000000..eb2977a14a3 --- /dev/null +++ b/docs/_site/rules/no-unused-variable/index.html @@ -0,0 +1,197 @@ + + + + + + + + + Rule: no-unused-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unused-variable

+

+
+ + +

Disallows unused imports, variables, functions and + private class members. Similar to tsc’s –noUnusedParameters and –noUnusedLocals + options, but does not interrupt code compilation.

+ + + +

In addition to avoiding compilation errors, this rule may still be useful if you +wish to have tslint automatically remove unused imports, variables, functions, +and private class members, when using TSLint’s --fix option.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+ +

Three optional arguments may be optionally provided:

+ +
    +
  • "check-parameters" disallows unused function and constructor parameters. +
      +
    • NOTE: this option is experimental and does not work with classes + that use abstract method declarations, among other things.
    • +
    +
  • +
  • {"ignore-pattern": "pattern"} where pattern is a case-sensitive regexp. +Variable names and imports that match the pattern will be ignored.
  • +
+ + +
Config examples
+ +
+"no-unused-variable": true
+
+ +
+"no-unused-variable": [true, {"ignore-pattern": "^_"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "oneOf": [
+      {
+        "type": "string",
+        "enum": [
+          "check-parameters"
+        ]
+      },
+      {
+        "type": "object",
+        "properties": {
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false
+      }
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-use-before-declare/index.html b/docs/_site/rules/no-use-before-declare/index.html new file mode 100644 index 00000000000..1513735112a --- /dev/null +++ b/docs/_site/rules/no-use-before-declare/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: no-use-before-declare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-use-before-declare

+

+
+ + +

Disallows usage of variables before their declaration.

+ + + +

This rule is primarily useful when using the var keyword since the compiler will +automatically detect if a block-scoped let and const variable is used before +declaration. Since most modern TypeScript doesn’t use var, this rule is generally +discouraged and is kept around for legacy purposes. It is slow to compute, is not +enabled in the built-in configuration presets, and should not be used to inform TSLint +design decisions.

+ + + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-use-before-declare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-var-keyword/index.html b/docs/_site/rules/no-var-keyword/index.html new file mode 100644 index 00000000000..554d8876240 --- /dev/null +++ b/docs/_site/rules/no-var-keyword/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: no-var-keyword + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-var-keyword

+

+
+ + +

Disallows usage of the var keyword.

+ + +

Use let or const instead.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-var-keyword": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-var-requires/index.html b/docs/_site/rules/no-var-requires/index.html new file mode 100644 index 00000000000..768c7655fe8 --- /dev/null +++ b/docs/_site/rules/no-var-requires/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: no-var-requires + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-var-requires

+

+
+ + +

Disallows the use of require statements except in import statements.

+ + + +

In other words, the use of forms such as var module = require("module") are banned. +Instead use ES6 style imports or import foo = require('foo') imports.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-var-requires": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-void-expression/index.html b/docs/_site/rules/no-void-expression/index.html new file mode 100644 index 00000000000..72eb363ba52 --- /dev/null +++ b/docs/_site/rules/no-void-expression/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-void-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-void-expression

+

+
+ + +

Requires expressions of type void to appear in statement position.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ +

If ignore-arrow-function-shorthand is provided, () => returnsVoid() will be allowed. +Otherwise, it must be written as () => { returnsVoid(); }.

+ + +
Config examples
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-arrow-function-shorthand"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/number-literal-format/index.html b/docs/_site/rules/number-literal-format/index.html new file mode 100644 index 00000000000..451dc8d70cd --- /dev/null +++ b/docs/_site/rules/number-literal-format/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: number-literal-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: number-literal-format

+

+
+ + +

Checks that decimal literals should begin with ‘0.’ instead of just ‘.’, and should not end with a trailing ‘0’.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"number-literal-format": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-key-quotes/index.html b/docs/_site/rules/object-literal-key-quotes/index.html new file mode 100644 index 00000000000..114438125a4 --- /dev/null +++ b/docs/_site/rules/object-literal-key-quotes/index.html @@ -0,0 +1,189 @@ + + + + + + + + + Rule: object-literal-key-quotes + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-key-quotes

+

+
+ + +

Enforces consistent object literal property quote style.

+ + + +

Object literal property names can be defined in two ways: using literals or using strings. +For example, these two objects are equivalent:

+ +

var object1 = { + property: true +};

+ +

var object2 = { + “property”: true +};

+ +

In many cases, it doesn’t matter if you choose to use an identifier instead of a string +or vice-versa. Even so, you might decide to enforce a consistent style in your code.

+ +

This rules lets you enforce consistent quoting of property names. Either they should always +be quoted (default behavior) or quoted only as needed (“as-needed”).

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Possible settings are:

+ +
    +
  • "always": Property names should always be quoted. (This is the default.)
  • +
  • "as-needed": Only property names which require quotes may be quoted (e.g. those with spaces in them).
  • +
  • "consistent": Property names should either all be quoted or unquoted.
  • +
  • "consistent-as-needed": If any property name requires quotes, then all properties must be quoted. Otherwise, no +property names may be quoted.
  • +
+ +

For ES6, computed property names ({[name]: value}) and methods ({foo() {}}) never need +to be quoted.

+ + +
Config examples
+ +
+"object-literal-key-quotes": [true, "as-needed"]
+
+ +
+"object-literal-key-quotes": [true, "always"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always",
+    "as-needed",
+    "consistent",
+    "consistent-as-needed"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-shorthand/index.html b/docs/_site/rules/object-literal-shorthand/index.html new file mode 100644 index 00000000000..ba176698197 --- /dev/null +++ b/docs/_site/rules/object-literal-shorthand/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: object-literal-shorthand + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-shorthand

+

+
+ + +

Enforces/disallows use of ES6 object literal shorthand.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If the ‘never’ option is provided, any shorthand object literal syntax will cause a failure.

+ + +
Config examples
+ +
+"object-literal-shorthand": true
+
+ +
+"object-literal-shorthand": [true, "never"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "never"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-sort-keys/index.html b/docs/_site/rules/object-literal-sort-keys/index.html new file mode 100644 index 00000000000..dffa767b71e --- /dev/null +++ b/docs/_site/rules/object-literal-sort-keys/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: object-literal-sort-keys + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-sort-keys

+

+
+ + + +

Checks ordering of keys in object literals.

+ +

When using the default alphabetical ordering, additional blank lines may be used to group +object properties together while keeping the elements within each group in alphabetical order.

+ + + + + +
Rationale
+

Useful in preventing merge conflicts

+ + + + + +

Config

+ +

By default, this rule checks that keys are in alphabetical order. +The following may optionally be passed:

+ +
    +
  • “ignore-case” will to compare keys in a case insensitive way.
  • +
  • +

    “match-declaration-order” will prefer to use the key ordering of the contextual type of the object literal, as in:

    + +

    interface I { foo: number; bar: number; } + const obj: I = { foo: 1, bar: 2 };

    +
  • +
+ +

If a contextual type is not found, alphabetical ordering will be used instead.

+ + +
Config examples
+ +
+"object-literal-sort-keys": true
+
+ +
+"object-literal-sort-keys": [true, "ignore-case", "match-declaration-order"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ignore-case",
+    "match-declaration-order"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/one-line/index.html b/docs/_site/rules/one-line/index.html new file mode 100644 index 00000000000..24ef7fb4108 --- /dev/null +++ b/docs/_site/rules/one-line/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: one-line + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: one-line

+

+
+ + +

Requires the specified tokens to be on the same line as the expression preceding them.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • +
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • +
  • "check-else" checks that else is on the same line as the closing brace for if.
  • +
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • +
  • "check-whitespace" checks preceding whitespace for the specified tokens.
  • +
+ + +
Config examples
+ +
+"one-line": [true, "check-catch", "check-finally", "check-else"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-catch",
+      "check-finally",
+      "check-else",
+      "check-open-brace",
+      "check-whitespace"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/one-variable-per-declaration/index.html b/docs/_site/rules/one-variable-per-declaration/index.html new file mode 100644 index 00000000000..244bc7da596 --- /dev/null +++ b/docs/_site/rules/one-variable-per-declaration/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: one-variable-per-declaration + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: one-variable-per-declaration

+

+
+ + +

Disallows multiple variable definitions in the same declaration statement.

+ + + + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • ignore-for-loop allows multiple variable definitions in a for loop declaration.
  • +
+ + +
Config examples
+ +
+"one-variable-per-declaration": true
+
+ +
+"one-variable-per-declaration": [true, "ignore-for-loop"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-for-loop"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/only-arrow-functions/index.html b/docs/_site/rules/only-arrow-functions/index.html new file mode 100644 index 00000000000..34f30022312 --- /dev/null +++ b/docs/_site/rules/only-arrow-functions/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: only-arrow-functions + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: only-arrow-functions

+

+
+ + +

Disallows traditional (non-arrow) function expressions.

+ + + + +
Rationale
+

Traditional functions don’t bind lexical scope, which can lead to unexpected behavior when accessing ‘this’.

+ + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • "allow-declarations" allows standalone function declarations.
  • +
  • "allow-named-functions" allows the expression function foo() {} but not function() {}.
  • +
+ + + +
Config examples
+ +
+"only-arrow-functions": true
+
+ +
+"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-declarations",
+      "allow-named-functions"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ordered-imports/index.html b/docs/_site/rules/ordered-imports/index.html new file mode 100644 index 00000000000..2b0af21cb5e --- /dev/null +++ b/docs/_site/rules/ordered-imports/index.html @@ -0,0 +1,251 @@ + + + + + + + + + Rule: ordered-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ordered-imports

+

+
+ + +

Requires that import statements be alphabetized and grouped.

+ + + +

Enforce a consistent ordering for ES6 imports:

+
    +
  • Named imports must be alphabetized (i.e. “import {A, B, C} from “foo”;”) +
      +
    • The exact ordering can be controlled by the named-imports-order option.
    • +
    • “longName as name” imports are ordered by “longName”.
    • +
    +
  • +
  • Import sources must be alphabetized within groups, i.e.: + import * as foo from “a”; + import * as bar from “b”;
  • +
  • Groups of imports are delineated by blank lines. You can use these to group imports + however you like, e.g. by first- vs. third-party or thematically or can you can + enforce a grouping of third-party, parent directories and the current directory.
  • +
+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

You may set the "import-sources-order" option to control the ordering of source +imports (the "foo" in import {A, B, C} from "foo").

+ +

Possible values for "import-sources-order" are:

+ +
    +
  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • +
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • +
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • +
  • "any": Allow any order.
  • +
+ +

You may set the "grouped-imports" option to control the grouping of source +imports (the "foo" in import {A, B, C} from "foo").

+ +

Possible values for "grouped-imports" are:

+ +
    +
  • false: Do not enforce grouping. (This is the default.)
  • +
  • true: Group source imports by "bar", "../baz", "./foo".
  • +
+ +

You may set the "named-imports-order" option to control the ordering of named +imports (the {A, B, C} in import {A, B, C} from "foo").

+ +

Possible values for "named-imports-order" are:

+ +
    +
  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • +
  • "lowercase-first": Correct order is {b, A, C}.
  • +
  • "lowercase-last": Correct order is {A, C, b}.
  • +
  • "any": Allow any order.
  • +
+ +

You may set the "module-source-path" option to control the ordering of imports based full path +or just the module name

+ +

Possible values for "module-source-path" are:

+ +
    +
  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • +
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
  • +
+ + + +
Config examples
+ +
+"ordered-imports": true
+
+ +
+"ordered-imports": [
+  true,
+  {
+    "import-sources-order": "lowercase-last",
+    "named-imports-order": "lowercase-first"
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "grouped-imports": {
+      "type": "boolean"
+    },
+    "import-sources-order": {
+      "type": "string",
+      "enum": [
+        "case-insensitive",
+        "lowercase-first",
+        "lowercase-last",
+        "any"
+      ]
+    },
+    "named-imports-order": {
+      "type": "string",
+      "enum": [
+        "case-insensitive",
+        "lowercase-first",
+        "lowercase-last",
+        "any"
+      ]
+    },
+    "module-source-path": {
+      "type": "string",
+      "enum": [
+        "full",
+        "basename"
+      ]
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-conditional-expression/index.html b/docs/_site/rules/prefer-conditional-expression/index.html new file mode 100644 index 00000000000..0ceb1ab03d3 --- /dev/null +++ b/docs/_site/rules/prefer-conditional-expression/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: prefer-conditional-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-conditional-expression

+

+
+ + + +

Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

+ + + + +
Rationale
+ +

This reduces duplication and can eliminate an unnecessary variable declaration.

+ + + + + +

Config

+

If check-else-if is specified, the rule also checks nested if-else-if statements.

+ + +
Config examples
+ +
+"prefer-conditional-expression": true
+
+ +
+"prefer-conditional-expression": [true, "check-else-if"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "check-else-if"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-const/index.html b/docs/_site/rules/prefer-const/index.html new file mode 100644 index 00000000000..a8bd2397065 --- /dev/null +++ b/docs/_site/rules/prefer-const/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: prefer-const + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-const

+

+
+ + +

Requires that variable declarations use const instead of let and var if possible.

+ + + +

If a variable is only assigned to once when it is declared, it should be declared using ‘const’

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

An optional object containing the property “destructuring” with two possible values:

+ +
    +
  • “any” (default) - If any variable in destructuring can be const, this rule warns for those variables.
  • +
  • “all” - Only warns if all variables in destructuring can be const.
  • +
+ + +
Config examples
+ +
+"prefer-const": true
+
+ +
+"prefer-const": [true, {"destructuring": "all"}]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "destructuring": {
+      "type": "string",
+      "enum": [
+        "all",
+        "any"
+      ]
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-for-of/index.html b/docs/_site/rules/prefer-for-of/index.html new file mode 100644 index 00000000000..50b0ab9dcad --- /dev/null +++ b/docs/_site/rules/prefer-for-of/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: prefer-for-of + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-for-of

+

+
+ + +

Recommends a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated.

+ + + + +
Rationale
+

A for(… of …) loop is easier to implement and read when the index is not needed.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-for-of": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-function-over-method/index.html b/docs/_site/rules/prefer-function-over-method/index.html new file mode 100644 index 00000000000..5a7f2260e15 --- /dev/null +++ b/docs/_site/rules/prefer-function-over-method/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: prefer-function-over-method + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-function-over-method

+

+
+ + +

Warns for class methods that do not use ‘this’.

+ + + + + + + +

Config

+ +

“allow-public” excludes checking of public methods. +“allow-protected” excludes checking of protected methods.

+ + +
Config examples
+ +
+"prefer-function-over-method": true
+
+ +
+"prefer-function-over-method": [true, "allow-public", "allow-protected"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-public",
+    "allow-protected"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-method-signature/index.html b/docs/_site/rules/prefer-method-signature/index.html new file mode 100644 index 00000000000..5e19bbedb0c --- /dev/null +++ b/docs/_site/rules/prefer-method-signature/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: prefer-method-signature + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-method-signature

+

+
+ + +

Prefer foo(): void over foo: () => void in interfaces and types.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-method-signature": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-object-spread/index.html b/docs/_site/rules/prefer-object-spread/index.html new file mode 100644 index 00000000000..508b297c200 --- /dev/null +++ b/docs/_site/rules/prefer-object-spread/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: prefer-object-spread + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-object-spread

+

+
+ + +

Enforces the use of the ES2015 object spread operator over Object.assign() where appropriate.

+ + + + +
Rationale
+

Object spread allows for better type checking and inference.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-object-spread": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-readonly/index.html b/docs/_site/rules/prefer-readonly/index.html new file mode 100644 index 00000000000..b457aa3e537 --- /dev/null +++ b/docs/_site/rules/prefer-readonly/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: prefer-readonly + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-readonly

+

+
+ + +

Requires that private variables are marked as readonly if they’re never modified outside of the constructor.

+ + + +

If a private variable is only assigned to in the constructor, it should be declared as readonly.

+ + + + + +
Rationale
+ +

Marking never-modified variables as readonly helps enforce the code’s intent of keeping them as never-modified. +It can also help prevent accidental changes of members not meant to be changed.

+ + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

If only-inline-lambdas is specified, only immediately-declared arrow functions are checked.

+ + +
Config examples
+ +
+"prefer-readonly": true
+
+ +
+"prefer-readonly": [true, "only-inline-lambdas"]
+
+ + +
Schema
+
+{
+  "enum": [
+    "only-inline-lambdas"
+  ],
+  "type": "string"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-switch/index.html b/docs/_site/rules/prefer-switch/index.html new file mode 100644 index 00000000000..01260987a4b --- /dev/null +++ b/docs/_site/rules/prefer-switch/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: prefer-switch + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-switch

+

+
+ + +

Prefer a switch statement to an if statement with simple === comparisons.

+ + + + + + + +

Config

+ +

An optional object with the property ‘min-cases’. +This is the number cases needed before a switch statement is recommended. +Defaults to 3.

+ + +
Config examples
+ +
+"prefer-switch": true
+
+ +
+"prefer-switch": [true, {"min-cases": 2}]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "min-cases": {
+      "type": "number"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-template/index.html b/docs/_site/rules/prefer-template/index.html new file mode 100644 index 00000000000..0b217edf748 --- /dev/null +++ b/docs/_site/rules/prefer-template/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: prefer-template + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-template

+

+
+ + +

Prefer a template expression over string literal concatenation.

+ + + + + + + +

Config

+ +

If allow-single-concat is specified, then a single concatenation (x + y) is allowed, but not more (x + y + z).

+ + +
Config examples
+ +
+"prefer-template": true
+
+ +
+"prefer-template": [true, "allow-single-concat"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-single-concat"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/promise-function-async/index.html b/docs/_site/rules/promise-function-async/index.html new file mode 100644 index 00000000000..17910e28437 --- /dev/null +++ b/docs/_site/rules/promise-function-async/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: promise-function-async + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: promise-function-async

+

+
+ + +

Requires any function or method that returns a promise to be marked async.

+ + + + +
Rationale
+ +

Ensures that each function is only capable of 1) returning a rejected promise, or 2) +throwing an Error object. In contrast, non-async Promise-returning functions +are technically capable of either. This practice removes a requirement for consuming +code to handle both cases.

+ + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"promise-function-async": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/quotemark/index.html b/docs/_site/rules/quotemark/index.html new file mode 100644 index 00000000000..9eecc3cb306 --- /dev/null +++ b/docs/_site/rules/quotemark/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: quotemark + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: quotemark

+

+
+ + +

Requires single or double quotes for string literals.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "single" enforces single quotes.
  • +
  • "double" enforces double quotes.
  • +
  • "jsx-single" enforces single quotes for JSX attributes.
  • +
  • "jsx-double" enforces double quotes for JSX attributes.
  • +
  • "avoid-template" forbids single-line untagged template strings that do not contain string interpolations.
  • +
  • "avoid-escape" allows you to use the “other” quotemark in cases where escaping would normally be required. +For example, [true, "double", "avoid-escape"] would not report a failure on the string literal +'Hello "World"'.
  • +
+ + +
Config examples
+ +
+"quotemark": [true, "single", "avoid-escape", "avoid-template"]
+
+ +
+"quotemark": [true, "single", "jsx-double"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "single",
+      "double",
+      "jsx-single",
+      "jsx-double",
+      "avoid-escape",
+      "avoid-template"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/radix/index.html b/docs/_site/rules/radix/index.html new file mode 100644 index 00000000000..9a8ceca4e16 --- /dev/null +++ b/docs/_site/rules/radix/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: radix + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: radix

+

+
+ + +

Requires the radix parameter to be specified when calling parseInt.

+ + + + +
Rationale
+ +

From MDN:

+
+

Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. +Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

+
+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"radix": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/restrict-plus-operands/index.html b/docs/_site/rules/restrict-plus-operands/index.html new file mode 100644 index 00000000000..1275aa0163f --- /dev/null +++ b/docs/_site/rules/restrict-plus-operands/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: restrict-plus-operands + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: restrict-plus-operands

+

+
+ + +

When adding two variables, operands must both be of type number or of type string.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"restrict-plus-operands": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/return-undefined/index.html b/docs/_site/rules/return-undefined/index.html new file mode 100644 index 00000000000..283dff0140b --- /dev/null +++ b/docs/_site/rules/return-undefined/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: return-undefined + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: return-undefined

+

+
+ + +

Prefer return; in void functions and return undefined; in value-returning functions.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"return-undefined": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/semicolon/index.html b/docs/_site/rules/semicolon/index.html new file mode 100644 index 00000000000..5ee5bc6c5ce --- /dev/null +++ b/docs/_site/rules/semicolon/index.html @@ -0,0 +1,192 @@ + + + + + + + + + Rule: semicolon + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: semicolon

+

+
+ + +

Enforces consistent semicolon usage at the end of every statement.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • "always" enforces semicolons at the end of every statement.
  • +
  • "never" disallows semicolons at the end of every statement except for when they are necessary.
  • +
+ +

The following arguments may be optionally provided:

+ +
    +
  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • +
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • +
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any +other assignment. This option overrides "ignore-bound-class-methods".
  • +
+ + + +
Config examples
+ +
+"semicolon": [true, "always"]
+
+ +
+"semicolon": [true, "never"]
+
+ +
+"semicolon": [true, "always", "ignore-interfaces"]
+
+ +
+"semicolon": [true, "always", "ignore-bound-class-methods"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string",
+      "enum": [
+        "always",
+        "never"
+      ]
+    },
+    {
+      "type": "string",
+      "enum": [
+        "ignore-interfaces"
+      ]
+    }
+  ],
+  "additionalItems": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/space-before-function-paren/index.html b/docs/_site/rules/space-before-function-paren/index.html new file mode 100644 index 00000000000..1b86f637dd2 --- /dev/null +++ b/docs/_site/rules/space-before-function-paren/index.html @@ -0,0 +1,208 @@ + + + + + + + + + Rule: space-before-function-paren + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: space-before-function-paren

+

+
+ + +

Require or disallow a space before function parenthesis

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One argument which is an object which may contain the keys anonymous, named, and asyncArrow +These should be set to either "always" or "never".

+ +
    +
  • "anonymous" checks before the opening paren in anonymous functions
  • +
  • "named" checks before the opening paren in named functions
  • +
  • "asyncArrow" checks before the opening paren in async arrow functions
  • +
  • "method" checks before the opening paren in class methods
  • +
  • "constructor" checks before the opening paren in class constructors
  • +
+ + + +
Config examples
+ +
+"space-before-function-paren": true
+
+ +
+"space-before-function-paren": [true, "always"]
+
+ +
+"space-before-function-paren": [true, "never"]
+
+ +
+"space-before-function-paren": [true, {"anonymous": "always", "named": "never", "asyncArrow": "always"}]
+
+ + +
Schema
+
+{
+  "properties": {
+    "anonymous": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "asyncArrow": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "constructor": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "method": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "named": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    }
+  },
+  "type": "object"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/space-within-parens/index.html b/docs/_site/rules/space-within-parens/index.html new file mode 100644 index 00000000000..164b8dd93b5 --- /dev/null +++ b/docs/_site/rules/space-within-parens/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: space-within-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: space-within-parens

+

+
+ + +

Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

You may enforce the amount of whitespace within parentheses.

+ + + +
Config examples
+ + +
Schema
+
+{
+  "type": "number",
+  "min": 0
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/strict-boolean-expressions/index.html b/docs/_site/rules/strict-boolean-expressions/index.html new file mode 100644 index 00000000000..b17f9c49c8e --- /dev/null +++ b/docs/_site/rules/strict-boolean-expressions/index.html @@ -0,0 +1,227 @@ + + + + + + + + + Rule: strict-boolean-expressions + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: strict-boolean-expressions

+

+
+ + + +

Restricts the types allowed in boolean expressions. By default only booleans are allowed.

+ +

The following nodes are checked:

+ +
    +
  • Arguments to the !, &&, and || operators
  • +
  • The condition in a conditional expression (cond ? x : y)
  • +
  • Conditions for if, for, while, and do-while statements.
  • +
+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

These options may be provided:

+ +
    +
  • allow-null-union allows union types containing null. +
      +
    • It does not allow null itself.
    • +
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • +
    +
  • +
  • allow-undefined-union allows union types containing undefined. +
      +
    • It does not allow undefined itself.
    • +
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • +
    +
  • +
  • allow-string allows strings. +
      +
    • It does not allow unions containing string.
    • +
    • It does not allow string literal types.
    • +
    +
  • +
  • allow-number allows numbers. +
      +
    • It does not allow unions containing number.
    • +
    • It does not allow enums or number literal types.
    • +
    +
  • +
  • allow-mix allows multiple of the above to appear together. +
      +
    • For example, string | number or RegExp | null | undefined would normally not be allowed.
    • +
    • A type like "foo" | "bar" | undefined is always allowed, because it has only one way to be false.
    • +
    +
  • +
  • allow-boolean-or-undefined allows boolean | undefined. +
      +
    • Also allows true | false | undefined.
    • +
    • Does not allow false | undefined.
    • +
    • This option is a subset of allow-undefined-union, so you don’t need to enable both options at the same time.
    • +
    +
  • +
+ + + +
Config examples
+ +
+"strict-boolean-expressions": true
+
+ +
+"strict-boolean-expressions": [
+  true,
+  "allow-null-union",
+  "allow-undefined-union",
+  "allow-string",
+  "allow-number"
+]
+
+ +
+"strict-boolean-expressions": [true, "allow-boolean-or-undefined"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-null-union",
+      "allow-undefined-union",
+      "allow-string",
+      "allow-number",
+      "allow-boolean-or-undefined"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/strict-type-predicates/index.html b/docs/_site/rules/strict-type-predicates/index.html new file mode 100644 index 00000000000..90551c4f0ac --- /dev/null +++ b/docs/_site/rules/strict-type-predicates/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: strict-type-predicates + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: strict-type-predicates

+

+
+ + + +

Warns for type predicates that are always true or always false. +Works for ‘typeof’ comparisons to constants (e.g. ‘typeof foo === “string”’), and equality comparison to ‘null’/’undefined’. +(TypeScript won’t let you compare ‘1 === 2’, but it has an exception for ‘1 === undefined’.) +Does not yet work for ‘instanceof’. +Does not warn for ‘if (x.y)’ where ‘x.y’ is always truthy. For that, see strict-boolean-expressions.

+ +

This rule requires strictNullChecks to work properly.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"strict-type-predicates": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/switch-default/index.html b/docs/_site/rules/switch-default/index.html new file mode 100644 index 00000000000..9a259fcd44a --- /dev/null +++ b/docs/_site/rules/switch-default/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: switch-default + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: switch-default

+

+
+ + +

Require a default case in all switch statements.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"switch-default": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/switch-final-break/index.html b/docs/_site/rules/switch-final-break/index.html new file mode 100644 index 00000000000..a3c7ec04bea --- /dev/null +++ b/docs/_site/rules/switch-final-break/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: switch-final-break + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: switch-final-break

+

+
+ + +

Checks whether the final clause of a switch statement ends in break;.

+ + + + + + + +

Config

+ +

If no options are passed, a final ‘break;’ is forbidden. +If the “always” option is passed this will require a ‘break;’ to always be present +unless control flow is escaped in some other way.

+ + +
Config examples
+ +
+"switch-final-break": true
+
+ +
+"switch-final-break": [true, "always"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/trailing-comma/index.html b/docs/_site/rules/trailing-comma/index.html new file mode 100644 index 00000000000..91ca73fee0e --- /dev/null +++ b/docs/_site/rules/trailing-comma/index.html @@ -0,0 +1,320 @@ + + + + + + + + + Rule: trailing-comma + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: trailing-comma

+

+
+ + + +

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, +named imports and exports and function parameters.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One argument which is an object with the keys multiline and singleline. +Both can be set to a string ("always" or "never") or an object.

+ +

The object can contain any of the following keys: "arrays", "objects", "functions", +"imports", "exports", and "typeLiterals"; each key can have one of the following +values: "always", "never", and "ignore". Any missing keys will default to "ignore".

+ +
    +
  • "multiline" checks multi-line object literals.
  • +
  • "singleline" checks single-line object literals.
  • +
+ +

An array is considered “multiline” if its closing bracket is on a line +after the last array element. The same general logic is followed for +object literals, function typings, named import statements +and function parameters.

+ +

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, +there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on +object and array rest and rest parameters.

+ + + +
Config examples
+ +
+"trailing-comma": [true, {"multiline": "always", "singleline": "never"}]
+
+ +
+"trailing-comma": [
+  true,
+  {
+    "multiline": {
+      "objects": "always",
+      "arrays": "always",
+      "functions": "never",
+      "typeLiterals": "ignore"
+    },
+    "esSpecCompliant": true
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "multiline": {
+      "anyOf": [
+        {
+          "type": "string",
+          "enum": [
+            "always",
+            "never"
+          ]
+        },
+        {
+          "type": "object",
+          "properties": {
+            "arrays": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "exports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "functions": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "imports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "objects": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "typeLiterals": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            }
+          }
+        }
+      ]
+    },
+    "singleline": {
+      "anyOf": [
+        {
+          "type": "string",
+          "enum": [
+            "always",
+            "never"
+          ]
+        },
+        {
+          "type": "object",
+          "properties": {
+            "arrays": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "exports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "functions": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "imports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "objects": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "typeLiterals": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            }
+          }
+        }
+      ]
+    },
+    "esSpecCompliant": {
+      "type": "boolean"
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/triple-equals/index.html b/docs/_site/rules/triple-equals/index.html new file mode 100644 index 00000000000..e1a52692712 --- /dev/null +++ b/docs/_site/rules/triple-equals/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: triple-equals + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: triple-equals

+

+
+ + +

Requires === and !== in place of == and !=.

+ + + + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • "allow-null-check" allows == and != when comparing to null.
  • +
  • "allow-undefined-check" allows == and != when comparing to undefined.
  • +
+ + +
Config examples
+ +
+"triple-equals": true
+
+ +
+"triple-equals": [true, "allow-null-check"]
+
+ +
+"triple-equals": [true, "allow-undefined-check"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-null-check",
+      "allow-undefined-check"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/type-literal-delimiter/index.html b/docs/_site/rules/type-literal-delimiter/index.html new file mode 100644 index 00000000000..cc11e78c589 --- /dev/null +++ b/docs/_site/rules/type-literal-delimiter/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: type-literal-delimiter + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: type-literal-delimiter

+

+
+ + + +

Checks that type literal members are separated by semicolons. +Enforces a trailing semicolon for multiline type literals.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"type-literal-delimiter": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typedef-whitespace/index.html b/docs/_site/rules/typedef-whitespace/index.html new file mode 100644 index 00000000000..9577ca446ee --- /dev/null +++ b/docs/_site/rules/typedef-whitespace/index.html @@ -0,0 +1,277 @@ + + + + + + + + + Rule: typedef-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typedef-whitespace

+

+
+ + +

Requires or disallows whitespace for type definitions.

+ + +

Determines if a space is required or not before the colon in a type specifier.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

Two arguments which are both objects. +The first argument specifies how much space should be to the left of a typedef colon. +The second argument specifies how much space should be to the right of a typedef colon. +Each key should have a value of "onespace", "space" or "nospace". +Possible keys are:

+ +
    +
  • "call-signature" checks return type of functions.
  • +
  • "index-signature" checks index type specifier of indexers.
  • +
  • "parameter" checks function parameters.
  • +
  • "property-declaration" checks object property declarations.
  • +
  • "variable-declaration" checks variable declaration.
  • +
+ + +
Config examples
+ +
+"typedef-whitespace": [
+  true,
+  {
+    "call-signature": "nospace",
+    "index-signature": "nospace",
+    "parameter": "nospace",
+    "property-declaration": "nospace",
+    "variable-declaration": "nospace"
+  },
+  {
+    "call-signature": "onespace",
+    "index-signature": "onespace",
+    "parameter": "onespace",
+    "property-declaration": "onespace",
+    "variable-declaration": "onespace"
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "object",
+      "properties": {
+        "call-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "index-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "parameter": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "property-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "variable-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        }
+      },
+      "additionalProperties": false
+    },
+    {
+      "type": "object",
+      "properties": {
+        "call-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "index-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "parameter": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "property-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "variable-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        }
+      },
+      "additionalProperties": false
+    }
+  ],
+  "additionalItems": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typedef/index.html b/docs/_site/rules/typedef/index.html new file mode 100644 index 00000000000..db818114025 --- /dev/null +++ b/docs/_site/rules/typedef/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: typedef + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typedef

+

+
+ + +

Requires type definitions to exist.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

Several arguments may be optionally provided:

+ +
    +
  • "call-signature" checks return type of functions.
  • +
  • "arrow-call-signature" checks return type of arrow functions.
  • +
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • +
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • +
  • "property-declaration" checks return types of interface properties.
  • +
  • "variable-declaration" checks non-binding variable declarations.
  • +
  • "member-variable-declaration" checks member variable declarations.
  • +
  • "object-destructuring" checks object destructuring declarations.
  • +
  • "array-destructuring" checks array destructuring declarations.
  • +
+ + +
Config examples
+ +
+"typedef": [true, "call-signature", "parameter", "member-variable-declaration"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "call-signature",
+      "arrow-call-signature",
+      "parameter",
+      "arrow-parameter",
+      "property-declaration",
+      "variable-declaration",
+      "member-variable-declaration",
+      "object-destructuring",
+      "array-destructuring"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 7
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typeof-compare/index.html b/docs/_site/rules/typeof-compare/index.html new file mode 100644 index 00000000000..8bf29aeea38 --- /dev/null +++ b/docs/_site/rules/typeof-compare/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: typeof-compare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typeof-compare

+

+
+ + +

Makes sure result of typeof is compared to correct string values

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"typeof-compare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/unified-signatures/index.html b/docs/_site/rules/unified-signatures/index.html new file mode 100644 index 00000000000..35d5c431165 --- /dev/null +++ b/docs/_site/rules/unified-signatures/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: unified-signatures + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: unified-signatures

+

+
+ + +

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"unified-signatures": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/use-default-type-parameter/index.html b/docs/_site/rules/use-default-type-parameter/index.html new file mode 100644 index 00000000000..00af31cac99 --- /dev/null +++ b/docs/_site/rules/use-default-type-parameter/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: use-default-type-parameter + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: use-default-type-parameter

+

+
+ + +

Warns if an explicitly specified type argument is the default for that type parameter.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"use-default-type-parameter": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/use-isnan/index.html b/docs/_site/rules/use-isnan/index.html new file mode 100644 index 00000000000..a857b2254da --- /dev/null +++ b/docs/_site/rules/use-isnan/index.html @@ -0,0 +1,143 @@ + + + + + + + + + Rule: use-isnan + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: use-isnan

+

+
+ + +

Enforces use of the isNaN() function to check for NaN references instead of a comparison to the NaN constant.

+ + + + +
Rationale
+ +

Since NaN !== NaN, comparisons with regular operators will produce unexpected results. +So, instead of if (myVar === NaN), do if (isNaN(myVar)).

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"use-isnan": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/variable-name/index.html b/docs/_site/rules/variable-name/index.html new file mode 100644 index 00000000000..591b3432fce --- /dev/null +++ b/docs/_site/rules/variable-name/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: variable-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: variable-name

+

+
+ + +

Checks variable names for various errors.

+ + + + + + + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "check-format": allows only lowerCamelCased or UPPER_CASED variable names +
      +
    • "allow-leading-underscore" allows underscores at the beginning (only has an effect if “check-format” specified)
    • +
    • "allow-trailing-underscore" allows underscores at the end. (only has an effect if “check-format” specified)
    • +
    • "allow-pascal-case" allows PascalCase in addition to lowerCamelCase.
    • +
    • "allow-snake-case" allows snake_case in addition to lowerCamelCase.
    • +
    +
  • +
  • "ban-keywords": disallows the use of certain TypeScript keywords as variable or parameter names. +
      +
    • These are: any, Number, number, String, string, Boolean, boolean, Undefined, undefined
    • +
    +
  • +
+ + +
Config examples
+ +
+"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-format",
+      "allow-leading-underscore",
+      "allow-trailing-underscore",
+      "allow-pascal-case",
+      "allow-snake-case",
+      "ban-keywords"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/whitespace/index.html b/docs/_site/rules/whitespace/index.html new file mode 100644 index 00000000000..39b41928e7e --- /dev/null +++ b/docs/_site/rules/whitespace/index.html @@ -0,0 +1,183 @@ + + + + + + + + + Rule: whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: whitespace

+

+
+ + +

Enforces whitespace style conventions.

+ + + + +
Rationale
+

Helps maintain a readable, consistent style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Ten arguments may be optionally provided:

+ +
    +
  • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
  • +
  • "check-decl"checks that variable declarations have whitespace around the equals token.
  • +
  • "check-operator" checks for whitespace around operator tokens.
  • +
  • "check-module" checks for whitespace in import & export statements.
  • +
  • "check-separator" checks for whitespace after separator tokens (,/;).
  • +
  • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
  • +
  • "check-type" checks for whitespace before a variable type specification.
  • +
  • "check-typecast" checks for whitespace between a typecast and its target.
  • +
  • "check-type-operator" checks for whitespace between type operators | and &.
  • +
  • "check-preblock" checks for whitespace before the opening brace of a block
  • +
+ + +
Config examples
+ +
+"whitespace": [true, "check-branch", "check-operator", "check-typecast"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-branch",
+      "check-decl",
+      "check-operator",
+      "check-module",
+      "check-separator",
+      "check-rest-spread",
+      "check-type",
+      "check-typecast",
+      "check-type-operator",
+      "check-preblock"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 10
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/cli/index.html b/docs/_site/usage/cli/index.html new file mode 100644 index 00000000000..770702a244e --- /dev/null +++ b/docs/_site/usage/cli/index.html @@ -0,0 +1,290 @@ + + + + + + + + + TSLint command-line interface + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint command-line interface

+

+
+ + +

Installation

+ +

Local (in your project’s working directory):

+ +
npm install tslint typescript --save-dev
+# or
+yarn add tslint typescript --dev
+
+ +

Global:

+ +
npm install tslint typescript -g
+# or
+yarn global add tslint typescript
+
+ +
Peer dependencies
+ +

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. +This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

+ +

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

+ +

CLI Usage

+ +

Please ensure that the TypeScript source files compile correctly before running the linter.

+ +

Usage: tslint [options] [file ...]

+ +

Options:

+ +
-v, --version                          output the version number
+-c, --config [config]                  configuration file
+-e, --exclude <exclude>                exclude globs from path expansion
+--fix                                  fixes linting errors for select rules (this may overwrite linted files)
+--force                                return status code 0 even if there are lint errors
+-i, --init                             generate a tslint.json config file in the current working directory
+-o, --out [out]                        output file
+--outputAbsolutePaths                  whether or not outputted file paths are absolute
+-r, --rules-dir [rules-dir]            rules directory
+-s, --formatters-dir [formatters-dir]  formatters directory
+-t, --format [format]                  output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)
+--test                                 test that tslint produces the correct output for the specified directory
+-p, --project [project]                tsconfig.json file
+--type-check                           (deprecated) check for type errors before linting the project
+-h, --help                             output usage information
+
+ +

By default, TSLint looks for a configuration file named tslint.json in the directory +of the file being linted and, if not found, searches ancestor directories. Check out the rules section for more details on what rules are available.

+ +

tslint accepts the following command-line options:

+ +
-c, --config:
+    The location of the configuration file that tslint will use to
+    determine which rules are activated and what options to provide
+    to the rules. If no option is specified, the config file named
+    tslint.json is used, so long as it exists in the path.
+    The format of the file is { rules: { /* rules list */ } },
+    where /* rules list */ is a key: value comma-separated list of
+    rulename: rule-options pairs. Rule-options can be either a
+    boolean true/false value denoting whether the rule is used or not,
+    or a list [boolean, ...] where the boolean provides the same role
+    as in the non-list case, and the rest of the list are options passed
+    to the rule that will determine what it checks for (such as number
+    of characters for the max-line-length rule, or what functions to ban
+    for the ban rule).
+
+-e, --exclude:
+    A filename or glob which indicates files to exclude from linting.
+    This option can be supplied multiple times if you need multiple
+    globs to indicate which files to exclude.
+
+--fix:
+    Fixes linting errors for select rules. This may overwrite linted files.
+
+--force:
+    Return status code 0 even if there are any lint errors.
+    Useful while running as npm script.
+
+-i, --init:
+    Generates a tslint.json config file in the current working directory.
+
+-o, --out:
+    A filename to output the results to. By default, tslint outputs to
+    stdout, which is usually the console where you're running it from.
+
+--outputAbsolutePaths:
+    If true, all paths in the output will be absolute.
+
+-r, --rules-dir:
+    An additional rules directory, for user-created rules.
+    tslint will always check its default rules directory, in
+    node_modules/tslint/lib/rules, before checking the user-provided
+    rules directory, so rules in the user-provided rules directory
+    with the same name as the base rules will not be loaded.
+
+-s, --formatters-dir:
+    An additional formatters directory, for user-created formatters.
+    Formatters are files that will format the tslint output, before
+    writing it to stdout or the file passed in --out. The default
+    directory, node_modules/tslint/build/formatters, will always be
+    checked first, so user-created formatters with the same names
+    as the base formatters will not be loaded.
+
+-t, --format:
+    The formatter to use to format the results of the linter before
+    outputting it to stdout or the file passed in --out. The core
+    formatters are prose (human readable), json (machine readable)
+    and verbose. prose is the default if this option is not used.
+    Other built-in options include pmd, msbuild, checkstyle, and vso.
+    Additional formatters can be added and used if the --formatters-dir
+    option is set.
+
+--test:
+    Runs tslint on matched directories and checks if tslint outputs
+    match the expected output in .lint files. Automatically loads the
+    tslint.json files in the directories as the configuration file for
+    the tests. See the full tslint documentation for more details on how
+    this can be used to test custom rules.
+
+-p, --project:
+    The path or directory containing a tsconfig.json file that will be
+    used to determine which files will be linted. This flag also enables
+    rules that require the type checker.
+
+--type-check:
+    (deprecated) Checks for type errors before linting a project.
+    --project must be specified in order to enable type checking.
+
+-v, --version:
+    The current version of tslint.
+
+-h, --help:
+    Prints this help message.
+
+ +

Exit Codes

+ +

The CLI process may exit with the following codes:

+ +
    +
  • 0: Linting succeeded without errors (warnings may have occurred)
  • +
  • 1: An invalid command line argument or combination thereof was used
  • +
  • 2: Linting failed with one or more rule violations with severity error
  • +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/configuration/index.html b/docs/_site/usage/configuration/index.html new file mode 100644 index 00000000000..8396f37921a --- /dev/null +++ b/docs/_site/usage/configuration/index.html @@ -0,0 +1,273 @@ + + + + + + + + + Configuring TSLint + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Configuring TSLint

+

+
+ + +

TSLint Configuration

+ +

When using the CLI or many third-party tools, a file named tslint.json or tslint.yaml is used to +configure which rules get run and each of their options.

+ +

tslint.json or tslint.yaml files can have the following fields specified:

+ +
    +
  • extends?: string | string[]: +The name of a built-in configuration preset (see built-in presets below), or a path or +array of paths to other configuration files which are extended by this configuration. +This value is handled using node module resolution semantics. +For example, a value of "tslint-config" would tell TSLint to try and load the main file of a module +named “tslint-config” as a configuration file. Specific files inside node modules can also be +specified, eg. "tslint-config/path/to/submodule". Relative paths to JSON files or JS modules +are also supported, e.g. "./tslint-config".
  • +
  • rulesDirectory?: string | string[]: +A path to a directory or an array of paths to directories of custom rules. These values are handled using node module resolution semantics, if an index.js is placed in your rules directory. We fallback to use relative or absolute paths, if the module can’t be resolved. If you want to avoid module resolution you can directly use a relative or absolute path (e.g. with ./).
  • +
  • rules?: { [name: string]: RuleSetting }: A map of rule names to their configuration settings. +
      +
    • These rules are applied to .ts and .tsx files.
    • +
    • Each rule is associated with an object containing: +
        +
      • options?: any: An array of values that are specific to a rule.
      • +
      • severity?: "default" | "error" | "warning" | "off": Severity level. Level “error” will cause exit code 2.
      • +
      +
    • +
    • A boolean value may be specified instead of the above object, and is equivalent to setting no options with default severity.
    • +
    • Any rules specified in this block will override those configured in any base configuration being extended.
    • +
    • Check out the full rules list here.
    • +
    +
  • +
  • jsRules?: any: Same format as rules. These rules are applied to .js and .jsx files.
  • +
  • defaultSeverity?: "error" | "warning" | "off": The severity level used when a rule specifies a default warning level. If undefined, “error” is used. This value is not inherited and is only applied to rules in this file.
  • +
  • linterOptions?: { exclude?: string[] }: +
      +
    • exclude: string[]: An array of globs. Any file matching these globs will not be linted. All exclude patterns are relative to the configuration file they were specified in.
    • +
    +
  • +
+ +

tslint.json configuration files may have JavaScript-style // single-line and /* multi-line */ comments in them (even though this is technically invalid JSON). If this confuses your syntax highlighter, you may want to switch it to JavaScript format.

+ +

An example tslint.json file might look like this:

+ +
{
+    "extends": "tslint:recommended",
+    "rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"],
+    "rules": {
+        "max-line-length": {
+            "options": [120]
+        },
+        "new-parens": true,
+        "no-arg": true,
+        "no-bitwise": true,
+        "no-conditional-assignment": true,
+        "no-consecutive-blank-lines": false,
+        "no-console": {
+            "severity": "warning",
+            "options": [
+                "debug",
+                "info",
+                "log",
+                "time",
+                "timeEnd",
+                "trace",
+            ]
+        }
+    },
+    "jsRules": {
+        "max-line-length": {
+            "options": [120]
+        }
+    }
+}
+
+ +

The corresponding YAML file looks like this:

+ +
---
+extends: "tslint:recommended"
+rulesDirectory:
+    - path/to/custom/rules/directory/
+    - another/path/
+rules:
+    max-line-length:
+        options: [120]
+    new-parens: true
+    no-arg: true
+    no-bitwise: true
+    no-conditional-assignment: true
+    no-consecutive-blank-lines: false
+    no-console:
+        severity: warning
+        options:
+            - debug
+            - info
+            - log
+            - time
+            - timeEnd
+            - trace
+jsRules:
+    max-line-length:
+        options: [120]
+...
+
+ +

Rule severity

+ +

The severity level of each rule can can be configured to default, error, warning/warn, or off/none. If no severity level is specified, default is used. The defaultSeverity top-level option replaces the severity level for each rule that uses severity level default in the current file. Valid values for defaultSeverity include error, warning/warn, and off/none.

+ +

Configuration presets

+ +

TSLint ships with a handful of built-in configurations presets. You may inspect their source here.

+ +

tslint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will not have breaking changes across minor or patch releases.

+ +

tslint:latest extends tslint:recommended and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, tslint:recommended will be updated to be identical to tslint:latest.

+ +

tslint:all turns on all rules to their strictest settings. This will use type checking, so it must be combined with the --project option. +(Exceptions include rules such as "ban", "import-blacklist", and "file-header", which have no sensible defaults, and deprecated rules.)

+ +

Custom rules

+ +

If TSLint’s core rules don’t have all the lint checks you’re looking for, +you may write your own custom rules or use custom rules that others have developed.

+ +

Some commonly used custom rule packages in the TSLint community are listed in the +README.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/library/index.html b/docs/_site/usage/library/index.html new file mode 100644 index 00000000000..b34cb6228f6 --- /dev/null +++ b/docs/_site/usage/library/index.html @@ -0,0 +1,205 @@ + + + + + + + + + Using TSLint as a Node.js library + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Using TSLint as a Node.js library

+

+
+ + +

Installation

+ +
npm install tslint typescript
+# or
+yarn add tslint typescript
+
+ +
Peer dependencies
+ +

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. +This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

+ +

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

+ +

Library usage

+ +

Please ensure that the TypeScript source files compile correctly before running the linter.

+ +

TypeScript

+ +

This code will need to be transpiled to JavaScript to run under Node.js.

+ +
import { Linter, Configuration } from "tslint";
+import * as fs from "fs";
+
+const fileName = "Specify input file name";
+const configurationFilename = "Specify configuration file name";
+const options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+
+const fileContents = fs.readFileSync(fileName, "utf8");
+const linter = new Linter(options);
+const configuration = Configuration.findConfiguration(configurationFilename, fileName).results;
+linter.lint(fileName, fileContents, configuration);
+const result = linter.getResult();
+
+ +

JavaScript (ES5)

+ +

This code will run directly under Node.js, including if it’s called from the command line.

+ +
"use strict";
+var tslint = require("tslint");
+var fs = require("fs");
+var fileName = "Specify input file name";
+var configurationFilename = "Specify configuration file name";
+var options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+var fileContents = fs.readFileSync(fileName, "utf8");
+var linter = new tslint.Linter(options);
+var configuration = tslint.Configuration.findConfiguration(configurationFilename, fileName).results;
+linter.lint(fileName, fileContents, configuration);
+var result = linter.getResult();
+
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/rule-flags/index.html b/docs/_site/usage/rule-flags/index.html new file mode 100644 index 00000000000..68c2da9dd46 --- /dev/null +++ b/docs/_site/usage/rule-flags/index.html @@ -0,0 +1,185 @@ + + + + + + + + + TSLint rule flags + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint rule flags

+

+
+ + +

Comment flags in source code

+ +

In addition to global configuration, you may also enable/disable linting or a subset of lint rules within a file with the following comment rule flags:

+ +
    +
  • /* tslint:disable */ - Disable all rules for the rest of the file
  • +
  • /* tslint:enable */ - Enable all rules for the rest of the file
  • +
  • /* tslint:disable:rule1 rule2 rule3... */ - Disable the listed rules for the rest of the file
  • +
  • /* tslint:enable:rule1 rule2 rule3... */ - Enable the listed rules for the rest of the file
  • +
  • // tslint:disable-next-line - Disables all rules for the following line
  • +
  • someCode(); // tslint:disable-line - Disables all rules for the current line
  • +
  • // tslint:disable-next-line:rule1 rule2 rule3... - Disables the listed rules for the next line
  • +
  • etc.
  • +
+ +

Rules flags enable or disable rules as they are parsed. Disabling an already disabled rule or enabling an already enabled rule has no effect. Enabling a rule that is not present or disabled in tslint.json has also no effect.

+ +

For example, imagine the directive /* tslint:disable */ on the first line of a file, /* tslint:enable:ban class-name */ on the 10th line and /* tslint:enable */ on the 20th. No rules will be checked between the 1st and 10th lines, only the ban and class-name rules will be checked between the 10th and 20th, and all rules will be checked for the remainder of the file.

+ +

Here’s an example:

+ +
function validRange (range: any) {
+   return range.min <= range.middle && range.middle <= range.max;
+}
+
+/* tslint:disable:object-literal-sort-keys */
+const range = {
+   min: 5,
+   middle: 10,    // TSLint will *not* warn about unsorted keys here
+   max: 20
+};
+/* tslint:enable:object-literal-sort-keys */
+
+const point = {
+   x: 3,
+   z: 5,          // TSLint will warn about unsorted keys here
+   y: 4,
+}
+
+console.log(validRange(range));
+
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/third-party-tools/index.html b/docs/_site/usage/third-party-tools/index.html new file mode 100644 index 00000000000..c34ca08b36b --- /dev/null +++ b/docs/_site/usage/third-party-tools/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Third-Party Tools + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Third-Party Tools

+

+
+ + +

A variety of tools and libraries are available to help you integrate TSLint automatically into your build process or IDE. Please see their respective sites for usage.

+ +

Note: Most of these tools are not maintained by TSLint.

+ + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/type-checking/index.html b/docs/_site/usage/type-checking/index.html new file mode 100644 index 00000000000..19fbe5be788 --- /dev/null +++ b/docs/_site/usage/type-checking/index.html @@ -0,0 +1,183 @@ + + + + + + + + + Type Checking + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Type Checking

+

+
+ + +

Semantic lint rules

+ +

Some TSLint rules go further than linting code syntax. Semantic rules use the compiler’s program APIs to inspect static types and validate code patterns.

+ +
CLI
+ +

When using the CLI, use the --project flag and specify your tsconfig.json to enable rules that work with the type checker. TSLint will lint all files included in your project as specified in tsconfig.json.

+ +
tslint --project tsconfig.json --config tslint.json # lints every file in your project
+tslint -p . -c tslint.json # shorthand of the command above
+tslint -p tsconfig.json --exclude '**/*.d.ts' # lint all files in the project excluding declaration files
+tslint -p tsconfig.json **/*.ts # ignores files in tsconfig.json and uses the provided glob instead
+
+ +
Library
+ +

To enable rules that work with the type checker, a TypeScript program object must be passed to the linter when using the programmatic API. Helper functions are provided to create a program from a tsconfig.json file. A project directory can be specified if project files do not lie in the same directory as the tsconfig.json file.

+ +
import { Linter, Configuration } from "tslint";
+
+const configurationFilename = "Specify configuration file name";
+const options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+
+const program = Linter.createProgram("tsconfig.json", "projectDir/");
+const linter = new Linter(options, program);
+
+const files = Linter.getFileNames(program);
+files.forEach(file => {
+    const fileContents = program.getSourceFile(file).getFullText();
+    const configuration = Configuration.findConfiguration(configurationFilename, file).results;
+    linter.lint(file, fileContents, configuration);
+});
+
+const results = linter.getResult();
+
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + From 67a0eb12b8fbcf8f2321e3d8c6a4b5f32036b04c Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Mon, 9 Apr 2018 09:07:36 -0400 Subject: [PATCH 10/12] removes site dist --- .../2015/12/10/a-new-tslint-website.html | 122 - .../03/31/sharable-configurations-rules.html | 203 -- docs/_site/2016/11/17/new-for-4.0.html | 163 -- docs/_site/Gemfile | 2 - docs/_site/Gemfile.lock | 238 -- docs/_site/circle.yml | 7 - docs/_site/css/main.css | 989 -------- docs/_site/develop/contributing/index.html | 178 -- .../develop/custom-formatters/index.html | 162 -- docs/_site/develop/custom-rules/index.html | 224 -- .../custom-rules/performance-tips.html | 295 --- .../develop/custom-rules/walker-design.html | 320 --- docs/_site/develop/docs/index.html | 163 -- docs/_site/develop/testing-rules/index.html | 322 --- docs/_site/feed.xml | 232 -- docs/_site/formatters/checkstyle/index.html | 130 - docs/_site/formatters/codeFrame/index.html | 134 -- docs/_site/formatters/filesList/index.html | 120 - docs/_site/formatters/index.html | 155 -- docs/_site/formatters/json/index.html | 142 -- docs/_site/formatters/junit/index.html | 132 - docs/_site/formatters/msbuild/index.html | 123 - docs/_site/formatters/pmd/index.html | 128 - docs/_site/formatters/prose/index.html | 120 - docs/_site/formatters/stylish/index.html | 127 - docs/_site/formatters/tap/index.html | 137 -- docs/_site/formatters/verbose/index.html | 123 - docs/_site/formatters/vso/index.html | 125 - docs/_site/index.html | 117 - docs/_site/news/index.html | 202 -- .../adjacent-overload-signatures/index.html | 150 -- docs/_site/rules/align/index.html | 174 -- docs/_site/rules/array-type/index.html | 170 -- docs/_site/rules/arrow-parens/index.html | 161 -- .../rules/arrow-return-shorthand/index.html | 156 -- docs/_site/rules/await-promise/index.html | 173 -- .../_site/rules/ban-comma-operator/index.html | 170 -- docs/_site/rules/ban-types/index.html | 160 -- docs/_site/rules/ban/index.html | 212 -- .../index.html | 139 -- docs/_site/rules/callable-types/index.html | 148 -- docs/_site/rules/class-name/index.html | 141 -- docs/_site/rules/comment-format/index.html | 201 -- docs/_site/rules/completed-docs/index.html | 553 ----- docs/_site/rules/curly/index.html | 263 -- .../rules/cyclomatic-complexity/index.html | 168 -- docs/_site/rules/deprecation/index.html | 151 -- docs/_site/rules/encoding/index.html | 137 -- docs/_site/rules/eofline/index.html | 153 -- docs/_site/rules/file-header/index.html | 162 -- docs/_site/rules/forin/index.html | 150 -- docs/_site/rules/import-blacklist/index.html | 155 -- docs/_site/rules/import-spacing/index.html | 137 -- docs/_site/rules/indent/index.html | 197 -- docs/_site/rules/index.html | 2129 ----------------- docs/_site/rules/interface-name/index.html | 166 -- .../interface-over-type-literal/index.html | 152 -- docs/_site/rules/jsdoc-format/index.html | 171 -- docs/_site/rules/label-position/index.html | 147 -- docs/_site/rules/linebreak-style/index.html | 162 -- .../match-default-export-name/index.html | 150 -- .../rules/max-classes-per-file/index.html | 167 -- .../rules/max-file-line-count/index.html | 146 -- docs/_site/rules/max-line-length/index.html | 191 -- docs/_site/rules/member-access/index.html | 181 -- docs/_site/rules/member-ordering/index.html | 266 -- docs/_site/rules/new-parens/index.html | 141 -- .../rules/newline-before-return/index.html | 141 -- .../rules/newline-per-chained-call/index.html | 139 -- .../index.html | 155 -- docs/_site/rules/no-any/index.html | 150 -- docs/_site/rules/no-arg/index.html | 144 -- docs/_site/rules/no-bitwise/index.html | 151 -- .../no-boolean-literal-compare/index.html | 150 -- .../no-conditional-assignment/index.html | 147 -- .../no-consecutive-blank-lines/index.html | 159 -- docs/_site/rules/no-console/index.html | 146 -- docs/_site/rules/no-construct/index.html | 147 -- docs/_site/rules/no-debugger/index.html | 141 -- docs/_site/rules/no-default-export/index.html | 147 -- .../rules/no-duplicate-imports/index.html | 144 -- .../_site/rules/no-duplicate-super/index.html | 141 -- .../rules/no-duplicate-switch-case/index.html | 137 -- .../rules/no-duplicate-variable/index.html | 157 -- docs/_site/rules/no-dynamic-delete/index.html | 148 -- .../_site/rules/no-empty-interface/index.html | 146 -- docs/_site/rules/no-empty/index.html | 154 -- docs/_site/rules/no-eval/index.html | 144 -- .../rules/no-floating-promises/index.html | 169 -- docs/_site/rules/no-for-in-array/index.html | 161 -- .../rules/no-implicit-dependencies/index.html | 165 -- .../rules/no-import-side-effect/index.html | 162 -- .../rules/no-inferrable-types/index.html | 178 -- .../no-inferred-empty-object-type/index.html | 148 -- .../_site/rules/no-internal-module/index.html | 152 -- .../no-invalid-template-strings/index.html | 137 -- docs/_site/rules/no-invalid-this/index.html | 160 -- .../rules/no-irregular-whitespace/index.html | 146 -- docs/_site/rules/no-magic-numbers/index.html | 155 -- .../rules/no-mergeable-namespace/index.html | 146 -- docs/_site/rules/no-misused-new/index.html | 146 -- docs/_site/rules/no-namespace/index.html | 174 -- .../rules/no-non-null-assertion/index.html | 150 -- docs/_site/rules/no-null-keyword/index.html | 152 -- .../index.html | 157 -- .../rules/no-parameter-properties/index.html | 152 -- .../no-parameter-reassignment/index.html | 137 -- .../_site/rules/no-redundant-jsdoc/index.html | 146 -- .../rules/no-reference-import/index.html | 142 -- docs/_site/rules/no-reference/index.html | 143 -- .../_site/rules/no-require-imports/index.html | 141 -- docs/_site/rules/no-return-await/index.html | 153 -- .../rules/no-shadowed-variable/index.html | 213 -- docs/_site/rules/no-sparse-arrays/index.html | 141 -- docs/_site/rules/no-string-literal/index.html | 155 -- docs/_site/rules/no-string-throw/index.html | 142 -- .../rules/no-submodule-imports/index.html | 154 -- .../no-switch-case-fall-through/index.html | 166 -- .../_site/rules/no-this-assignment/index.html | 163 -- .../rules/no-trailing-whitespace/index.html | 177 -- docs/_site/rules/no-unbound-method/index.html | 157 -- .../index.html | 139 -- .../rules/no-unnecessary-class/index.html | 163 -- .../no-unnecessary-initializer/index.html | 146 -- .../rules/no-unnecessary-qualifier/index.html | 150 -- .../no-unnecessary-type-assertion/index.html | 154 -- docs/_site/rules/no-unsafe-any/index.html | 152 -- docs/_site/rules/no-unsafe-finally/index.html | 150 -- .../rules/no-unused-expression/index.html | 171 -- .../_site/rules/no-unused-variable/index.html | 197 -- .../rules/no-use-before-declare/index.html | 156 -- docs/_site/rules/no-var-keyword/index.html | 149 -- docs/_site/rules/no-var-requires/index.html | 151 -- .../_site/rules/no-void-expression/index.html | 154 -- .../rules/number-literal-format/index.html | 137 -- .../object-literal-key-quotes/index.html | 189 -- .../rules/object-literal-shorthand/index.html | 156 -- .../rules/object-literal-sort-keys/index.html | 170 -- docs/_site/rules/one-line/index.html | 169 -- .../one-variable-per-declaration/index.html | 156 -- .../rules/only-arrow-functions/index.html | 163 -- docs/_site/rules/ordered-imports/index.html | 251 -- .../prefer-conditional-expression/index.html | 152 -- docs/_site/rules/prefer-const/index.html | 171 -- docs/_site/rules/prefer-for-of/index.html | 141 -- .../prefer-function-over-method/index.html | 149 -- .../rules/prefer-method-signature/index.html | 146 -- .../rules/prefer-object-spread/index.html | 150 -- docs/_site/rules/prefer-readonly/index.html | 169 -- docs/_site/rules/prefer-switch/index.html | 151 -- docs/_site/rules/prefer-template/index.html | 147 -- .../rules/promise-function-async/index.html | 155 -- docs/_site/rules/quotemark/index.html | 177 -- docs/_site/rules/radix/index.html | 146 -- .../rules/restrict-plus-operands/index.html | 146 -- docs/_site/rules/return-undefined/index.html | 146 -- docs/_site/rules/semicolon/index.html | 192 -- .../space-before-function-paren/index.html | 208 -- .../rules/space-within-parens/index.html | 147 -- .../strict-boolean-expressions/index.html | 227 -- .../rules/strict-type-predicates/index.html | 155 -- docs/_site/rules/switch-default/index.html | 137 -- .../_site/rules/switch-final-break/index.html | 149 -- docs/_site/rules/trailing-comma/index.html | 320 --- docs/_site/rules/triple-equals/index.html | 162 -- .../rules/type-literal-delimiter/index.html | 148 -- .../_site/rules/typedef-whitespace/index.html | 277 --- docs/_site/rules/typedef/index.html | 177 -- docs/_site/rules/typeof-compare/index.html | 137 -- .../_site/rules/unified-signatures/index.html | 146 -- .../use-default-type-parameter/index.html | 148 -- docs/_site/rules/use-isnan/index.html | 143 -- docs/_site/rules/variable-name/index.html | 169 -- docs/_site/rules/whitespace/index.html | 183 -- docs/_site/usage/cli/index.html | 290 --- docs/_site/usage/configuration/index.html | 273 --- docs/_site/usage/library/index.html | 205 -- docs/_site/usage/rule-flags/index.html | 185 -- docs/_site/usage/third-party-tools/index.html | 162 -- docs/_site/usage/type-checking/index.html | 183 -- 180 files changed, 32505 deletions(-) delete mode 100644 docs/_site/2015/12/10/a-new-tslint-website.html delete mode 100644 docs/_site/2016/03/31/sharable-configurations-rules.html delete mode 100644 docs/_site/2016/11/17/new-for-4.0.html delete mode 100644 docs/_site/Gemfile delete mode 100644 docs/_site/Gemfile.lock delete mode 100644 docs/_site/circle.yml delete mode 100644 docs/_site/css/main.css delete mode 100644 docs/_site/develop/contributing/index.html delete mode 100644 docs/_site/develop/custom-formatters/index.html delete mode 100644 docs/_site/develop/custom-rules/index.html delete mode 100644 docs/_site/develop/custom-rules/performance-tips.html delete mode 100644 docs/_site/develop/custom-rules/walker-design.html delete mode 100644 docs/_site/develop/docs/index.html delete mode 100644 docs/_site/develop/testing-rules/index.html delete mode 100644 docs/_site/feed.xml delete mode 100644 docs/_site/formatters/checkstyle/index.html delete mode 100644 docs/_site/formatters/codeFrame/index.html delete mode 100644 docs/_site/formatters/filesList/index.html delete mode 100644 docs/_site/formatters/index.html delete mode 100644 docs/_site/formatters/json/index.html delete mode 100644 docs/_site/formatters/junit/index.html delete mode 100644 docs/_site/formatters/msbuild/index.html delete mode 100644 docs/_site/formatters/pmd/index.html delete mode 100644 docs/_site/formatters/prose/index.html delete mode 100644 docs/_site/formatters/stylish/index.html delete mode 100644 docs/_site/formatters/tap/index.html delete mode 100644 docs/_site/formatters/verbose/index.html delete mode 100644 docs/_site/formatters/vso/index.html delete mode 100644 docs/_site/index.html delete mode 100644 docs/_site/news/index.html delete mode 100644 docs/_site/rules/adjacent-overload-signatures/index.html delete mode 100644 docs/_site/rules/align/index.html delete mode 100644 docs/_site/rules/array-type/index.html delete mode 100644 docs/_site/rules/arrow-parens/index.html delete mode 100644 docs/_site/rules/arrow-return-shorthand/index.html delete mode 100644 docs/_site/rules/await-promise/index.html delete mode 100644 docs/_site/rules/ban-comma-operator/index.html delete mode 100644 docs/_site/rules/ban-types/index.html delete mode 100644 docs/_site/rules/ban/index.html delete mode 100644 docs/_site/rules/binary-expression-operand-order/index.html delete mode 100644 docs/_site/rules/callable-types/index.html delete mode 100644 docs/_site/rules/class-name/index.html delete mode 100644 docs/_site/rules/comment-format/index.html delete mode 100644 docs/_site/rules/completed-docs/index.html delete mode 100644 docs/_site/rules/curly/index.html delete mode 100644 docs/_site/rules/cyclomatic-complexity/index.html delete mode 100644 docs/_site/rules/deprecation/index.html delete mode 100644 docs/_site/rules/encoding/index.html delete mode 100644 docs/_site/rules/eofline/index.html delete mode 100644 docs/_site/rules/file-header/index.html delete mode 100644 docs/_site/rules/forin/index.html delete mode 100644 docs/_site/rules/import-blacklist/index.html delete mode 100644 docs/_site/rules/import-spacing/index.html delete mode 100644 docs/_site/rules/indent/index.html delete mode 100644 docs/_site/rules/index.html delete mode 100644 docs/_site/rules/interface-name/index.html delete mode 100644 docs/_site/rules/interface-over-type-literal/index.html delete mode 100644 docs/_site/rules/jsdoc-format/index.html delete mode 100644 docs/_site/rules/label-position/index.html delete mode 100644 docs/_site/rules/linebreak-style/index.html delete mode 100644 docs/_site/rules/match-default-export-name/index.html delete mode 100644 docs/_site/rules/max-classes-per-file/index.html delete mode 100644 docs/_site/rules/max-file-line-count/index.html delete mode 100644 docs/_site/rules/max-line-length/index.html delete mode 100644 docs/_site/rules/member-access/index.html delete mode 100644 docs/_site/rules/member-ordering/index.html delete mode 100644 docs/_site/rules/new-parens/index.html delete mode 100644 docs/_site/rules/newline-before-return/index.html delete mode 100644 docs/_site/rules/newline-per-chained-call/index.html delete mode 100644 docs/_site/rules/no-angle-bracket-type-assertion/index.html delete mode 100644 docs/_site/rules/no-any/index.html delete mode 100644 docs/_site/rules/no-arg/index.html delete mode 100644 docs/_site/rules/no-bitwise/index.html delete mode 100644 docs/_site/rules/no-boolean-literal-compare/index.html delete mode 100644 docs/_site/rules/no-conditional-assignment/index.html delete mode 100644 docs/_site/rules/no-consecutive-blank-lines/index.html delete mode 100644 docs/_site/rules/no-console/index.html delete mode 100644 docs/_site/rules/no-construct/index.html delete mode 100644 docs/_site/rules/no-debugger/index.html delete mode 100644 docs/_site/rules/no-default-export/index.html delete mode 100644 docs/_site/rules/no-duplicate-imports/index.html delete mode 100644 docs/_site/rules/no-duplicate-super/index.html delete mode 100644 docs/_site/rules/no-duplicate-switch-case/index.html delete mode 100644 docs/_site/rules/no-duplicate-variable/index.html delete mode 100644 docs/_site/rules/no-dynamic-delete/index.html delete mode 100644 docs/_site/rules/no-empty-interface/index.html delete mode 100644 docs/_site/rules/no-empty/index.html delete mode 100644 docs/_site/rules/no-eval/index.html delete mode 100644 docs/_site/rules/no-floating-promises/index.html delete mode 100644 docs/_site/rules/no-for-in-array/index.html delete mode 100644 docs/_site/rules/no-implicit-dependencies/index.html delete mode 100644 docs/_site/rules/no-import-side-effect/index.html delete mode 100644 docs/_site/rules/no-inferrable-types/index.html delete mode 100644 docs/_site/rules/no-inferred-empty-object-type/index.html delete mode 100644 docs/_site/rules/no-internal-module/index.html delete mode 100644 docs/_site/rules/no-invalid-template-strings/index.html delete mode 100644 docs/_site/rules/no-invalid-this/index.html delete mode 100644 docs/_site/rules/no-irregular-whitespace/index.html delete mode 100644 docs/_site/rules/no-magic-numbers/index.html delete mode 100644 docs/_site/rules/no-mergeable-namespace/index.html delete mode 100644 docs/_site/rules/no-misused-new/index.html delete mode 100644 docs/_site/rules/no-namespace/index.html delete mode 100644 docs/_site/rules/no-non-null-assertion/index.html delete mode 100644 docs/_site/rules/no-null-keyword/index.html delete mode 100644 docs/_site/rules/no-object-literal-type-assertion/index.html delete mode 100644 docs/_site/rules/no-parameter-properties/index.html delete mode 100644 docs/_site/rules/no-parameter-reassignment/index.html delete mode 100644 docs/_site/rules/no-redundant-jsdoc/index.html delete mode 100644 docs/_site/rules/no-reference-import/index.html delete mode 100644 docs/_site/rules/no-reference/index.html delete mode 100644 docs/_site/rules/no-require-imports/index.html delete mode 100644 docs/_site/rules/no-return-await/index.html delete mode 100644 docs/_site/rules/no-shadowed-variable/index.html delete mode 100644 docs/_site/rules/no-sparse-arrays/index.html delete mode 100644 docs/_site/rules/no-string-literal/index.html delete mode 100644 docs/_site/rules/no-string-throw/index.html delete mode 100644 docs/_site/rules/no-submodule-imports/index.html delete mode 100644 docs/_site/rules/no-switch-case-fall-through/index.html delete mode 100644 docs/_site/rules/no-this-assignment/index.html delete mode 100644 docs/_site/rules/no-trailing-whitespace/index.html delete mode 100644 docs/_site/rules/no-unbound-method/index.html delete mode 100644 docs/_site/rules/no-unnecessary-callback-wrapper/index.html delete mode 100644 docs/_site/rules/no-unnecessary-class/index.html delete mode 100644 docs/_site/rules/no-unnecessary-initializer/index.html delete mode 100644 docs/_site/rules/no-unnecessary-qualifier/index.html delete mode 100644 docs/_site/rules/no-unnecessary-type-assertion/index.html delete mode 100644 docs/_site/rules/no-unsafe-any/index.html delete mode 100644 docs/_site/rules/no-unsafe-finally/index.html delete mode 100644 docs/_site/rules/no-unused-expression/index.html delete mode 100644 docs/_site/rules/no-unused-variable/index.html delete mode 100644 docs/_site/rules/no-use-before-declare/index.html delete mode 100644 docs/_site/rules/no-var-keyword/index.html delete mode 100644 docs/_site/rules/no-var-requires/index.html delete mode 100644 docs/_site/rules/no-void-expression/index.html delete mode 100644 docs/_site/rules/number-literal-format/index.html delete mode 100644 docs/_site/rules/object-literal-key-quotes/index.html delete mode 100644 docs/_site/rules/object-literal-shorthand/index.html delete mode 100644 docs/_site/rules/object-literal-sort-keys/index.html delete mode 100644 docs/_site/rules/one-line/index.html delete mode 100644 docs/_site/rules/one-variable-per-declaration/index.html delete mode 100644 docs/_site/rules/only-arrow-functions/index.html delete mode 100644 docs/_site/rules/ordered-imports/index.html delete mode 100644 docs/_site/rules/prefer-conditional-expression/index.html delete mode 100644 docs/_site/rules/prefer-const/index.html delete mode 100644 docs/_site/rules/prefer-for-of/index.html delete mode 100644 docs/_site/rules/prefer-function-over-method/index.html delete mode 100644 docs/_site/rules/prefer-method-signature/index.html delete mode 100644 docs/_site/rules/prefer-object-spread/index.html delete mode 100644 docs/_site/rules/prefer-readonly/index.html delete mode 100644 docs/_site/rules/prefer-switch/index.html delete mode 100644 docs/_site/rules/prefer-template/index.html delete mode 100644 docs/_site/rules/promise-function-async/index.html delete mode 100644 docs/_site/rules/quotemark/index.html delete mode 100644 docs/_site/rules/radix/index.html delete mode 100644 docs/_site/rules/restrict-plus-operands/index.html delete mode 100644 docs/_site/rules/return-undefined/index.html delete mode 100644 docs/_site/rules/semicolon/index.html delete mode 100644 docs/_site/rules/space-before-function-paren/index.html delete mode 100644 docs/_site/rules/space-within-parens/index.html delete mode 100644 docs/_site/rules/strict-boolean-expressions/index.html delete mode 100644 docs/_site/rules/strict-type-predicates/index.html delete mode 100644 docs/_site/rules/switch-default/index.html delete mode 100644 docs/_site/rules/switch-final-break/index.html delete mode 100644 docs/_site/rules/trailing-comma/index.html delete mode 100644 docs/_site/rules/triple-equals/index.html delete mode 100644 docs/_site/rules/type-literal-delimiter/index.html delete mode 100644 docs/_site/rules/typedef-whitespace/index.html delete mode 100644 docs/_site/rules/typedef/index.html delete mode 100644 docs/_site/rules/typeof-compare/index.html delete mode 100644 docs/_site/rules/unified-signatures/index.html delete mode 100644 docs/_site/rules/use-default-type-parameter/index.html delete mode 100644 docs/_site/rules/use-isnan/index.html delete mode 100644 docs/_site/rules/variable-name/index.html delete mode 100644 docs/_site/rules/whitespace/index.html delete mode 100644 docs/_site/usage/cli/index.html delete mode 100644 docs/_site/usage/configuration/index.html delete mode 100644 docs/_site/usage/library/index.html delete mode 100644 docs/_site/usage/rule-flags/index.html delete mode 100644 docs/_site/usage/third-party-tools/index.html delete mode 100644 docs/_site/usage/type-checking/index.html diff --git a/docs/_site/2015/12/10/a-new-tslint-website.html b/docs/_site/2015/12/10/a-new-tslint-website.html deleted file mode 100644 index f362acb439e..00000000000 --- a/docs/_site/2015/12/10/a-new-tslint-website.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - A New TSLint Website - - - - - - - - - - - -
- - -
- - -
-
- -
-

A New TSLint Website

- -
- -
-

As TSLint has grown in usage and popularity alongside of TypeScript, it also has -evolved in terms of functionality and complexity. Today, all sorts of projects and products, -from Angular 2 to the TypeScript compiler itself use TSLint -to help keep their code high-quality.

- -

Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. -For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long TSLint README. -Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. -There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.

- -

This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:

- -
    -
  • A documentation overhaul that will provide -more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.
  • -
  • A new --init feature in the TSLint CLI that will make it easier to -generate a sensible initial tslint.json config file.
  • -
  • An improved contributor experience that will make things easier for those who want to contribute code to TSLint.
  • -
- -

Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!

- - -
- -
- - - -
- - - - diff --git a/docs/_site/2016/03/31/sharable-configurations-rules.html b/docs/_site/2016/03/31/sharable-configurations-rules.html deleted file mode 100644 index 065d65b4638..00000000000 --- a/docs/_site/2016/03/31/sharable-configurations-rules.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - Sharable Configurations and Rules - - - - - - - - - - - -
- - -
- - -
-
- -
-

Sharable Configurations and Rules

- -
- -
-

With the release of TSLint v3.7.0 comes a few new features that will make configuration files (aka tslint.json files) -easier to maintain and share. The crux of the changes is a new extends field, which when provided indicates that a configuration -file augments another configuration file.

- -

Example

- -

Let’s imagine you’ve created some custom rules and want to share them with others. -You also have a couple of configurations for them you want to share.

- -

Here’s the layout of our NPM package, which we’ll call shared-tslint-rules. We have a directory with rules, -as well as a few different config files for TSLint.

- -
shared-tslint-rules
-├── package.json
-├── rules
-│   ├── noAdditionRule.js
-│   ├── noErrorsRule.js
-│   └── noExcessiveCommentingRule.js
-├── tslint-base.json
-├── tslint-config.json
-└── tslint-crazy-config.js
-
- -

Our starting-point config file just references the directory the custom rules are in -but doesn’t enable any of them:

- -

tslint-base.json:

- -
{
-    "rulesDirectory": "./rules"
-}
-
- -

We also want to provide a sane default config for our rules. -Notice how it extends our base config, so we don’t have to redeclare rulesDirectory here:

- -

tslint-config.json:

- -
{
-    "extends": "./tslint-base.json",
-    "rules": {
-        "no-errors": true,
-        "no-addition": false
-    }
-}
-
- -

Finally, we can even make a crazy config file for fun that gives you back a different config -each time you run TSLint. Notice how this is a .js file that exports an object:

- -

tslint-crazy-config.js

- -
module.exports = {
-    extends: "./tslint-base.json",
-    rules: {
-        "no-excessive-commenting": [true, {maxComments: Math.random() * 10}]
-    }
-};
-
- -

Finally, we have our package.json file which references our base config file through its main field:

- -

package.json:

- -
{
-  "name": "shared-tslint-rules",
-  "version": "1.0.0",
-  "description": "Some TSLint rules that are great!",
-  "main": "tslint-base.json",
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "author": "",
-  "license": "MIT"
-}
-
- -

We can publish our package on NPM to let the world use it!

- -
- -

Now let’s say we’re a user, and we want to use the custom rules above to lint our code. -First, we’ll make sure we have the necessary npm packages installed:

- -
npm install -g tslint shared-tslint-rules
-
- -

Then, in our tslint.json file for our project, we can reference the package of custom rules with extends:

- -
{
-    "extends": "shared-tslint-rules/tslint-config",
-    "rules": {
-        "no-addition": true
-    }
-}
-
- -

and that’s all we have to do to use the custom rules! -We can now run TSLint as we would normally and see any lint errors produced by the custom rules:

- -
tslint -c path/to/tslint.json my/files/**/to/lint.ts
-
- - -
- -
- - - -
- - - - diff --git a/docs/_site/2016/11/17/new-for-4.0.html b/docs/_site/2016/11/17/new-for-4.0.html deleted file mode 100644 index 55be6d39ddc..00000000000 --- a/docs/_site/2016/11/17/new-for-4.0.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - TSLint 4.0 Released - - - - - - - - - - - -
- - -
- - -
-
- -
-

TSLint 4.0 Released

- -
- -
-

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

- - - -
- -

Create your own fixer

-

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

- -

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-const fix = new Lint.Fix("no-imports", [replacement]);
-
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
- - -
- -
- - - -
- - - - diff --git a/docs/_site/Gemfile b/docs/_site/Gemfile deleted file mode 100644 index 053c27dc351..00000000000 --- a/docs/_site/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'github-pages' diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock deleted file mode 100644 index 3eaa6478c32..00000000000 --- a/docs/_site/Gemfile.lock +++ /dev/null @@ -1,238 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (4.2.9) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.11.1) - colorator (1.1.0) - commonmarker (0.17.7.1) - ruby-enum (~> 0.5) - concurrent-ruby (1.0.5) - ethon (0.11.0) - ffi (>= 1.3.0) - execjs (2.7.0) - faraday (0.13.1) - multipart-post (>= 1.2, < 3) - ffi (1.9.18) - forwardable-extended (2.6.0) - gemoji (3.0.0) - github-pages (172) - activesupport (= 4.2.9) - github-pages-health-check (= 1.3.5) - jekyll (= 3.6.2) - jekyll-avatar (= 0.5.0) - jekyll-coffeescript (= 1.0.2) - jekyll-commonmark-ghpages (= 0.1.3) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.9.2) - jekyll-gist (= 1.4.1) - jekyll-github-metadata (= 2.9.3) - jekyll-mentions (= 1.2.0) - jekyll-optional-front-matter (= 0.3.0) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.12.1) - jekyll-relative-links (= 0.5.2) - jekyll-remote-theme (= 0.2.3) - jekyll-sass-converter (= 1.5.0) - jekyll-seo-tag (= 2.3.0) - jekyll-sitemap (= 1.1.1) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.0) - jekyll-theme-cayman (= 0.1.0) - jekyll-theme-dinky (= 0.1.0) - jekyll-theme-hacker (= 0.1.0) - jekyll-theme-leap-day (= 0.1.0) - jekyll-theme-merlot (= 0.1.0) - jekyll-theme-midnight (= 0.1.0) - jekyll-theme-minimal (= 0.1.0) - jekyll-theme-modernist (= 0.1.0) - jekyll-theme-primer (= 0.5.2) - jekyll-theme-slate (= 0.1.0) - jekyll-theme-tactile (= 0.1.0) - jekyll-theme-time-machine (= 0.1.0) - jekyll-titles-from-headings (= 0.5.0) - jemoji (= 0.8.1) - kramdown (= 1.14.0) - liquid (= 4.0.0) - listen (= 3.0.6) - mercenary (~> 0.3) - minima (= 2.1.1) - rouge (= 2.2.1) - terminal-table (~> 1.4) - github-pages-health-check (1.3.5) - addressable (~> 2.3) - net-dns (~> 0.8) - octokit (~> 4.0) - public_suffix (~> 2.0) - typhoeus (~> 0.7) - html-pipeline (2.7.1) - activesupport (>= 2) - nokogiri (>= 1.4) - i18n (0.9.1) - concurrent-ruby (~> 1.0) - jekyll (3.6.2) - addressable (~> 2.4) - colorator (~> 1.0) - jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 1.1) - kramdown (~> 1.14) - liquid (~> 4.0) - mercenary (~> 0.3.3) - pathutil (~> 0.9) - rouge (>= 1.7, < 3) - safe_yaml (~> 1.0) - jekyll-avatar (0.5.0) - jekyll (~> 3.0) - jekyll-coffeescript (1.0.2) - coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.1.0) - commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) - jekyll-commonmark-ghpages (0.1.3) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.9.2) - jekyll (~> 3.3) - jekyll-gist (1.4.1) - octokit (~> 4.2) - jekyll-github-metadata (2.9.3) - jekyll (~> 3.1) - octokit (~> 4.0, != 4.4.0) - jekyll-mentions (1.2.0) - activesupport (~> 4.0) - html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.12.1) - jekyll (~> 3.3) - jekyll-relative-links (0.5.2) - jekyll (~> 3.3) - jekyll-remote-theme (0.2.3) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) - typhoeus (>= 0.7, < 2.0) - jekyll-sass-converter (1.5.0) - sass (~> 3.4) - jekyll-seo-tag (2.3.0) - jekyll (~> 3.3) - jekyll-sitemap (1.1.1) - jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.2) - jekyll (~> 3.5) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.2) - jekyll-theme-slate (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.0) - jekyll (~> 3.3) - jekyll-watch (1.5.1) - listen (~> 3.0) - jemoji (0.8.1) - activesupport (~> 4.0, >= 4.2.9) - gemoji (~> 3.0) - html-pipeline (~> 2.2) - jekyll (>= 3.0) - kramdown (1.14.0) - liquid (4.0.0) - listen (3.0.6) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9.7) - mercenary (0.3.6) - mini_portile2 (2.3.0) - minima (2.1.1) - jekyll (~> 3.3) - minitest (5.10.3) - multipart-post (2.0.0) - net-dns (0.8.0) - nokogiri (1.8.1) - mini_portile2 (~> 2.3.0) - octokit (4.8.0) - sawyer (~> 0.8.0, >= 0.5.3) - pathutil (0.16.1) - forwardable-extended (~> 2.6) - public_suffix (2.0.5) - rb-fsevent (0.10.2) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rouge (2.2.1) - ruby-enum (0.7.1) - i18n - rubyzip (1.2.1) - safe_yaml (1.0.4) - sass (3.5.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - typhoeus (0.8.0) - ethon (>= 0.8.0) - tzinfo (1.2.4) - thread_safe (~> 0.1) - unicode-display_width (1.3.0) - -PLATFORMS - ruby - -DEPENDENCIES - github-pages - -BUNDLED WITH - 1.16.1 diff --git a/docs/_site/circle.yml b/docs/_site/circle.yml deleted file mode 100644 index 1e8b5a738ae..00000000000 --- a/docs/_site/circle.yml +++ /dev/null @@ -1,7 +0,0 @@ -machine: - ruby: - # see available versions here: https://circleci.com/docs/build-image-precise/#ruby - version: 2.2.3 -test: - override: - - bundle exec jekyll build diff --git a/docs/_site/css/main.css b/docs/_site/css/main.css deleted file mode 100644 index f8b2fda7512..00000000000 --- a/docs/_site/css/main.css +++ /dev/null @@ -1,989 +0,0 @@ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ -html { - font-family: sans-serif; - /* 1 */ - -ms-text-size-adjust: 100%; - /* 2 */ - -webkit-text-size-adjust: 100%; - /* 2 */ } - -/** - * Remove default margin. - */ -body { - margin: 0; } - -/* HTML5 display definitions - ========================================================================== */ -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; } - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ -audio, -canvas, -progress, -video { - display: inline-block; - /* 1 */ - vertical-align: baseline; - /* 2 */ } - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ -audio:not([controls]) { - display: none; - height: 0; } - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. - */ -[hidden], -template { - display: none; } - -/* Links - ========================================================================== */ -/** - * Remove the gray background color from active links in IE 10. - */ -a { - background-color: transparent; } - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ -a:active, -a:hover { - outline: 0; } - -/* Text-level semantics - ========================================================================== */ -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ -abbr[title] { - border-bottom: 1px dotted; } - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ -b, -strong { - font-weight: bold; } - -/** - * Address styling not present in Safari and Chrome. - */ -dfn { - font-style: italic; } - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ -h1 { - font-size: 2em; - margin: 0.67em 0; } - -/** - * Address styling not present in IE 8/9. - */ -mark { - background: #ff0; - color: #000; } - -/** - * Address inconsistent and variable font size in all browsers. - */ -small { - font-size: 80%; } - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; } - -sup { - top: -0.5em; } - -sub { - bottom: -0.25em; } - -/* Embedded content - ========================================================================== */ -/** - * Remove border when inside `a` element in IE 8/9/10. - */ -img { - border: 0; } - -/** - * Correct overflow not hidden in IE 9/10/11. - */ -svg:not(:root) { - overflow: hidden; } - -/* Grouping content - ========================================================================== */ -/** - * Address margin not present in IE 8/9 and Safari. - */ -figure { - margin: 1em 40px; } - -/** - * Address differences between Firefox and other browsers. - */ -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; } - -/** - * Contain overflow in all browsers. - */ -pre { - overflow: auto; } - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; } - -/* Forms - ========================================================================== */ -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - */ -button, -input, -optgroup, -select, -textarea { - color: inherit; - /* 1 */ - font: inherit; - /* 2 */ - margin: 0; - /* 3 */ } - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ -button { - overflow: visible; } - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ -button, -select { - text-transform: none; } - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ -button, -html input[type="button"], -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; - /* 2 */ - cursor: pointer; - /* 3 */ } - -/** - * Re-set default cursor for disabled elements. - */ -button[disabled], -html input[disabled] { - cursor: default; } - -/** - * Remove inner padding and border in Firefox 4+. - */ -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; } - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ -input { - line-height: normal; } - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; - /* 1 */ - padding: 0; - /* 2 */ } - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; } - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome - * (include `-moz` to future-proof). - */ -input[type="search"] { - -webkit-appearance: textfield; - /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - /* 2 */ - box-sizing: content-box; } - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; } - -/** - * Define consistent border, margin, and padding. - */ -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; } - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ -legend { - border: 0; - /* 1 */ - padding: 0; - /* 2 */ } - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ -textarea { - overflow: auto; } - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ -optgroup { - font-weight: bold; } - -/* Tables - ========================================================================== */ -/** - * Remove most spacing between table cells. - */ -table { - border-collapse: collapse; - border-spacing: 0; } - -td, -th { - padding: 0; } - -/** - * Reset some basic elements - */ -body, h1, h2, h3, h4, h5, h6, -p, blockquote, pre, hr, -dl, dd, ol, ul, figure { - margin: 0; - padding: 0; } - -/** - * Set `margin-bottom` to maintain vertical rhythm - */ -h1, h2, h3, h4, h5, h6, -p, blockquote, pre, -ul, ol, dl, figure, -.highlight { - margin-bottom: 1rem; } - -/** - * Images - */ -img { - max-width: 100%; - vertical-align: middle; } - -/** - * Figures - */ -figure > img { - display: block; } - -figcaption { - font-size: 14px; } - -/** - * Clearfix - */ -.site-header:after, .page:after, .footer-col-wrapper:after { - content: ""; - display: table; - clear: both; } - -/** - * Icons - */ -.icon > svg { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: middle; } - .icon > svg path { - fill: #606c71; } - -/** - * Rules & Feature Badges - */ -.rules-list { - list-style: none; - margin: 0 !important; } - .rules-list > li:nth-child(odd) a { - background-color: rgba(0, 0, 0, 0.03); } - .rules-list > li a { - display: block; - border-left: 3px solid transparent; - text-decoration: none; - padding: .75rem; } - .rules-list > li a:hover { - background-color: rgba(0, 0, 0, 0.075); - border-left-color: #159957; } - -.rule-features { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; } - -.feature { - display: inline-block; - margin-right: 2px; - padding: 2px 4px; - font-weight: 700; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border: 1px solid transparent; - border-radius: .25rem; - cursor: help; } - .feature:before { - display: inline-block; - margin-right: 2px; } - .feature.feature-sm { - padding: 1px 3px; - font-size: 75%; } - .feature.feature-ts-only { - background-color: #FCF8E3; - border-color: #FAF2CC; - color: #8A6D3B; } - .feature.feature-ts-only:before { - content: "\1F4C4"; } - .feature.feature-fixer { - background-color: #DFF0D8; - border-color: #D0E9C6; - color: #3C763D; } - .feature.feature-fixer:before { - content: "\1f527"; } - .feature.feature-requires-type-info { - background-color: #F2DEDE; - border-color: #EBCCCC; - color: #A94442; } - .feature.feature-requires-type-info:before { - content: "\2139"; - border-radius: 50%; - background: #0078D7; - color: #FFF; - width: 1em; } - -.wrapper__code-example { - margin-bottom: 64px; } - .wrapper__code-example:last-of-type { - margin-bottom: 24px; } - .wrapper__code-example h6.heading-fail { - color: #d14; } - .wrapper__code-example .code-example { - background-color: #f1fff1; } - .wrapper__code-example .code-example.code-example-fail { - background-color: #fff5f5; } - .wrapper__code-example .code-example pre, .wrapper__code-example .code-example .highlight { - background: transparent; } - -* { - box-sizing: border-box; } - -body { - padding: 0; - margin: 0; - font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; - color: #606c71; } - -a { - color: #1e6bb8; - text-decoration: none; } - a:hover { - text-decoration: underline; } - a:visited { - color: #7d0ce8; } - -h1 { - font-size: 2.5rem; } - -h2 { - font-size: 2rem; } - -h3 { - font-size: 1.6rem; } - -h4 { - font-size: 1.4rem; } - -h5 { - font-size: 1.2rem; } - -h6 { - font-size: 1rem; } - -/** - * Site header - */ -.site-header { - border-bottom: 1px solid rgba(255, 255, 255, 0.2); - padding: 0 20px; - min-height: 56px; } - -.site-title { - font-size: 26px; - line-height: 56px; - margin-bottom: 0; - float: left; } - .site-title, .site-title:visited { - color: rgba(255, 255, 255, 0.7); } - .site-title:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; } - @media screen and (max-width: 36em) { - .site-title { - display: block; - text-align: left; } } - -.site-nav { - float: right; - line-height: 56px; } - .site-nav .page-link { - line-height: 1.5; } - .site-nav .page-link, .site-nav .page-link:visited { - color: rgba(255, 255, 255, 0.7); } - .site-nav .page-link:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; } - .site-nav .page-link:not(:first-child) { - margin-left: 20px; } - @media screen and (max-width: 36em) { - .site-nav .page-link { - display: block; - text-align: left; } - .site-nav .page-link:not(:first-child) { - margin-left: 0; } } - -.btn { - display: inline-block; - margin-bottom: 1rem; - background-color: rgba(255, 255, 255, 0.08); - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px; - border-radius: 0.3rem; - transition: color 0.2s, background-color 0.2s, border-color 0.2s; } - .btn, .btn:visited { - color: rgba(255, 255, 255, 0.7); } - .btn:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; - background-color: rgba(255, 255, 255, 0.2); - border-color: rgba(255, 255, 255, 0.3); } - .btn + .btn { - margin-left: 1rem; } - @media screen and (min-width: 64em) { - .btn { - padding: 0.75rem 1rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .btn { - padding: 0.6rem 0.9rem; - font-size: 0.9rem; } } - @media screen and (max-width: 36em) { - .btn { - display: block; - width: 100%; - padding: 0.75rem; - font-size: 0.9rem; } - .btn + .btn { - margin-top: 1rem; - margin-left: 0; } } - -.header { - color: #fff; - text-align: center; - background-color: #159957; - background-image: linear-gradient(120deg, #155799, #159957); } - -@media screen and (min-width: 64em) { - .page-header { - padding: 3rem; } } -@media screen and (min-width: 36em) and (max-width: 64em) { - .page-header { - padding: 2rem; } } -@media screen and (max-width: 36em) { - .page-header { - padding: 1rem; } } - -.project-name { - margin-top: 0; - margin-bottom: 0.1rem; } - @media screen and (min-width: 64em) { - .project-name { - font-size: 3.25rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .project-name { - font-size: 2.25rem; } } - @media screen and (max-width: 36em) { - .project-name { - font-size: 1.75rem; } } - -.project-tagline { - margin-bottom: 2rem; - font-weight: normal; - opacity: 0.7; } - @media screen and (min-width: 64em) { - .project-tagline { - font-size: 1.25rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .project-tagline { - font-size: 1.15rem; } } - @media screen and (max-width: 36em) { - .project-tagline { - font-size: 1rem; } } - -.main-content :first-child { - margin-top: 0; } -@media screen and (min-width: 64em) { - .main-content { - max-width: 68rem; - padding: 2rem 6rem; - margin: 0 auto; - font-size: 1.1rem; } } -@media screen and (min-width: 36em) and (max-width: 64em) { - .main-content { - padding: 2rem 4rem; - font-size: 1.1rem; } } -@media screen and (max-width: 36em) { - .main-content { - padding: 2rem 1rem; - font-size: 1rem; } } -.main-content img { - max-width: 100%; } -.main-content h1, -.main-content h2, -.main-content h3, -.main-content h4, -.main-content h5, -.main-content h6 { - margin-top: 2rem; - margin-bottom: 1rem; - font-weight: normal; - color: #159957; } -.main-content p { - margin-bottom: 1rem; } -.main-content code { - padding: 2px 4px; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - font-size: 0.9rem; - color: #383e41; - background-color: #f3f6fa; - border-radius: 0.3rem; } -.main-content pre { - padding: 0.8rem; - margin-top: 0; - margin-bottom: 1rem; - font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; - color: #567482; - word-wrap: normal; - background-color: #f3f6fa; - border: solid 1px #dce6f0; - border-radius: 0.3rem; } - .main-content pre > code { - padding: 0; - margin: 0; - font-size: 0.9rem; - color: #567482; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; } -.main-content .highlight { - margin-bottom: 1rem; } - .main-content .highlight pre { - margin-bottom: 0; - word-break: normal; } -.main-content .highlight pre, -.main-content pre { - padding: 0.8rem; - overflow: auto; - font-size: 0.9rem; - line-height: 1.45; - border-radius: 0.3rem; - -webkit-overflow-scrolling: touch; } -.main-content pre code, -.main-content pre tt { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; } - .main-content pre code:before, .main-content pre code:after, - .main-content pre tt:before, - .main-content pre tt:after { - content: normal; } -.main-content ul, -.main-content ol { - margin-top: 0; - margin-left: 30px; - margin-bottom: 1rem; } - .main-content ul ul, - .main-content ul ol, - .main-content ol ul, - .main-content ol ol { - margin-bottom: 0; } -.main-content blockquote { - padding: 0 1rem; - margin-left: 0; - color: #819198; - border-left: 0.3rem solid #dce6f0; } - .main-content blockquote > :first-child { - margin-top: 0; } - .main-content blockquote > :last-child { - margin-bottom: 0; } -.main-content table { - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all; - -webkit-overflow-scrolling: touch; } - .main-content table th { - font-weight: bold; } - .main-content table th, - .main-content table td { - padding: 0.5rem 1rem; - border: 1px solid #e9ebec; } -.main-content dl { - padding: 0; } - .main-content dl dt { - padding: 0; - margin-top: 1rem; - font-size: 1rem; - font-weight: bold; } - .main-content dl dd { - padding: 0; - margin-bottom: 1rem; } -.main-content hr { - height: 2px; - padding: 0; - margin: 1rem 0; - background-color: #eff0f1; - border: 0; } - -.page { - width: 100%; } - -.page-content { - width: 80%; - padding: 1rem; - float: left; } - -.page-sidebar { - width: 20%; - padding: 1rem; - float: left; } - .page-sidebar .active { - font-style: italic; } - -.sidebar-title { - border-bottom: 1px solid #159957; } - -ul.sidebar-links { - list-style: none; - margin-left: 0; } - ul.sidebar-links h6 { - margin-bottom: 0.33rem; } - -/** - * Posts - */ -ul.post-list { - margin-left: 0; - list-style: none; } - ul.post-list > li { - margin-bottom: 1rem; } - -.post-meta { - font-size: 14px; - color: #828282; - font-style: italic; } - -.post-link { - display: inline-block; - color: inherit; } - -.post-header { - margin-bottom: 2rem; } - -.post-title { - letter-spacing: -1px; - line-height: 1; } - -/** - * Site footer - */ -.site-footer { - padding-top: 2rem; - margin-top: 2rem; - border-top: solid 1px #eff0f1; - font-size: 0.9rem; } - -ul.contact-list, -ul.social-media-list { - list-style: none; - margin-left: 0; } - -.footer-col { - float: left; } - -.footer-col-2 { - float: right; } - @media screen and (max-width: 36em) { - .footer-col-2 { - float: left; } } - -/** - * Syntax highlighting styles - */ -.highlight { - background: #fff; } - .highlight .c { - color: #998; - font-style: italic; } - .highlight .err { - color: #a61717; - background-color: #e3d2d2; } - .highlight .k { - font-weight: bold; } - .highlight .o { - font-weight: bold; } - .highlight .cm { - color: #998; - font-style: italic; } - .highlight .cp { - color: #999; - font-weight: bold; } - .highlight .c1 { - color: #998; - font-style: italic; } - .highlight .cs { - color: #999; - font-weight: bold; - font-style: italic; } - .highlight .gd { - color: #000; - background-color: #fdd; } - .highlight .gd .x { - color: #000; - background-color: #faa; } - .highlight .ge { - font-style: italic; } - .highlight .gr { - color: #a00; } - .highlight .gh { - color: #999; } - .highlight .gi { - color: #000; - background-color: #dfd; } - .highlight .gi .x { - color: #000; - background-color: #afa; } - .highlight .go { - color: #888; } - .highlight .gp { - color: #555; } - .highlight .gs { - font-weight: bold; } - .highlight .gu { - color: #aaa; } - .highlight .gt { - color: #a00; } - .highlight .kc { - font-weight: bold; } - .highlight .kd { - font-weight: bold; } - .highlight .kp { - font-weight: bold; } - .highlight .kr { - font-weight: bold; } - .highlight .kt { - color: #458; - font-weight: bold; } - .highlight .m { - color: #099; } - .highlight .s { - color: #d14; } - .highlight .na { - color: #008080; } - .highlight .nb { - color: #0086B3; } - .highlight .nc { - color: #458; - font-weight: bold; } - .highlight .no { - color: #008080; } - .highlight .ni { - color: #800080; } - .highlight .ne { - color: #900; - font-weight: bold; } - .highlight .nf { - color: #900; - font-weight: bold; } - .highlight .nn { - color: #555; } - .highlight .nt { - color: #000080; } - .highlight .nv { - color: #008080; } - .highlight .ow { - font-weight: bold; } - .highlight .w { - color: #bbb; } - .highlight .mf { - color: #099; } - .highlight .mh { - color: #099; } - .highlight .mi { - color: #099; } - .highlight .mo { - color: #099; } - .highlight .sb { - color: #d14; } - .highlight .sc { - color: #d14; } - .highlight .sd { - color: #d14; } - .highlight .s2 { - color: #d14; } - .highlight .se { - color: #d14; } - .highlight .sh { - color: #d14; } - .highlight .si { - color: #d14; } - .highlight .sx { - color: #d14; } - .highlight .sr { - color: #009926; } - .highlight .s1 { - color: #d14; } - .highlight .ss { - color: #990073; } - .highlight .bp { - color: #999; } - .highlight .vc { - color: #008080; } - .highlight .vg { - color: #008080; } - .highlight .vi { - color: #008080; } - .highlight .il { - color: #099; } diff --git a/docs/_site/develop/contributing/index.html b/docs/_site/develop/contributing/index.html deleted file mode 100644 index 407c93a6cd2..00000000000 --- a/docs/_site/develop/contributing/index.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - Contributing to TSLint - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Contributing to TSLint

-

-
- - -

To develop TSLint, clone the repository and install its dependencies:

- -
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf
-yarn
-yarn compile
-yarn test
-
- -

Running a specific test

- -

You can test a specific test by using the --test command line parameter followed by your test directory. For example:

-
// global tslint
-// point to a dir that has tslint.json and .lint files
-tslint --test test/rules/semicolon/always
-
-// locally built tslint
-./bin/tslint --test test/rules/semicolon/always
-
- -

Debugging in Visual Studio Code

- -

Configuration files to work with Visual Studio Code are included when you check out the source code. These files live in the .vscode directory. To run TSLint in the debugger, switch to Debug view and use the dropdown at the top of the Debug pane to select the launch configuration (specified in .vscode/launch.json). Press F5 to debug. You should be able to set breakpoints and debug as usual.

- -

The current debug configurations are:

- -
    -
  • Debug CLI: Used to debug TSLint using command line arguments. Modify the args array in .vscode/launch.json to add arguments.
  • -
  • Debug Mocha Tests: Runs non-rule tests
  • -
  • Debug Rule Tests: Runs rule tests (under test/rules)
  • -
  • Debug Document Generation: Debug the scripts/buildDocs.ts script.
  • -
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-formatters/index.html b/docs/_site/develop/custom-formatters/index.html deleted file mode 100644 index d91b99b9aff..00000000000 --- a/docs/_site/develop/custom-formatters/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Custom Formatters - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Custom Formatters

-

-
- - -

Just like custom rules, additional formatters can also be supplied to TSLint via --formatters-dir on the CLI or formattersDirectory option on the library or grunt-tslint. Writing a new formatter is simpler than writing a new rule, as shown in the JSON formatter’s code.

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Formatter extends Lint.Formatters.AbstractFormatter {
-    public format(failures: Lint.RuleFailure[]): string {
-        var failuresJSON = failures.map((failure: Lint.RuleFailure) => failure.toJson());
-        return JSON.stringify(failuresJSON);
-    }
-}
-
- -

Such custom formatters can also be written in Javascript. Additionally, formatter files are always named with the suffix Formatter, and referenced from TSLint without its suffix.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/index.html b/docs/_site/develop/custom-rules/index.html deleted file mode 100644 index 41b32272a14..00000000000 --- a/docs/_site/develop/custom-rules/index.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - Developing TSLint rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Developing TSLint rules

-

-
- - -

TSLint ships with a set of core rules that can be configured. However, users are also allowed to write their own rules, which allows them to enforce specific behavior not covered by the core of TSLint. TSLint’s internal rules are itself written to be pluggable, so adding a new rule is as simple as creating a new rule file named by convention. New rules can be written in either TypeScript or JavaScript; if written in TypeScript, the code must be compiled to JavaScript before invoking TSLint.

- -

Let us take the example of how to write a new rule to forbid all import statements (you know, for science). Let us name the rule file noImportsRule.ts. Rules are referenced in tslint.json with their kebab-cased identifer, so "no-imports": true would configure the rule.

- -

Important conventions:

- -
    -
  • Rule identifiers are always kebab-cased.
  • -
  • Rule files are always camel-cased (camelCasedRule.ts).
  • -
  • Rule files must contain the suffix Rule.
  • -
  • The exported class must always be named Rule and extend from Lint.Rules.AbstractRule.
  • -
- -

Now, let us first write the rule in TypeScript:

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "import statement forbidden";
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        return this.applyWithWalker(new NoImportsWalker(sourceFile, this.getOptions()));
-    }
-}
-
-// The walker takes care of all the work.
-class NoImportsWalker extends Lint.RuleWalker {
-    public visitImportDeclaration(node: ts.ImportDeclaration) {
-        // create a failure at the current position
-        this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
-
-        // call the base version of this visitor to actually parse this node
-        super.visitImportDeclaration(node);
-    }
-}
-
- -

Given a walker, TypeScript’s parser visits the AST using the visitor pattern. So the rule walkers only need to override the appropriate visitor methods to enforce its checks. For reference, the base walker can be found in syntaxWalker.ts. To see what your Typescript file or snippet looks like as an AST, visit astexplorer.net (note: current version of TypeScript may not be supported, yet).

- -

We still need to hook up this new rule to TSLint. First make sure to compile noImportsRule.ts:

- -
tsc noImportsRule.ts
-
- -

Then, if using the CLI, provide the directory that contains this rule as an option to --rules-dir. If using TSLint as a library or via grunt-tslint, the options hash must contain "rulesDirectory": "...". If you run the linter, you’ll see that we have now successfully banned all import statements via TSLint!

- -

Finally, add a line to your tslint.json config file for each of your custom rules.

- -
- -

Now that you’re written a rule to detect problems, let’s modify it to fix them.

- -

Instantiate a Fix object and pass it in as an argument to addFailure. This snippet replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const fix = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-
-// create a failure at the current position
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
-
-

Final notes:

- -
    -
  • Core rules cannot be overwritten with a custom implementation.
  • -
  • Custom rules can also take in options just like core rules (retrieved via this.getOptions()).
  • -
  • As of TSLint v5.7.0 you no longer need to compile your custom rules before using them. You need to tell node.js how to load .ts files for example by using ts-node:
  • -
- -
ts-node node_modules/.bin/tslint <your options>
-# or
-node -r ts-node/register node_modules/.bin/tslint <your options>
-# or
-NODE_OPTIONS="-r ts-node/register" tslint <your options>
-
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/performance-tips.html b/docs/_site/develop/custom-rules/performance-tips.html deleted file mode 100644 index 82660c2df98..00000000000 --- a/docs/_site/develop/custom-rules/performance-tips.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - - TSLint performance tips - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint performance tips

-

-
- - -

As TSLint has matured, we have developed some best practices for making rules run faster. TSLint 5.0 was a particularly -significant release that featured many performance enhancements using the below tips (some codebases experienced lint times -cut in half).

- -

Use the TypeChecker only when needed

- -

The TypeChecker is a really mighty tool, but that comes with a cost. To create a TypeChecker the Program first has to locate, read, parse and bind all SourceFiles referenced. -To avoid that cost, try to avoid the TypeChecker where possible.

- -

If you are interested in the JSDoc of a function for example, you could ask the TypeChecker. -But there’s another way: call .getChildren() on the FunctionDeclaration and search for nodes of kind ts.SyntaxKind.JSDocComment. -Those nodes will precede other nodes in the array.

- -

Avoid walking the AST if possible

- -

Some rules work directly on the content of the source file.

- -

For example, max-file-line-count and linebreak-style don’t need to walk the AST at all.

- -

Other rules define exceptions: no-consecutive-blank-lines ignores template strings. -To optimize for the best case, this rule can first look for failures in the source. -If and only if there are any failures, walk the AST to find the location of all template strings to filter the failures.

- -

Implement your own walking algorithm

- -

Convenience comes with a price. When using SyntaxWalker or any subclass thereof like RuleWalker you pay the price for the -big switch statement in visitNode which then calls the appropriate visitXXX method for every node in the AST, even if you don’t use them.

- -

Use AbstractWalker instead and implement the walk method to fit the needs of your rule. -It’s as simple as this:

- -
class MyWalker extends Lint.AbstractWalker<MyOptionsType> {
-    public walk(sourceFile: ts.SourceFile) {
-        const cb = (node: ts.Node): void => {
-            if (someCondition) {
-                // do stuff
-            }
-            // Wondering why return is used below? Refer to "Make use of tail calls"
-            return ts.forEachChild(node, cb); // recurse deeper
-        };
-        return ts.forEachChild(sourceFile, cb); // start recursion with children of sourceFile
-    }
-
- -

Don’t walk the whole AST if possible

- -

The language specification is your friend: -The language spec defines where each statement can occur. -For example, if you are interested in import statements, you only need to search in sourceFile.statements and nested NamespaceDeclarations.

- -

Don’t visit AST branches you’re not interested in: -For example, no-null-keyword creates no failure if the null keyword is part of another type. -There are two ways to achieve this:

- -
    -
  • Recurse into the AST until you find a token of kind NullKeyword and then walk up its parent chain to find out if it is part of a type node.
  • -
  • Stop recursing deeper into that branch as soon as you hit a type node (preferred).
  • -
- -

Avoid frequently creating one-time closures in the hot path

-
class SomeClass {
-    // this is a simplified version of what SyntaxWalker does under the hood
-    doStuff(node: ts.Node) {
-        // do stuff ...
-
-        ts.forEachChild(node, (n) => this.doStuff(n));
-                           // ~~~~~~~~~~~~~~~~~~~~~~ [a new closure is created for EVERY node in the AST and remains on the call stack
-                           //                         until processing of all children is done]
-    }
-}
-
- -

Instead use the same closure for every call like the example above in Implement your own walking algorithm.

- -

Create small specialized functions / methods

- -

Instead of stuffing the whole logic in a single closure, consider splitting it up into smaller functions or methods. -Each function should handle similar kinds of nodes. Don’t worry too much about the function call, since V8 eventually inlines the function -if possible.

- -

The AST nodes have different properties, therefore they have a different hidden class in V8. A function can only be optimized for a certain -amount of different hidden classes. Above that threshold the function will be deoptimized and is never optimized again.

- -

Supply the optional sourceFile parameter

- -

There are serveral methods that have an optional parameter sourceFile. Don’t omit this parameter if you care for performance. -If ommitted, typescript needs to walk up the node’s parent chain until it reaches the SourceFile. This can be quite costly when done -frequently on deeply nested nodes.

- -

Some examples:

- -
    -
  • node.getStart()
  • -
  • node.getWidth()
  • -
  • node.getText()
  • -
  • node.getChildren()
  • -
  • node.getFirstToken()
  • -
  • node.getLeadingTriviaWidth()
  • -
- -

Avoid excessive calls to node.getStart(), node.getWidth() and node.getText()

- -

node.getStart() scans the source to skip all the leading trivia. Although barely noticeable, this operation is not for free. -If you need the start position of a node more than once per function, consider caching it.

- -

node.getWidth() is most of the time used together with node.getStart() to get the node’s span. Internally it uses node.getEnd() - node.getStart() which effectively doubles the calls to node.getStart(). Consider using node.getEnd() instead and calculate the width yourself if necessary.

- -

node.getText() calculates the start of the node and returns a substring until the end of the token. -Most of the time this not needed, because this substring is already contained in the node.

- -
declare node: ts.Identifier;
-node.getText() === node.text; // prefer node.text where available
-
- -

Bonus points: If you know the width of the node (either from the text property or because it is a keyword of known width), -you can use node.getEnd() - width to calculate the node’s start. -node.getEnd() is effectively for free as it only returns the end property. This way you avoid the cost of skipping leading trivia.

- -

Make use of tail calls

- -

Tail calls are function or method calls at the end of the control flow of a function. It’s only a tail call if the return value of that call -is directly returned unchanged. Browsers can optimize this pattern for performance. -Further optimization is specced in ES2015 as “Proper Tail Calls”. -With proper tail calls the browser reuses the stack frame of the current function. When done right this allows for infinite recursion.

- -
function foo() {
-    if (condition)
-        return bar(); // tail call
-    if (someOtherCondition)
-        return foo() + 1; // no tail call, return value is modified
-    return baz(); // tail call
-}
-
-function bas() {
-    if (cond)
-        return someGlobalVariable = bar(); // no tail call, return value is stored in value before it is returned
-    foo(); // no tail call because there is no return
-}
-
- -

Typeguards

- -

Typeguard functions are very small by default. These functions will be inlined into the containing function. -After inlining you no longer pay the cost of the function call.

- -

But beware of the inlining limit. If a function is big enough or already has many inlined functions, V8 will stop inlining other functions.

- -

Try to use a discriminated union if possible. A typeguard makes sense if you can save up multiple type assertions.

- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/walker-design.html b/docs/_site/develop/custom-rules/walker-design.html deleted file mode 100644 index bb02ca8fb15..00000000000 --- a/docs/_site/develop/custom-rules/walker-design.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - Designing rule walkers - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Designing rule walkers

-

-
- - -

Using WalkContext and applyWithFunction

- -

If you have a rule with a pretty simple implementation, you don’t need to declare a class which extends the Walker class. Instead, you can define a callback function that accepts following argument:

- -
    -
  • ctx: WalkContext<T>: An object containing rule information, an object options: T containing the parsed rule arguments, the ts.sourceFile object, and functions for adding failures
  • -
- -

Use this callback as an argument to applyWithFunction. You can also pass your parsed rule arguments as optional 3rd parameter.

- -

Let’s look at no-null-keyword as an example:

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "Use 'undefined' instead of 'null'";
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        // Call `applyWithFunction` with your callback function, `walk`.
-        // This creates a `WalkContext<T>` and passes it in as an argument.
-        // An optional 3rd parameter allows you to pass in a parsed version of `this.ruleArguments`. If used, it is not recommended to
-        //     simply pass in `this.getOptions()`, but to parse it into a more useful object instead.
-        return this.applyWithFunction(sourceFile, walk);
-    }
-}
-
-// Here, the options object type is `void` because we don't pass any options in this example.
-function walk(ctx: Lint.WalkContext<void>) {
-    // Recursively walk the AST starting with root node, `ctx.sourceFile`.
-    // Call the function `cb` (defined below) for each child.
-    return ts.forEachChild(ctx.sourceFile, cb);
-    
-    function cb(node: ts.Node): void {
-        // Stop recursing further into the AST by returning early. Here, we ignore type nodes.
-        if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) {
-            return;
-        }
-        
-        // Add failures using the `WalkContext<T>` object. Here, we add a failure if we find the null keyword.
-        if (node.kind === ts.SyntaxKind.NullKeyword) {
-            return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
-        }
-        
-        // Continue recursion into the AST by calling function `cb` for every child of the current node.
-        return ts.forEachChild(node, cb);
-    }
-}
-
- -

Using AbstractWalker

- -

If your rule implementation is a bit more involved than the above example, you can also implement it as a class. -Simply extend AbstractWalker<T> and implement the walk method.

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "'magic numbers' are not allowed";
-
-    public static ALLOWED_NODES = new Set<ts.SyntaxKind>([
-        ...
-    ]);
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        // We convert the `ruleArguments` into a useful format before passing it to the constructor of AbstractWalker.
-        return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String))));
-    }
-}
-
-// The type parameter of AbstractWalker corresponds to the third constructor parameter.
-class NoMagicNumbersWalker extends Lint.AbstractWalker<Set<string>> {
-    public walk(sourceFile: ts.SourceFile) {
-        const cb = (node: ts.Node): void => {
-            // Finds specific node types and do checking.
-            if (node.kind === ts.SyntaxKind.NumericLiteral) {
-                this.checkNumericLiteral(node, (node as ts.NumericLiteral).text);
-            } else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression &&
-                       (node as ts.PrefixUnaryExpression).operator === ts.SyntaxKind.MinusToken) {
-                this.checkNumericLiteral(node, "-" + ((node as ts.PrefixUnaryExpression).operand as ts.NumericLiteral).text);
-            } else {
-                // Continue rescursion: call function `cb` for all children of the current node.
-                return ts.forEachChild(node, cb);
-            }
-        };
-        
-        // Start recursion for all children of `sourceFile`.
-        return ts.forEachChild(sourceFile, cb);
-    }
-
-    private checkNumericLiteral(node: ts.Node, num: string) {
-        // `this.options` is the third constructor parameter from above (the Set we created in `Rule.apply`)
-        if (!Rule.ALLOWED_NODES.has(node.parent!.kind) && !this.options.has(num)) {
-            // Add failures to the Walker.
-            this.addFailureAtNode(node, Rule.FAILURE_STRING);
-        }
-    }
-}
-
- -

Migrating from RuleWalker to AbstractWalker

- -

The main difference between RuleWalker and AbstractWalker is that you need to implement the AST recursion yourself. But why would you want to do that? -Performance! RuleWalker wants to be “one walker to rule them all” (pun intended). It’s easy to use but that convenience -makes it slow by default. When implementing the walking yourself, you only need to do as much work as needed.

- -

Besides that you should convert the ruleArguments to a useful format before passing it to AbstractWalker as seen above.

- -

This table describes the equivalent methods between the two classes:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RuleWalkerAbstractWalker
this.createFailure() and this.addFailure()this.addFailureAt()
this.addFailureFromStartToEnd()this.addFailure()
this.createReplacement()new Lint.Replacement()
this.deleteText()Lint.Replacement.deleteText()
this.deleteFromTo()Lint.Replacement.deleteFromTo()
this.appendText()Lint.Replacement.appendText()
this.hasOption() and this.getOptions()use this.options directly
this.getLineAndCharacterOfPosition()ts.getLineAndCharacterOfPosition(this.sourceFile, ...)
this.getLimit()this.sourceFile.end
this.getSourceFile()is available to be compatible, but prefer this.sourceFile
this.getFailures()is available to be compatible, but prefer this.failures
this.skip()just don’t use it, it’s a noop
this.getRuleName()this.ruleName
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/docs/index.html b/docs/_site/develop/docs/index.html deleted file mode 100644 index 5d03263cfc0..00000000000 --- a/docs/_site/develop/docs/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Docs Development - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Docs Development

-

-
- - -

This docs site is a Jekyll site hosted on GitHub pages. -It is maintained in the /docs directory of TSLint. -To contribute to the docs, whether it be better styling, functionality, or content, just create a PR as you would for any code contribution.

- -

Updating Rule Documentation

-

The documentation for rules is automatically generated from the metadata supplied by each rule in its corresponding .ts file. -If you’d like to help improve documentation for them, simply file a PR improving a rule’s metadata and a project collaborator will take care of regenerating the docs site once your PR is merged.

- -

Running the npm run docs command will regenerate the rules docs based off of the metadata provided in the code. This is normally done each release so that the public docs site is up to date with the latest release.

- -

Creating New Pages

-

To create a new page, follow the pattern of existing pages. You’ll also need to add appropriate metadata in the _data/*_sidebar.json data file if you want it to show up in a sidebar.

- -

Creating News Posts

-

To create a new news post, simply add a new markdown file to the _posts directory, following the same pattern as existing ones.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/testing-rules/index.html b/docs/_site/develop/testing-rules/index.html deleted file mode 100644 index bece43db06c..00000000000 --- a/docs/_site/develop/testing-rules/index.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - Testing Rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Testing Rules

-

-
- - -

Every TSLint rule has a corresponding directory inside test/rules/ which contains one or more test cases for the rule.

- -

Each test case contains:

- -
    -
  • A tslint.json file which specifies the configuration for TSLint to use
  • -
  • .ts.lint test files which contain TypeScript code and a special markup which indicate where lint failures should be found
  • -
- -

The test system lints the .ts.lint files with the settings specified in tslint.json and makes sure that failures generated by the TSLint match the failures marked in the .ts.lint files.

- -

Example

- -
Testing a New Rule
- -

Say we’re contributing a new rule to TSLint that bans the use of animal variable names and we now need to test it. First we create our configuration file which enables only the rule to be tested:

- -

test/rules/no-animal-variable-names/default/tslint.json:

- -
{
-  "rules": {
-    "no-animal-variable-names": true
-  }
-}
-
- -

In this case, we placed our configuration inside no-animal-variable-names/default to indicate that we’re testing the default configuration for our rule.

- -

Now let’s make the actual test file:

- -

test/rules/no-animal-variable-names/default/test.ts.lint:

- -
const octopus = 5;
-      ~~~~~~~      [Variables named after animals are not allowed!]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [Variables named after animals are not allowed!]
-                     ~~~~~  [Variables named after animals are not allowed!]
-
-const tree = 5;
-const skyscraper = 100;
-
- -

In the above file, ~ characters “underline” where our rule should generate a lint failure -and the message that should be produced appears in brackets afterwards.

- -

If multiple lint failures occur on the same line of TypeScript code, the markup for them is placed on consecutive lines, -as shown in the above example with the line let giraffe: number, tiger: number;

- -

Notice how we also include lines of code that shouldn’t generate lint failures. -This is important to ensure that the rule isn’t creating false-positives.

- -

We can now run yarn compile:test && yarn test:rules to make sure that our rule produces the output we expect.

- -
Testing a New Rule Option
- -

Let’s look at one more example. Say we’ve added an also-no-plants option to our rule above that disallows variable names that are plants. We should add a test for this new option:

- -

test/rules/no-animal-variable-names/also-no-plants/tslint.json:

- -
{
-  "rules": {
-    "no-animal-variable-names": [true, "also-no-plants"]
-  }
-}
-
- -

test/rules/no-animal-variable-names/also-no-plants/test.ts.lint:

- -
const octopus = 5;
-      ~~~~~~~     [no-animal]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal]
-                     ~~~~~  [no-animal]
-
-const tree = 5;
-      ~~~~      [no-plant]
-const skyscraper = 100;
-
-[no-animal]: Variables named after animals are not allowed!
-[no-plant]: Variables named after plants are not allowed!
-
- -

We’ve now used a special message shorthand syntax so we don’t have to type out the same failure message over and over. -Instead of writing out the full lint failure message after each occurance of it, we instead just specify a shortcut name. -(Shortcut names can only consist of letters, numbers, underscores, and hyphens.) -Then, at the bottom of our test file, we specify what full message each shortcut should expand to.

- -

Again, we can run yarn compile:test && yarn test:rules to make sure our rule is producing the output we expect. If it isn’t we’ll see the difference between the output from the rule and the output we marked.

- -

You can also use placeholders to format messages. That’s useful if the error message contains non-static parts, e.g. variable names. But let’s stick to the above example for now.

- -
const octopus = 5;
-      ~~~~~~~     [no-animal]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal]
-                     ~~~~~  [no-animal]
-
-const tree = 5;
-      ~~~~      [error % ("plants")]
-const skyscraper = 100;
-
-[error] Variables named after %s are not allowed!
-[no-animal]: error % ('animals')
-
- -

We created a message template called error which has one placeholder %s. For a complete list of supported placeholders, please refer to the documentation of node’s util.format(). -To use the template for formatting, you need to use a special syntax: template_name % ('substitution1' [, "substitution2" [, ...]]). -Substitutions are passed as comma separated list of javascript string literals. The strings need to be wrapped in single or double quotes. Escaping characters works like you would expect in javascript.

- -

You may have noticed that the template is used for formatting in two different places. Use it in inline errors to pass another substitution every time. -If you use formatting in another message shorthand (like we did for [no-animal]), you need to make sure the template is defined before its use. That means swapping the lines of [error] and [no-animal] will not work. There are no restrictions for the use of [no-animal] in inline errors, though.

- -

Now let’s pretend the rule changed its error message to include the variable name at the end. The following example shows how to substitute multiple placeholders.

- -
const octopus = 5;
-      ~~~~~~~     [no-animal % ('octopus')]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal % ('giraffe')]
-                     ~~~~~  [no-animal % ('tiger')]
-
-const tree = 5;
-      ~~~~      [error % ("plants", "tree")]
-const skyscraper = 100;
-
-[error] Variables named after %s are not allowed: '%s'
-[no-animal]: error % ('animals')
-
- -
Typescript version requirement
- -

Sometimes a rule requires a minimum version of the typescript compiler or your test contains syntax that older versions of the typescript parser cannot handle. -When testing with multiple versions of typescript - like tslint does in CI - those tests will fail.

- -

To avoid failing tests, each test file can specify a version requirement for typescript in the first line. If you don’t specify one, the test will always be executed.

- -

Example:

-
[typescript]: >= 2.1.0
-
- -

The syntax should look familiar, because it is basically the shorthand syntax from the chapter above. It needs to start with [typescript]:. -The following part can be any version range. The prerelease suffix will be removed before matching to allow testing with nightly builds.

- -

Tips & Tricks

- -
    -
  • -

    You can use this system to test rules outside of the TSLint build! Use the tslint --test path/to/dir command to test your own custom rules. -You can specify one or more paths to tslint.json files or directories containing a tslint.json. Glob patterns are also supported. -Besides the tslint.json each directory you pass should contain *.ts.lint files. You can try this out on the TSLint rule test cases, for example, tslint --test path/to/tslint-code/test/rules/quotemark/single. -If you want to test all of your rules at once, you can use it like this: tslint --test rules/test/**/tslint.json

    -
  • -
  • -

    To test rules that need type information, you can simply add a tsconfig.json with the desired configuration next to tslint.json.

    -
  • -
  • -

    Lint failures sometimes span over multiple lines. To handle this case, don’t specify a message until the end of the error. For example:

    -
  • -
- -
for (let key in obj) {
-~~~~~~~~~~~~~~~~~~~~~~
-  console.log(key);
-~~~~~~~~~~~~~~~~~~~
-}
-~ [for-in loops are not allowed]
-
- -
    -
  • If for some reason your lint rule generates a failure that has zero width, you can use the ~nil mark to indicate this.
  • -
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/feed.xml b/docs/_site/feed.xml deleted file mode 100644 index e4ba5bba4b8..00000000000 --- a/docs/_site/feed.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - TSLint - TSLint documentation. A linter for the TypeScript language. - - http://localhost:4000/tslint/ - - Mon, 09 Apr 2018 09:06:25 -0400 - Mon, 09 Apr 2018 09:06:25 -0400 - Jekyll v3.6.2 - - - TSLint 4.0 Released - <p>TSLint 4.0 has been released! With this release comes a few exciting <a href="https://github.com/palantir/tslint/releases">changes</a>. Some of the highlights:</p> - -<ul> - <li><strong>Fixers</strong>. Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we’ll fix them for you. To use this feature, run <code class="highlighter-rouge">tslint</code> with the <code class="highlighter-rouge">--fix</code> option. Rules that support the <code class="highlighter-rouge">--fix</code> feature: - <ul> - <li><a href="/tslint/rules/array-type">array-type</a></li> - <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> - <li><a href="/tslint/rules/no-unused-variable">no-unused-variable</a> (for imports)</li> - <li><a href="/tslint/rules/no-var-keyword">no-var-keyword</a></li> - <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> - <li><a href="/tslint/rules/semicolon">semicolon</a></li> - <li><a href="/tslint/rules/trailing-comma">trailing-comma</a></li> - </ul> - </li> - <li> - <p><strong>Linting <code class="highlighter-rouge">.js</code> files</strong>. <em>A much-requested feature from our community</em>. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a <code class="highlighter-rouge">jsRules</code> <a href="https://raw.githubusercontent.com/palantir/tslint/master/src/configs/recommended.ts">section</a> to your <code class="highlighter-rouge">tslint.json</code> file, and TSLint will lint your JavaScript files.</p> - </li> - <li><strong>TypeScript 2.0+ required</strong>. This lets us deprecate/remove rules that are checked by the compiler. Problematic code that once violated these rules now cause compilation errors in <code class="highlighter-rouge">tsc</code>: - <ul> - <li>no-duplicate-key</li> - <li>no-unreachable</li> - <li>no-unused-variable</li> - </ul> - </li> - <li> - <p><strong>Node.js API Change</strong>. <a href="https://github.com/palantir/tslint/pull/1720">Moved and renamed</a> some things to make more sense. Get it all when you use <code class="highlighter-rouge">import * as TSLint from "tslint"</code>.</p> - </li> - <li><strong><a href="https://github.com/palantir/tslint/pull/1717/files#diff-6e3940e8ec3d59837c4435f32975ed2c">Recommended Rules Updated</a></strong> - <ul> - <li><a href="/tslint/rules/adjacent-overload-signatures">adjacent-overload-signatures</a></li> - <li><a href="/tslint/rules/array-type">array-type</a></li> - <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> - <li><a href="/tslint/rules/max-classes-per-file">max-classes-per-file</a></li> - <li><a href="/tslint/rules/no-unsafe-finally">no-unsafe-finally</a></li> - <li><a href="/tslint/rules/object-literal-key-quotes">object-literal-key-quotes</a> (as needed)</li> - <li><a href="/tslint/rules/object-literal-shorthand">object-literal-shorthand</a></li> - <li><a href="/tslint/rules/only-arrow-functions">only-arrow-functions</a></li> - <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> - <li><a href="/tslint/rules/prefer-for-of">prefer-for-of</a></li> - </ul> - </li> - <li><strong>Other rules you might find handy</strong>: - <ul> - <li><a href="/tslint/rules/completed-docs">completed-docs</a></li> - <li><a href="/tslint/rules/cyclomatic-complexity">cyclomatic-complexity</a></li> - </ul> - </li> -</ul> - -<hr /> - -<h2 id="create-your-own-fixer">Create your own fixer</h2> -<p>To create your own fixer, instantiate a <code class="highlighter-rouge">Fix</code> object and pass it in as an argument to <code class="highlighter-rouge">addFailure</code>.</p> - -<p>This snippet updates the <a href="/tslint/develop/custom-rules">sample custom rule</a> by adding a fixer which replaces the offending import statement with an empty string:</p> - -<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// create a fixer for this failure</span> -<span class="kd">const</span> <span class="nx">replacement</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Replacement</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="s2">""</span><span class="p">);</span> -<span class="kd">const</span> <span class="nx">fix</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Fix</span><span class="p">(</span><span class="s2">"no-imports"</span><span class="p">,</span> <span class="p">[</span><span class="nx">replacement</span><span class="p">]);</span> - -<span class="k">this</span><span class="p">.</span><span class="nx">addFailure</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">createFailure</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="nx">Rule</span><span class="p">.</span><span class="nx">FAILURE_STRING</span><span class="p">,</span> <span class="nx">fix</span><span class="p">));</span> -</code></pre></div></div> - - - Thu, 17 Nov 2016 10:19:00 -0500 - http://localhost:4000/tslint/2016/11/17/new-for-4.0.html - http://localhost:4000/tslint/2016/11/17/new-for-4.0.html - - - - - - Sharable Configurations and Rules - <p>With the release of <a href="https://github.com/palantir/tslint/releases">TSLint v3.7.0</a> comes a few new features that will make configuration files (aka <a href="/tslint/usage/tslint-json"><code class="highlighter-rouge">tslint.json</code> files</a>) -easier to maintain and share. The crux of the changes is a new <code class="highlighter-rouge">extends</code> field, which when provided indicates that a configuration -file augments another configuration file.</p> - -<h3 id="example">Example</h3> - -<p>Let’s imagine you’ve created some custom rules and want to share them with others. -You also have a couple of configurations for them you want to share.</p> - -<p>Here’s the layout of our NPM package, which we’ll call <code class="highlighter-rouge">shared-tslint-rules</code>. We have a directory with rules, -as well as a few different config files for TSLint.</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>shared-tslint-rules -├── package.json -├── rules -│   ├── noAdditionRule.js -│   ├── noErrorsRule.js -│   └── noExcessiveCommentingRule.js -├── tslint-base.json -├── tslint-config.json -└── tslint-crazy-config.js -</code></pre></div></div> - -<p>Our starting-point config file just references the directory the custom rules are in -but doesn’t enable any of them:</p> - -<p><strong>tslint-base.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"rulesDirectory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./rules"</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>We also want to provide a sane default config for our rules. -Notice how it extends our base config, so we don’t have to redeclare <code class="highlighter-rouge">rulesDirectory</code> here:</p> - -<p><strong>tslint-config.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"extends"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./tslint-base.json"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"rules"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> - </span><span class="s2">"no-errors"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> - </span><span class="s2">"no-addition"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> - </span><span class="p">}</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>Finally, we can even make a crazy config file for fun that gives you back a different config -each time you run TSLint. Notice how this is a <code class="highlighter-rouge">.js</code> file that exports an object:</p> - -<p><strong>tslint-crazy-config.js</strong></p> - -<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">{</span> - <span class="na">extends</span><span class="p">:</span> <span class="s2">"./tslint-base.json"</span><span class="p">,</span> - <span class="na">rules</span><span class="p">:</span> <span class="p">{</span> - <span class="s2">"no-excessive-commenting"</span><span class="p">:</span> <span class="p">[</span><span class="kc">true</span><span class="p">,</span> <span class="p">{</span><span class="na">maxComments</span><span class="p">:</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="mi">10</span><span class="p">}]</span> - <span class="p">}</span> -<span class="p">};</span> -</code></pre></div></div> - -<p>Finally, we have our <code class="highlighter-rouge">package.json</code> file which references our base config file through its <code class="highlighter-rouge">main</code> field:</p> - -<p><strong>package.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shared-tslint-rules"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Some TSLint rules that are great!"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"main"</span><span class="p">:</span><span class="w"> </span><span class="s2">"tslint-base.json"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"scripts"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> - </span><span class="s2">"test"</span><span class="p">:</span><span class="w"> </span><span class="s2">"echo </span><span class="se">\"</span><span class="s2">Error: no test specified</span><span class="se">\"</span><span class="s2"> &amp;&amp; exit 1"</span><span class="w"> - </span><span class="p">},</span><span class="w"> - </span><span class="s2">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> - </span><span class="s2">"license"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MIT"</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>We can publish our package on NPM to let the world use it!</p> - -<hr /> - -<p>Now let’s say we’re a user, and we want to use the custom rules above to lint our code. -First, we’ll make sure we have the necessary npm packages installed:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install -g tslint shared-tslint-rules -</code></pre></div></div> - -<p>Then, in our <code class="highlighter-rouge">tslint.json</code> file for our project, we can reference the package of custom rules with <code class="highlighter-rouge">extends</code>:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ - "extends": "shared-tslint-rules/tslint-config", - "rules": { - "no-addition": true - } -} -</code></pre></div></div> - -<p>and that’s all we have to do to use the custom rules! -We can now run TSLint as we would normally and see any lint errors produced by the custom rules:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tslint -c path/to/tslint.json my/files/**/to/lint.ts -</code></pre></div></div> - - - Thu, 31 Mar 2016 11:19:00 -0400 - http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html - http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html - - - - - - A New TSLint Website - <p>As TSLint has grown in usage and popularity alongside of TypeScript, it also has -evolved in terms of functionality and complexity. Today, all sorts of projects and products, -from <a href="https://angular.io/">Angular 2</a> to the <a href="https://github.com/Microsoft/TypeScript">TypeScript compiler itself</a> use TSLint -to help keep their code high-quality.</p> - -<p>Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. -For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long <a href="https://github.com/palantir/tslint/blob/409aa6e4aa4b63da11fd61e15b26b0100cf1e845/README.md">TSLint README</a>. -Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. -There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.</p> - -<p>This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:</p> - -<ul> - <li><a href="https://github.com/palantir/tslint/issues/830">A documentation overhaul</a> that will provide -more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.</li> - <li><a href="https://github.com/palantir/tslint/pull/871">A new <code class="highlighter-rouge">--init</code> feature</a> in the TSLint CLI that will make it easier to -generate a sensible initial <code class="highlighter-rouge">tslint.json</code> config file.</li> - <li><a href="https://github.com/palantir/tslint/issues/831">An improved contributor experience</a> that will make things easier for those who want to contribute code to TSLint.</li> -</ul> - -<p>Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!</p> - - - Thu, 10 Dec 2015 15:15:21 -0500 - http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html - http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html - - - - - - diff --git a/docs/_site/formatters/checkstyle/index.html b/docs/_site/formatters/checkstyle/index.html deleted file mode 100644 index d97cd74a7c6..00000000000 --- a/docs/_site/formatters/checkstyle/index.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - TSLint formatter: checkstyle - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: checkstyle

-

-
- - -

Formats errors as through they were Checkstyle output.

- - - -

Imitates the XMLLogger from Checkstyle 4.3. All failures have the ‘warning’ severity.

- - - -
Sample Output
-
-

<?xml version="1.0" encoding="utf-8"?> -<checkstyle version="4.3"> - <file name="myFile.ts"> - <error line="1" column="14" severity="warning" message="Missing semicolon" source="failure.tslint.semicolon" /> - </file> -</checkstyle>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/codeFrame/index.html b/docs/_site/formatters/codeFrame/index.html deleted file mode 100644 index 646aee20242..00000000000 --- a/docs/_site/formatters/codeFrame/index.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - TSLint formatter: codeFrame - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: codeFrame

-

-
- - -

Framed formatter which creates a frame of error code.

- - - -

Prints syntax highlighted code in a frame with a pointer to where -exactly lint error is happening.

- - - -
Sample Output
-
-

src/components/Payment.tsx -Parentheses are required around the parameters of an arrow function definition (arrow-parens) - 21 | public componentDidMount() { - 22 | this.input.focus(); -> 23 | loadStripe().then(Stripe => Stripe.pay()); - | ^ - 24 | } - 25 | - 26 | public render() {

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/filesList/index.html b/docs/_site/formatters/filesList/index.html deleted file mode 100644 index 7b62038c1bb..00000000000 --- a/docs/_site/formatters/filesList/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - TSLint formatter: filesList - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: filesList

-

-
- - -

Lists files containing lint errors.

- - - -
Sample Output
-

directory/myFile.ts

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/index.html b/docs/_site/formatters/index.html deleted file mode 100644 index 98e0245ee62..00000000000 --- a/docs/_site/formatters/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - TSLint core formatters - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint core formatters

-

-
- - -

Lint formatters allow for transformation of lint results into various forms before outputting to stdout or a file.

- -

Built-in formatters

- -
    -
  • -

    checkstyle - Formats errors as through they were Checkstyle output.

    -
  • -
  • -

    codeFrame - Framed formatter which creates a frame of error code.

    -
  • -
  • -

    filesList - Lists files containing lint errors.

    -
  • -
  • -

    json - Formats errors as simple JSON.

    -
  • -
  • -

    junit - Formats errors as through they were JUnit output.

    -
  • -
  • -

    msbuild - Formats errors for consumption by msbuild.

    -
  • -
  • -

    pmd - Formats errors as through they were PMD output.

    -
  • -
  • -

    prose - The default formatter which outputs simple human-readable messages.

    -
  • -
  • -

    stylish - Human-readable formatter which creates stylish messages.

    -
  • -
  • -

    tap - Formats output as TAP stream.

    -
  • -
  • -

    verbose - The human-readable formatter which includes the rule name in messages.

    -
  • -
  • -

    vso - Formats output as VSO/TFS logging commands.

    -
  • -
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/json/index.html b/docs/_site/formatters/json/index.html deleted file mode 100644 index c78ec762b77..00000000000 --- a/docs/_site/formatters/json/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - TSLint formatter: json - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: json

-

-
- - -

Formats errors as simple JSON.

- - - -
Sample Output
-
-

[ - { - "endPosition": { - "character": 13, - "line": 0, - "position": 13 - }, - "failure": "Missing semicolon", - "fix": { - "innerStart": 13, - "innerLength": 0, - "innerText": ";" - }, - "name": "myFile.ts", - "ruleName": "semicolon", - "startPosition": { - "character": 13, - "line": 0, - "position": 13 - } - } -]

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/junit/index.html b/docs/_site/formatters/junit/index.html deleted file mode 100644 index c250017c108..00000000000 --- a/docs/_site/formatters/junit/index.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - TSLint formatter: junit - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: junit

-

-
- - -

Formats errors as through they were JUnit output.

- - - -

Imitates the JUnit XML Output

- - - -
Sample Output
-
-

<?xml version="1.0" encoding="utf-8"?> -<testsuites package="tslint"> - <testsuite name="myFile.ts"> - <testcase name="Line 1, Column 14: semicolon"> - <failure type="warning">Missing semicolon</failure> - </testcase> - </testsuite> -</testsuites>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/msbuild/index.html b/docs/_site/formatters/msbuild/index.html deleted file mode 100644 index 1fd56587a41..00000000000 --- a/docs/_site/formatters/msbuild/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - TSLint formatter: msbuild - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: msbuild

-

-
- - -

Formats errors for consumption by msbuild.

- - -

The output is compatible with both msbuild and Visual Studio.

- - - -
Sample Output
-

myFile.ts(1,14): warning: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/pmd/index.html b/docs/_site/formatters/pmd/index.html deleted file mode 100644 index 1cbfa0afbd9..00000000000 --- a/docs/_site/formatters/pmd/index.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - TSLint formatter: pmd - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: pmd

-

-
- - -

Formats errors as through they were PMD output.

- - -

Imitates the XML output from PMD. All errors have a priority of 1.

- - - -
Sample Output
-
-

<pmd version="tslint"> - <file name="myFile.ts"> - <violation begincolumn="14" beginline="1" priority="3" rule="Missing semicolon"></violation> - </file> -</pmd>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/prose/index.html b/docs/_site/formatters/prose/index.html deleted file mode 100644 index 9f2f5064551..00000000000 --- a/docs/_site/formatters/prose/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - TSLint formatter: prose - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: prose

-

-
- - -

The default formatter which outputs simple human-readable messages.

- - - -
Sample Output
-

ERROR: myFile.ts[1, 14]: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/stylish/index.html b/docs/_site/formatters/stylish/index.html deleted file mode 100644 index 2a5a45e35b2..00000000000 --- a/docs/_site/formatters/stylish/index.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - TSLint formatter: stylish - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: stylish

-

-
- - -

Human-readable formatter which creates stylish messages.

- - - -

The output matches what is produced by ESLint’s stylish formatter. -Its readability is enhanced through spacing and colouring.

- - - -
Sample Output
-
-

myFile.ts -1:14 semicolon Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/tap/index.html b/docs/_site/formatters/tap/index.html deleted file mode 100644 index 2d49c37147a..00000000000 --- a/docs/_site/formatters/tap/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - TSLint formatter: tap - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: tap

-

-
- - -

Formats output as TAP stream.

- - -

Provides error messages output in TAP13 format which can be consumed by any TAP formatter.

- - - -
Sample Output
-
-

TAP version 13 -1..1 -not ok 1 - Some error - — - message: Variable has any type - severity: error - data: - ruleName: no-any - fileName: test-file.ts - line: 10 - character: 10 - failureString: Some error - rawLines: Some raw output - …

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/verbose/index.html b/docs/_site/formatters/verbose/index.html deleted file mode 100644 index e4a50b64168..00000000000 --- a/docs/_site/formatters/verbose/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - TSLint formatter: verbose - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: verbose

-

-
- - -

The human-readable formatter which includes the rule name in messages.

- - -

The output is the same as the prose formatter with the rule name included

- - - -
Sample Output
-

ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/vso/index.html b/docs/_site/formatters/vso/index.html deleted file mode 100644 index 9d75a798dd9..00000000000 --- a/docs/_site/formatters/vso/index.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - TSLint formatter: vso - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: vso

-

-
- - -

Formats output as VSO/TFS logging commands.

- - - -

Integrates with Visual Studio Online and Team Foundation Server by outputting errors -as ‘warning’ logging commands.

- - - -
Sample Output
-

##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/index.html b/docs/_site/index.html deleted file mode 100644 index 783c4e542bc..00000000000 --- a/docs/_site/index.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - TSLint - - - - - - - - - - - -
- - - - -
- - -
-

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.

- -

Quick start

- -
# Install the global CLI and its peer dependency
-yarn global add tslint typescript
-
-# Navigate to to your sources folder
-cd path/to/project
-
-# Generate a basic configuration file
-tslint --init
-
-# Lint TypeScript source globs
-tslint -c tslint.json 'src/**/*.ts'
-
- -

Check out the full usage guide to learn more.

- - - - -
- - - - diff --git a/docs/_site/news/index.html b/docs/_site/news/index.html deleted file mode 100644 index 6f757ed92e5..00000000000 --- a/docs/_site/news/index.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - News - - - - - - - - - - - -
- - -
- - -
-
-
- - - -
-

TSLint 4.0 Released

- -
-
-

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

- - - -
- -

Create your own fixer

-

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

- -

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-const fix = new Lint.Fix("no-imports", [replacement]);
-
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
- - -
- -
- - -

Also Read...

- - - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/adjacent-overload-signatures/index.html b/docs/_site/rules/adjacent-overload-signatures/index.html deleted file mode 100644 index bac8513a733..00000000000 --- a/docs/_site/rules/adjacent-overload-signatures/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: adjacent-overload-signatures - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: adjacent-overload-signatures

-

-
- - -

Enforces function overloads to be consecutive.

- - - - -
Rationale
-

Improves readability and organization by grouping naturally related items together.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"adjacent-overload-signatures": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/align/index.html b/docs/_site/rules/align/index.html deleted file mode 100644 index 4f02cdd3092..00000000000 --- a/docs/_site/rules/align/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - Rule: align - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: align

-

-
- - -

Enforces vertical alignment.

- - - - -
Rationale
-

Helps maintain a readable, consistent style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "parameters" checks alignment of function parameters.
  • -
  • "arguments" checks alignment of function call arguments.
  • -
  • "statements" checks alignment of statements.
  • -
  • "members" checks alignment of members of classes, interfaces, type literal, object literals and -object destructuring.
  • -
  • "elements" checks alignment of elements of array iterals, array destructuring and tuple types.
  • -
- - -
Config examples
- -
-"align": [true, "parameters", "statements"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "arguments",
-      "elements",
-      "members",
-      "parameters",
-      "statements"
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/array-type/index.html b/docs/_site/rules/array-type/index.html deleted file mode 100644 index d4a3ee2a3bf..00000000000 --- a/docs/_site/rules/array-type/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: array-type - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: array-type

-

-
- - -

Requires using either ‘T[]’ or ‘Array' for arrays.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • "array" enforces use of T[] for all types T.
  • -
  • "generic" enforces use of Array<T> for all types T.
  • -
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
  • -
- - -
Config examples
- -
-"array-type": [true, "array"]
-
- -
-"array-type": [true, "generic"]
-
- -
-"array-type": [true, "array-simple"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "array",
-    "generic",
-    "array-simple"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/arrow-parens/index.html b/docs/_site/rules/arrow-parens/index.html deleted file mode 100644 index d3a3ac56769..00000000000 --- a/docs/_site/rules/arrow-parens/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - Rule: arrow-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: arrow-parens

-

-
- - -

Requires parentheses around the parameters of arrow function definitions.

- - - - -
Rationale
-

Maintains stylistic consistency with other arrow function definitions.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If ban-single-arg-parens is specified, then arrow functions with one parameter -must not have parentheses if removing them is allowed by TypeScript.

- - -
Config examples
- -
-"arrow-parens": true
-
- -
-"arrow-parens": [true, "ban-single-arg-parens"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ban-single-arg-parens"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/arrow-return-shorthand/index.html b/docs/_site/rules/arrow-return-shorthand/index.html deleted file mode 100644 index 6dacef1b99b..00000000000 --- a/docs/_site/rules/arrow-return-shorthand/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: arrow-return-shorthand - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: arrow-return-shorthand

-

-
- - -

Suggests to convert () => { return x; } to () => x.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If multiline is specified, then this will warn even if the function spans multiple lines.

- - -
Config examples
- -
-"arrow-return-shorthand": true
-
- -
-"arrow-return-shorthand": [true, "multiline"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "multiline"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/await-promise/index.html b/docs/_site/rules/await-promise/index.html deleted file mode 100644 index d1a701b8ed7..00000000000 --- a/docs/_site/rules/await-promise/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - Rule: await-promise - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: await-promise

-

-
- - -

Warns for an awaited value that is not a Promise.

- - - - -
Rationale
- -

While it is valid TypeScript to await a non-Promise-like value (it will resolve immediately), -this pattern is often a programmer error and the resulting semantics can be unintuitive.

- - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

A list of ‘string’ names of any additional classes that should also be treated as Promises. -For example, if you are using a class called ‘Future’ that implements the Thenable interface, -you might tell the rule to consider type references with the name ‘Future’ as valid Promise-like -types. Note that this rule doesn’t check for type assignability or compatibility; it just checks -type reference names.

- - - -
Config examples
- -
-"await-promise": true
-
- -
-"await-promise": [true, "Thenable"]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban-comma-operator/index.html b/docs/_site/rules/ban-comma-operator/index.html deleted file mode 100644 index d5d006d0c53..00000000000 --- a/docs/_site/rules/ban-comma-operator/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: ban-comma-operator - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban-comma-operator

-

-
- - -

Disallows the comma operator to be used.

- - -

Read more about the comma operator here.

- - - - -
Rationale
- -

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

- -

Examples

-
foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
-
- -
switch (foo) {
-    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
-        return true;
-    case 3:
-        return false;
-}
-
- -
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
-
- - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- - - -
Config examples
- -
-"ban-comma-operator": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban-types/index.html b/docs/_site/rules/ban-types/index.html deleted file mode 100644 index e59fdf5938f..00000000000 --- a/docs/_site/rules/ban-types/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - Rule: ban-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban-types

-

-
- - - -

Bans specific types from being used. Does not ban the -corresponding runtime objects from being used.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

A list of ["regex", "optional explanation here"], which bans -types that match regex

- - -
Config examples
- -
-"ban-types": [true, ["Object", "Use {} instead."], ["String"]]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    },
-    "minLength": 1,
-    "maxLength": 2
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban/index.html b/docs/_site/rules/ban/index.html deleted file mode 100644 index e47ac88aa1d..00000000000 --- a/docs/_site/rules/ban/index.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - Rule: ban - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban

-

-
- - -

Bans the use of specific functions or global methods.

- - - - - - - -

Config

- -

A list of banned functions or methods in the following format:

- -
    -
  • banning functions: -
      -
    • just the name of the function: "functionName"
    • -
    • the name of the function in an array with one element: ["functionName"]
    • -
    • an object in the following format: {"name": "functionName", "message": "optional explanation message"}
    • -
    -
  • -
  • banning methods: -
      -
    • an array with the object name, method name and optional message: ["functionName", "methodName", "optional message"]
    • -
    • an object in the following format: {"name": ["objectName", "methodName"], "message": "optional message"} -
        -
      • you can also ban deeply nested methods: {"name": ["foo", "bar", "baz"]} bans foo.bar.baz()
      • -
      • the first element can contain a wildcard (*) that matches everything. {"name": ["*", "forEach"]} bans [].forEach(...), $(...).forEach(...), arr.forEach(...), etc.
      • -
      -
    • -
    -
  • -
- - -
Config examples
- -
-"ban": [
-  true,
-  "eval",
-  {"name": "$", "message": "please don't"},
-  ["describe", "only"],
-  {"name": ["it", "only"], "message": "don't focus tests"},
-  {
-    "name": ["chai", "assert", "equal"],
-    "message": "Use 'strictEqual' instead."
-  },
-  {"name": ["*", "forEach"], "message": "Use a regular for loop instead."}
-]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "anyOf": [
-      {
-        "type": "string"
-      },
-      {
-        "type": "array",
-        "items": {
-          "type": "string"
-        },
-        "minLength": 1,
-        "maxLength": 3
-      },
-      {
-        "type": "object",
-        "properties": {
-          "name": {
-            "anyOf": [
-              {
-                "type": "string"
-              },
-              {
-                "type": "array",
-                "items": {
-                  "type": "string"
-                },
-                "minLength": 1
-              }
-            ]
-          },
-          "message": {
-            "type": "string"
-          }
-        },
-        "required": [
-          "name"
-        ]
-      }
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/binary-expression-operand-order/index.html b/docs/_site/rules/binary-expression-operand-order/index.html deleted file mode 100644 index c47cfd681c5..00000000000 --- a/docs/_site/rules/binary-expression-operand-order/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: binary-expression-operand-order - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: binary-expression-operand-order

-

-
- - - -

In a binary expression, a literal should always be on the right-hand side if possible. -For example, prefer ‘x + 1’ over ‘1 + x’.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"binary-expression-operand-order": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/callable-types/index.html b/docs/_site/rules/callable-types/index.html deleted file mode 100644 index 939ef40dffe..00000000000 --- a/docs/_site/rules/callable-types/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: callable-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: callable-types

-

-
- - -

An interface or literal type with just a call signature can be written as a function type.

- - - - -
Rationale
-

style

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/class-name/index.html b/docs/_site/rules/class-name/index.html deleted file mode 100644 index a7b3db2ee23..00000000000 --- a/docs/_site/rules/class-name/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: class-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: class-name

-

-
- - -

Enforces PascalCased class and interface names.

- - - - -
Rationale
-

Makes it easy to differentiate classes from regular variables at a glance.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"class-name": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/comment-format/index.html b/docs/_site/rules/comment-format/index.html deleted file mode 100644 index 4b8e4d9bea6..00000000000 --- a/docs/_site/rules/comment-format/index.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - Rule: comment-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: comment-format

-

-
- - -

Enforces formatting rules for single-line comments.

- - - - -
Rationale
-

Helps maintain a consistent, readable style in your codebase.

- - - - - -

Config

- -

Three arguments may be optionally provided:

- -
    -
  • "check-space" requires that all single-line comments must begin with a space, as in // comment -
      -
    • note that for comments starting with multiple slashes, e.g. ///, leading slashes are ignored
    • -
    • TypeScript reference comments are ignored completely
    • -
    -
  • -
  • "check-lowercase" requires that the first non-whitespace character of a comment must be lowercase, if applicable.
  • -
  • "check-uppercase" requires that the first non-whitespace character of a comment must be uppercase, if applicable.
  • -
- -

Exceptions to "check-lowercase" or "check-uppercase" can be managed with object that may be passed as last argument.

- -

One of two options can be provided in this object:

- -
* `"ignore-words"`  - array of strings - words that will be ignored at the beginning of the comment.
-* `"ignore-pattern"` - string - RegExp pattern that will be ignored at the beginning of the comment.
-
- - -
Config examples
- -
-"comment-format": [true, "check-space", "check-uppercase"]
-
- -
-"comment-format": [true, "check-lowercase", {"ignore-words": ["TODO", "HACK"]}]
-
- -
-"comment-format": [true, "check-lowercase", {"ignore-pattern": "STD\\w{2,3}\\b"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "anyOf": [
-      {
-        "type": "string",
-        "enum": [
-          "check-space",
-          "check-lowercase",
-          "check-uppercase"
-        ]
-      },
-      {
-        "type": "object",
-        "properties": {
-          "ignore-words": {
-            "type": "array",
-            "items": {
-              "type": "string"
-            }
-          },
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "minProperties": 1,
-        "maxProperties": 1
-      }
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 4
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/completed-docs/index.html b/docs/_site/rules/completed-docs/index.html deleted file mode 100644 index f2482b31f7b..00000000000 --- a/docs/_site/rules/completed-docs/index.html +++ /dev/null @@ -1,553 +0,0 @@ - - - - - - - - - Rule: completed-docs - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: completed-docs

-

-
- - -

Enforces documentation for important items be filled out.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- -

true to enable for [classes, functions, methods, properties]], -or an array with each item in one of two formats:

- -
    -
  • string to enable for that type
  • -
  • object keying types to when their documentation is required: -
      -
    • "methods" and "properties" may specify: -
        -
      • "privacies": -
          -
        • "all"
        • -
        • "private"
        • -
        • "protected"
        • -
        • "public"
        • -
        -
      • -
      • "locations": -
          -
        • "all"
        • -
        • "instance"
        • -
        • "static"
        • -
        -
      • -
      -
    • -
    • Other types may specify "visibilities": -
        -
      • "all"
      • -
      • "exported"
      • -
      • "internal"
      • -
      -
    • -
    • All types may also provide "tags" -with members specifying tags that allow the docs to not have a body. -
        -
      • "content": Object mapping tags to RegExp bodies content allowed to count as complete docs.
      • -
      • "existence": Array of tags that must only exist to count as complete docs.
      • -
      -
    • -
    -
  • -
- -

Types that may be enabled are:

- -
    -
  • "classes"
  • -
  • "enums"
  • -
  • "enum-members"
  • -
  • "functions"
  • -
  • "interfaces"
  • -
  • "methods"
  • -
  • "namespaces"
  • -
  • "properties"
  • -
  • "types"
  • -
  • "variables"
  • -
- - -
Config examples
- -
-"completed-docs": true
-
- -
-"completed-docs": [true, "enums", "functions", "methods"]
-
- -
-"completed-docs": [
-  true,
-  {
-    "enums": true,
-    "functions": {"visibilities": ["exported"]},
-    "methods": {"locations": "instance", "privacies": ["public", "protected"]},
-    "tags": {"content": {"see": ["#.*"]}, "existence": ["inheritdoc"]}
-  }
-]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "anyOf": [
-      {
-        "options": [
-          "classes",
-          "enums",
-          "functions",
-          "interfaces",
-          "methods",
-          "namespaces",
-          "properties",
-          "types",
-          "variables"
-        ],
-        "type": "string"
-      },
-      {
-        "type": "object",
-        "properties": {
-          "classes": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "enums": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "enum-members": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "functions": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "interfaces": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "methods": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "locations": {
-                "enum": [
-                  "all",
-                  "instance",
-                  "static"
-                ],
-                "type": "string"
-              },
-              "privacies": {
-                "enum": [
-                  "all",
-                  "private",
-                  "protected",
-                  "public"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "namespaces": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "properties": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "locations": {
-                "enum": [
-                  "all",
-                  "instance",
-                  "static"
-                ],
-                "type": "string"
-              },
-              "privacies": {
-                "enum": [
-                  "all",
-                  "private",
-                  "protected",
-                  "public"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "types": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "variables": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          }
-        }
-      }
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/curly/index.html b/docs/_site/rules/curly/index.html deleted file mode 100644 index 25253cf1293..00000000000 --- a/docs/_site/rules/curly/index.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - Rule: curly - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: curly

-

-
- - -

Enforces braces for if/for/do/while statements.

- - - - -
Rationale
- -
if (foo === bar)
-    foo++;
-    bar++;
-
- -

In the code above, the author almost certainly meant for both foo++ and bar++ -to be executed only if foo === bar. However, they forgot braces and bar++ will be executed -no matter what. This rule could prevent such a mistake.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following options may be provided:

- -
    -
  • "as-needed" forbids any unnecessary curly braces.
  • -
  • "ignore-same-line" skips checking braces for control-flow statements -that are on one line and start on the same line as their control-flow keyword
  • -
- - - -
Config examples
- -
-"curly": true
-
- -
-"curly": [true, "ignore-same-line"]
-
- -
-"curly": [true, "as-needed"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "as-needed",
-      "ignore-same-line"
-    ]
-  }
-}
-
- - -

Code examples:

- -
-
Require curly braces whenever possible (default)
-
"rules": { "curly": true }
-
- -
Passes
-
-
if (x > 0) {
-    doStuff();
-}
-
- -
- -
Fails
-
-
if (x > 0)
-    doStuff();
-
-if (x > 0) doStuff();
-
- -
- -
- -
-
Make an exception for single-line instances
-
"rules": { "curly": [true, "ignore-same-line"] }
-
- -
Passes
-
-
if (x > 0) doStuff();
-
- -
- -
Fails
-
-
if (x > 0)
-    doStuff()
-
- -
- -
- -
-
Error on unnecessary curly braces
-
"rules": { "curly": [true, "as-needed"] }
-
- -
Passes
-
-
if (x > 0)
-    doStuff();
-
-if (x > 0) {
-    customerUpdates.push(getInfo(customerId));
-    return customerUpdates;
-}
-
- -
- -
Fails
-
-
if (x > 0) {
-    doStuff();
-}
-
- -
- -
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/cyclomatic-complexity/index.html b/docs/_site/rules/cyclomatic-complexity/index.html deleted file mode 100644 index 1d6423fdb9e..00000000000 --- a/docs/_site/rules/cyclomatic-complexity/index.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - Rule: cyclomatic-complexity - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: cyclomatic-complexity

-

-
- - -

Enforces a threshold of cyclomatic complexity.

- - - -

Cyclomatic complexity is assessed for each function of any type. A starting value of 0 -is assigned and this value is then incremented for every statement which can branch the -control flow within the function. The following statements and expressions contribute -to cyclomatic complexity:

-
    -
  • catch
  • -
  • if and ? :
  • -
  • || and && due to short-circuit evaluation
  • -
  • for, for in and for of loops
  • -
  • while and do while loops
  • -
  • case clauses that contain statements
  • -
- - - - -
Rationale
- -

Cyclomatic complexity is a code metric which indicates the level of complexity in a -function. High cyclomatic complexity indicates confusing code which may be prone to -errors or difficult to modify.

- - - - - -

Config

- -

An optional upper limit for cyclomatic complexity can be specified. If no limit option -is provided a default value of 20 will be used.

- - -
Config examples
- -
-"cyclomatic-complexity": true
-
- -
-"cyclomatic-complexity": [true, 20]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/deprecation/index.html b/docs/_site/rules/deprecation/index.html deleted file mode 100644 index 6b290335b9a..00000000000 --- a/docs/_site/rules/deprecation/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: deprecation - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: deprecation

-

-
- - -

Warns when deprecated APIs are used.

- - -

Any usage of an identifier - with the @deprecated JSDoc annotation will trigger a warning. - See http://usejsdoc.org/tags-deprecated.html

- - - - -
Rationale
-

Deprecated APIs should be avoided, and usage updated.

- - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- - - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/encoding/index.html b/docs/_site/rules/encoding/index.html deleted file mode 100644 index d0613e55711..00000000000 --- a/docs/_site/rules/encoding/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: encoding - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: encoding

-

-
- - -

Enforces UTF-8 file encoding.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"encoding": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/eofline/index.html b/docs/_site/rules/eofline/index.html deleted file mode 100644 index 51b2108440c..00000000000 --- a/docs/_site/rules/eofline/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - Rule: eofline - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: eofline

-

-
- - -

Ensures the file ends with a newline.

- - -

Fix for single-line files is not supported.

- - - - -
Rationale
-

It is a standard convention to end files with a newline.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"eofline": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/file-header/index.html b/docs/_site/rules/file-header/index.html deleted file mode 100644 index b4710fc3412..00000000000 --- a/docs/_site/rules/file-header/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: file-header - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: file-header

-

-
- - -

Enforces a certain header comment for all files, matched by a regular expression.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

The first option, which is mandatory, is a regular expression that all headers should match. -The second argument, which is optional, is a string that should be inserted as a header comment -if fixing is enabled and no header that matches the first argument is found.

- - -
Config examples
- -
-"file-header": [true, "Copyright \\d{4}", "Copyright 2017"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string"
-    },
-    {
-      "type": "string"
-    }
-  ],
-  "additionalItems": false,
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/forin/index.html b/docs/_site/rules/forin/index.html deleted file mode 100644 index 1f122885be1..00000000000 --- a/docs/_site/rules/forin/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: forin - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: forin

-

-
- - -

Requires a for ... in statement to be filtered with an if statement.

- - - - -
Rationale
- -
for (let key in someObject) {
-    if (someObject.hasOwnProperty(key)) {
-        // code here
-    }
-}
-
-

Prevents accidental iteration over properties inherited from an object’s prototype. -See MDN’s for...in -documentation for more information about for...in loops.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"forin": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/import-blacklist/index.html b/docs/_site/rules/import-blacklist/index.html deleted file mode 100644 index 7d2743b197b..00000000000 --- a/docs/_site/rules/import-blacklist/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: import-blacklist - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: import-blacklist

-

-
- - - -

Disallows importing the specified modules directly via import and require. -Instead only sub modules may be imported from that module.

- - - - -
Rationale
- -

Some libraries allow importing their submodules instead of the entire module. -This is good practise as it avoids loading unused modules.

- - - - - -

Config

-

A list of blacklisted modules.

- - -
Config examples
- -
-"import-blacklist": true
-
- -
-"import-blacklist": [true, "rxjs", "lodash"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  },
-  "minLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/import-spacing/index.html b/docs/_site/rules/import-spacing/index.html deleted file mode 100644 index 8d712d11753..00000000000 --- a/docs/_site/rules/import-spacing/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: import-spacing - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: import-spacing

-

-
- - -

Ensures proper spacing between import statement keywords

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"import-spacing": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/indent/index.html b/docs/_site/rules/indent/index.html deleted file mode 100644 index b65104e5a91..00000000000 --- a/docs/_site/rules/indent/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - Rule: indent - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: indent

-

-
- - -

Enforces indentation with tabs or spaces.

- - - - -
Rationale
- -

Using only one of tabs or spaces for indentation leads to more consistent editor behavior, -cleaner diffs in version control, and easier programmatic manipulation.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • spaces enforces consistent spaces.
  • -
  • tabs enforces consistent tabs.
  • -
- -

A second optional argument specifies indentation size:

- -
    -
  • 2 enforces 2 space indentation.
  • -
  • 4 enforces 4 space indentation.
  • -
- -

Indentation size is required for auto-fixing, but not for rule checking.

- -

NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

- - -
Config examples
- -
-"indent": [true, "spaces"]
-
- -
-"indent": [true, "spaces", 4]
-
- -
-"indent": [true, "tabs", 2]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string",
-      "enum": [
-        "tabs",
-        "spaces"
-      ]
-    },
-    {
-      "type": "number",
-      "enum": [
-        2,
-        4
-      ]
-    }
-  ],
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/index.html b/docs/_site/rules/index.html deleted file mode 100644 index 1404635d114..00000000000 --- a/docs/_site/rules/index.html +++ /dev/null @@ -1,2129 +0,0 @@ - - - - - - - - - TSLint core rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint core rules

-

-
- - -

Lint rules encode logic for syntactic & semantic checks of TypeScript source code.

- -

TypeScript-specific

- -

These rules find errors related to TypeScript features:

- - - -

Functionality

- -

These rules catch common errors in JS programming or otherwise confusing constructs that are prone to producing bugs:

- - - -

Maintainability

- -

These rules make code maintenance easier:

- - - -

Style

- -

These rules enforce consistent style across your codebase:

- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/interface-name/index.html b/docs/_site/rules/interface-name/index.html deleted file mode 100644 index 924f15b4961..00000000000 --- a/docs/_site/rules/interface-name/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - Rule: interface-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: interface-name

-

-
- - -

Requires interface names to begin with a capital ‘I’

- - - - -
Rationale
-

Makes it easy to differentiate interfaces from regular classes at a glance.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

One of the following two options must be provided:

- -
    -
  • "always-prefix" requires interface names to start with an “I”
  • -
  • "never-prefix" requires interface names to not have an “I” prefix
  • -
- - -
Config examples
- -
-"interface-name": [true, "always-prefix"]
-
- -
-"interface-name": [true, "never-prefix"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always-prefix",
-    "never-prefix"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/interface-over-type-literal/index.html b/docs/_site/rules/interface-over-type-literal/index.html deleted file mode 100644 index 68ef94ccc0e..00000000000 --- a/docs/_site/rules/interface-over-type-literal/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: interface-over-type-literal - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: interface-over-type-literal

-

-
- - -

Prefer an interface declaration over a type literal (type T = { ... })

- - - - -
Rationale
-

Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"interface-over-type-literal": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/jsdoc-format/index.html b/docs/_site/rules/jsdoc-format/index.html deleted file mode 100644 index efbb195d859..00000000000 --- a/docs/_site/rules/jsdoc-format/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: jsdoc-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: jsdoc-format

-

-
- - -

Enforces basic format rules for JSDoc comments.

- - - -

The following rules are enforced for JSDoc comments (comments starting with /**):

- -
    -
  • each line contains an asterisk and asterisks must be aligned
  • -
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • -
  • the only characters before the asterisk on each line must be whitespace characters
  • -
  • one line comments must start with /** and end with */
  • -
  • multiline comments don’t allow text after /** in the first line (with option "check-multiline-start")
  • -
- - - - - -
Rationale
-

Helps maintain a consistent, readable style for JSDoc comments.

- - - - - -

Config

- -

You can optionally specify the option "check-multiline-start" to enforce the first line of a -multiline JSDoc comment to be empty.

- - - -
Config examples
- -
-"jsdoc-format": true
-
- -
-"jsdoc-format": [true, "check-multiline-start"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "minItems": 0,
-  "maxItems": 1,
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-multiline-start"
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/label-position/index.html b/docs/_site/rules/label-position/index.html deleted file mode 100644 index e46696204ce..00000000000 --- a/docs/_site/rules/label-position/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: label-position - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: label-position

-

-
- - -

Only allows labels in sensible locations.

- - -

This rule only allows labels to be on do/for/while/switch statements.

- - - - -
Rationale
- -

Labels in JavaScript only can be used in conjunction with break or continue, -constructs meant to be used for loop flow control. While you can theoretically use -labels on any block statement in JS, it is considered poor code structure to do so.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"label-position": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/linebreak-style/index.html b/docs/_site/rules/linebreak-style/index.html deleted file mode 100644 index f597372c0a1..00000000000 --- a/docs/_site/rules/linebreak-style/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: linebreak-style - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: linebreak-style

-

-
- - -

Enforces a consistent linebreak style.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following options must be provided:

- -
    -
  • "LF" requires LF (\n) linebreaks
  • -
  • "CRLF" requires CRLF (\r\n) linebreaks
  • -
- - -
Config examples
- -
-"linebreak-style": [true, "LF"]
-
- -
-"linebreak-style": [true, "CRLF"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "LF",
-    "CRLF"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/match-default-export-name/index.html b/docs/_site/rules/match-default-export-name/index.html deleted file mode 100644 index 4c91ce493c2..00000000000 --- a/docs/_site/rules/match-default-export-name/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: match-default-export-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: match-default-export-name

-

-
- - - -

Requires that a default import have the same name as the declaration it imports. -Does nothing for anonymous default exports.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"match-default-export-name": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-classes-per-file/index.html b/docs/_site/rules/max-classes-per-file/index.html deleted file mode 100644 index 69ab82fb2e0..00000000000 --- a/docs/_site/rules/max-classes-per-file/index.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - Rule: max-classes-per-file - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-classes-per-file

-

-
- - - -

A file may not contain more than the specified number of classes

- - - - -
Rationale
- -

Ensures that files have a single responsibility so that that classes each exist in their own files

- - - - - -

Config

- -

The one required argument is an integer indicating the maximum number of classes that can appear in a -file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions -from the overall class count.

- - -
Config examples
- -
-"max-classes-per-file": [true, 1]
-
- -
-"max-classes-per-file": [true, 5, "exclude-class-expressions"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "number",
-      "minimum": 1
-    },
-    {
-      "type": "string",
-      "enum": [
-        "exclude-class-expressions"
-      ]
-    }
-  ],
-  "additionalItems": false,
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-file-line-count/index.html b/docs/_site/rules/max-file-line-count/index.html deleted file mode 100644 index 562c9284102..00000000000 --- a/docs/_site/rules/max-file-line-count/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: max-file-line-count - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-file-line-count

-

-
- - -

Requires files to remain under a certain number of lines

- - - - -
Rationale
- -

Limiting the number of lines allowed in a file allows files to remain small, -single purpose, and maintainable.

- - - - - -

Config

-

An integer indicating the maximum number of lines.

- - -
Config examples
- -
-"max-file-line-count": [true, 300]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": "1"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-line-length/index.html b/docs/_site/rules/max-line-length/index.html deleted file mode 100644 index 2f3b787f5df..00000000000 --- a/docs/_site/rules/max-line-length/index.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - Rule: max-line-length - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-line-length

-

-
- - -

Requires lines to be under a certain max length.

- - - - -
Rationale
- -

Limiting the length of a line of code improves code readability. -It also makes comparing code side-by-side easier and improves compatibility with -various editors, IDEs, and diff viewers.

- - - - - -

Config

- -

It can take one argument, which can be any of the following:

-
    -
  • integer indicating maximum length of lines.
  • -
  • object with keys: -
      -
    • limit - number < 0 defining max line length
    • -
    • ignore-pattern - string defining ignore pattern for this rule, being parsed by new RegExp(). -For example: -
        -
      • // pattern will ignore all in-line comments.
      • -
      • ^import pattern will ignore all import statements.
      • -
      • ^export {(.*?)} pattern will ignore all multiple export statements.
      • -
      • class [a-zA-Z] implements pattern will ignore all class declarations implementing interfaces.
      • -
      • ^import |^export {(.*?)}|class [a-zA-Z] implements |// pattern will ignore all the cases listed above.
      • -
      -
    • -
    -
  • -
- - - -
Config examples
- -
-"max-line-length": [true, 120]
-
- -
-"max-line-length": [true, {"limit": 120, "ignore-pattern": "^import |^export {(.*?)}"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "oneOf": [
-      {
-        "type": "number"
-      },
-      {
-        "type": "object",
-        "properties": {
-          "limit": {
-            "type": "number"
-          },
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "additionalProperties": false
-      }
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/member-access/index.html b/docs/_site/rules/member-access/index.html deleted file mode 100644 index d6a99a3913d..00000000000 --- a/docs/_site/rules/member-access/index.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - Rule: member-access - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: member-access

-

-
- - -

Requires explicit visibility declarations for class members.

- - - - -
Rationale
-

Explicit visibility declarations can make code more readable and accessible for those new to TS.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

These arguments may be optionally provided:

- -
    -
  • "no-public" forbids public accessibility to be specified, because this is the default.
  • -
  • "check-accessor" enforces explicit visibility on get/set accessors
  • -
  • "check-constructor" enforces explicit visibility on constructors
  • -
  • "check-parameter-property" enforces explicit visibility on parameter properties
  • -
- - -
Config examples
- -
-"member-access": true
-
- -
-"member-access": [true, "no-public"]
-
- -
-"member-access": [true, "check-accessor"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "no-public",
-      "check-accessor",
-      "check-constructor",
-      "check-parameter-property"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 4
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/member-ordering/index.html b/docs/_site/rules/member-ordering/index.html deleted file mode 100644 index 1ecb56d9037..00000000000 --- a/docs/_site/rules/member-ordering/index.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - Rule: member-ordering - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: member-ordering

-

-
- - -

Enforces member ordering.

- - - - -
Rationale
-

A consistent ordering for class members can make classes easier to read, navigate, and edit.

- - - - - -

Config

- -

One argument, which is an object, must be provided. It should contain an order property. -The order property should have a value of one of the following strings:

- -
    -
  • fields-first
  • -
  • instance-sandwich
  • -
  • statics-first
  • -
- -

Alternatively, the value for order maybe be an array consisting of the following strings:

- -
    -
  • public-static-field
  • -
  • public-static-method
  • -
  • protected-static-field
  • -
  • protected-static-method
  • -
  • private-static-field
  • -
  • private-static-method
  • -
  • public-instance-field
  • -
  • protected-instance-field
  • -
  • private-instance-field
  • -
  • public-constructor
  • -
  • protected-constructor
  • -
  • private-constructor
  • -
  • public-instance-method
  • -
  • protected-instance-method
  • -
  • private-instance-method
  • -
- -

You can also omit the access modifier to refer to “public-“, “protected-“, and “private-“ all at once; for example, “static-field”.

- -

You can also make your own categories by using an object instead of a string:

- -
{
-    "name": "static non-private",
-    "kinds": [
-        "public-static-field",
-        "protected-static-field",
-        "public-static-method",
-        "protected-static-method"
-    ]
-}
-
- -

The ‘alphabetize’ option will enforce that members within the same category should be alphabetically sorted by name.

- - -
Config examples
- -
-"member-ordering": [true, {"order": "fields-first"}]
-
- -
-"member-ordering": [
-  true,
-  {
-    "order": [
-      "public-static-field",
-      "public-instance-field",
-      "public-constructor",
-      "private-static-field",
-      "private-instance-field",
-      "private-constructor",
-      "public-instance-method",
-      "protected-instance-method",
-      "private-instance-method"
-    ]
-  }
-]
-
- -
-"member-ordering": [
-  true,
-  {
-    "order": [
-      {
-        "name": "static non-private",
-        "kinds": [
-          "public-static-field",
-          "protected-static-field",
-          "public-static-method",
-          "protected-static-method"
-        ]
-      },
-      "constructor"
-    ]
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "order": {
-      "oneOf": [
-        {
-          "type": "string",
-          "enum": [
-            "fields-first",
-            "instance-sandwich",
-            "statics-first"
-          ]
-        },
-        {
-          "type": "array",
-          "items": {
-            "type": "string",
-            "enum": [
-              "public-static-field",
-              "public-static-method",
-              "protected-static-field",
-              "protected-static-method",
-              "private-static-field",
-              "private-static-method",
-              "public-instance-field",
-              "protected-instance-field",
-              "private-instance-field",
-              "public-constructor",
-              "protected-constructor",
-              "private-constructor",
-              "public-instance-method",
-              "protected-instance-method",
-              "private-instance-method"
-            ]
-          },
-          "maxLength": 13
-        }
-      ]
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/new-parens/index.html b/docs/_site/rules/new-parens/index.html deleted file mode 100644 index d35725f0c0e..00000000000 --- a/docs/_site/rules/new-parens/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: new-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: new-parens

-

-
- - -

Requires parentheses when invoking a constructor via the new keyword.

- - - - -
Rationale
-

Maintains stylistic consistency with other function calls.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"new-parens": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/newline-before-return/index.html b/docs/_site/rules/newline-before-return/index.html deleted file mode 100644 index 32cda592847..00000000000 --- a/docs/_site/rules/newline-before-return/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: newline-before-return - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: newline-before-return

-

-
- - -

Enforces blank line before return when not the only line in the block.

- - - - -
Rationale
-

Helps maintain a readable style in your codebase.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"newline-before-return": true
-
- - -
Schema
-
-{}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/newline-per-chained-call/index.html b/docs/_site/rules/newline-per-chained-call/index.html deleted file mode 100644 index d01b1ed0ebd..00000000000 --- a/docs/_site/rules/newline-per-chained-call/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: newline-per-chained-call - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: newline-per-chained-call

-

-
- - - -

Requires that chained method calls be broken apart onto separate lines.

- - - - -
Rationale
- -

This style helps to keep code ‘vertical’, avoiding the need for side-scrolling in IDEs or text editors.

- - - - - -

Config

-

Not configurable

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-angle-bracket-type-assertion/index.html b/docs/_site/rules/no-angle-bracket-type-assertion/index.html deleted file mode 100644 index 9d51974a0ce..00000000000 --- a/docs/_site/rules/no-angle-bracket-type-assertion/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-angle-bracket-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-angle-bracket-type-assertion

-

-
- - -

Requires the use of as Type for type assertions instead of <Type>.

- - - - -
Rationale
- -

Both formats of type assertions have the same effect, but only as type assertions -work in .tsx files. This rule ensures that you have a consistent type assertion style -across your codebase.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-angle-bracket-type-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-any/index.html b/docs/_site/rules/no-any/index.html deleted file mode 100644 index 83d82049eba..00000000000 --- a/docs/_site/rules/no-any/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-any - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-any

-

-
- - -

Disallows usages of any as a type declaration.

- - - - -
Rationale
-

Using any as a type declaration nullifies the compile-time benefits of the type system.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-any": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-arg/index.html b/docs/_site/rules/no-arg/index.html deleted file mode 100644 index 6243eaa30c3..00000000000 --- a/docs/_site/rules/no-arg/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-arg - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-arg

-

-
- - -

Disallows use of arguments.callee.

- - - - -
Rationale
- -

Using arguments.callee makes various performance optimizations impossible. -See MDN -for more details on why to avoid arguments.callee.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-arg": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-bitwise/index.html b/docs/_site/rules/no-bitwise/index.html deleted file mode 100644 index 27022219ed5..00000000000 --- a/docs/_site/rules/no-bitwise/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: no-bitwise - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-bitwise

-

-
- - -

Disallows bitwise operators.

- - - -

Specifically, the following bitwise operators are banned: -&, &=, |, |=, -^, ^=, <<, <<=, ->>, >>=, >>>, >>>=, and ~. -This rule does not ban the use of & and | for intersection and union types.

- - - - -
Rationale
- -

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. -They also can be an indicator of overly clever code which decreases maintainability.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-bitwise": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-boolean-literal-compare/index.html b/docs/_site/rules/no-boolean-literal-compare/index.html deleted file mode 100644 index 2e6c26a7fd0..00000000000 --- a/docs/_site/rules/no-boolean-literal-compare/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-boolean-literal-compare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-boolean-literal-compare

-

-
- - -

Warns on comparison to a boolean literal, as in x === true.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-boolean-literal-compare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-conditional-assignment/index.html b/docs/_site/rules/no-conditional-assignment/index.html deleted file mode 100644 index 4e53b57141e..00000000000 --- a/docs/_site/rules/no-conditional-assignment/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-conditional-assignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-conditional-assignment

-

-
- - -

Disallows any type of assignment in conditionals.

- - -

This applies to do-while, for, if, and while statements and conditional (ternary) expressions.

- - - - -
Rationale
- -

Assignments in conditionals are often typos: -for example if (var1 = var2) instead of if (var1 == var2). -They also can be an indicator of overly clever code which decreases maintainability.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-conditional-assignment": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-consecutive-blank-lines/index.html b/docs/_site/rules/no-consecutive-blank-lines/index.html deleted file mode 100644 index 2c1a526b122..00000000000 --- a/docs/_site/rules/no-consecutive-blank-lines/index.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Rule: no-consecutive-blank-lines - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-consecutive-blank-lines

-

-
- - -

Disallows one or more blank lines in a row.

- - - - -
Rationale
-

Helps maintain a readable style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

An optional number of maximum allowed sequential blanks can be specified. If no value -is provided, a default of 1 will be used.

- - -
Config examples
- -
-"no-consecutive-blank-lines": true
-
- -
-"no-consecutive-blank-lines": [true, 2]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": "1"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-console/index.html b/docs/_site/rules/no-console/index.html deleted file mode 100644 index d492a144d4f..00000000000 --- a/docs/_site/rules/no-console/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-console - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-console

-

-
- - -

Bans the use of specified console methods.

- - - - -
Rationale
-

In general, console methods aren’t appropriate for production code.

- - - - - -

Config

-

A list of method names to ban. If no method names are provided, all console methods are banned.

- - -
Config examples
- -
-"no-console": [true, "log", "error"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-construct/index.html b/docs/_site/rules/no-construct/index.html deleted file mode 100644 index 0a3bffd6d41..00000000000 --- a/docs/_site/rules/no-construct/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-construct - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-construct

-

-
- - -

Disallows access to the constructors of String, Number, and Boolean.

- - -

Disallows constructor use such as new Number(foo) but does not disallow Number(foo).

- - - - -
Rationale
- -

There is little reason to use String, Number, or Boolean as constructors. -In almost all cases, the regular function-call version is more appropriate. -More details are available on StackOverflow.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-construct": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-debugger/index.html b/docs/_site/rules/no-debugger/index.html deleted file mode 100644 index d91a7c8195b..00000000000 --- a/docs/_site/rules/no-debugger/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-debugger - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-debugger

-

-
- - -

Disallows debugger statements.

- - - - -
Rationale
-

In general, debugger statements aren’t appropriate for production code.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-debugger": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-default-export/index.html b/docs/_site/rules/no-default-export/index.html deleted file mode 100644 index bd289c5e62e..00000000000 --- a/docs/_site/rules/no-default-export/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-default-export - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-default-export

-

-
- - -

Disallows default exports in ES6-style modules.

- - -

Use named exports instead.

- - - - -
Rationale
- -

Named imports/exports promote clarity. -In addition, current tooling differs on the correct way to handle default imports/exports. -Avoiding them all together can help avoid tooling bugs and conflicts.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-default-export": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-imports/index.html b/docs/_site/rules/no-duplicate-imports/index.html deleted file mode 100644 index 3b843d0d02e..00000000000 --- a/docs/_site/rules/no-duplicate-imports/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-duplicate-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-imports

-

-
- - - -

Disallows multiple import statements from the same module.

- - - - -
Rationale
- -

Using a single import statement per module will make the code clearer because you can see everything being imported -from that module on one line.

- - - - - -

Config

-

Not configurable

- - -
Config examples
- -
-"no-duplicate-imports": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-super/index.html b/docs/_site/rules/no-duplicate-super/index.html deleted file mode 100644 index 637a74d625e..00000000000 --- a/docs/_site/rules/no-duplicate-super/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-duplicate-super - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-super

-

-
- - -

Warns if ‘super()’ appears twice in a constructor.

- - - - -
Rationale
-

The second call to ‘super()’ will fail at runtime.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-duplicate-super": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-switch-case/index.html b/docs/_site/rules/no-duplicate-switch-case/index.html deleted file mode 100644 index 1882ea04451..00000000000 --- a/docs/_site/rules/no-duplicate-switch-case/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-duplicate-switch-case - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-switch-case

-

-
- - -

Prevents duplicate cases in switch statements.

- - - - - - - -

Config

- - - -
Config examples
- -
-"no-duplicate-switch-case": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-variable/index.html b/docs/_site/rules/no-duplicate-variable/index.html deleted file mode 100644 index 9c8c627124a..00000000000 --- a/docs/_site/rules/no-duplicate-variable/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-duplicate-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-variable

-

-
- - -

Disallows duplicate variable declarations in the same block scope.

- - - -

This rule is only useful when using the var keyword - -the compiler will detect redeclarations of let and const variables.

- - - - -
Rationale
- -

A variable can be reassigned if necessary - -there’s no good reason to have a duplicate variable declaration.

- - - - - -

Config

-

You can specify "check-parameters" to check for variables with the same name as a parameter.

- - -
Config examples
- -
-"no-duplicate-variable": true
-
- -
-"no-duplicate-variable": [true, "check-parameters"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "check-parameters"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-dynamic-delete/index.html b/docs/_site/rules/no-dynamic-delete/index.html deleted file mode 100644 index 3e7ac893867..00000000000 --- a/docs/_site/rules/no-dynamic-delete/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: no-dynamic-delete - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-dynamic-delete

-

-
- - -

Bans usage of the delete operator with computed key expressions.

- - - - -
Rationale
- -

Deleting dynamically computed keys is dangerous and not well optimized.

- -

Also consider using a Map -or Set -if you’re storing collections of objects. -Using Objects can cause occasional edge case bugs, such as if a key is named “hasOwnProperty”.

- - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-dynamic-delete": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-empty-interface/index.html b/docs/_site/rules/no-empty-interface/index.html deleted file mode 100644 index 283c1caf315..00000000000 --- a/docs/_site/rules/no-empty-interface/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-empty-interface - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-empty-interface

-

-
- - -

Forbids empty interfaces.

- - - - -
Rationale
-

An empty interface is equivalent to its supertype (or {}).

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-empty/index.html b/docs/_site/rules/no-empty/index.html deleted file mode 100644 index f2d4935079e..00000000000 --- a/docs/_site/rules/no-empty/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-empty - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-empty

-

-
- - -

Disallows empty blocks.

- - -

Blocks with a comment inside are not considered empty.

- - - - -
Rationale
-

Empty blocks are often indicators of missing code.

- - - - - -

Config

- -

If allow-empty-catch is specified, then catch blocks are allowed to be empty.

- - -
Config examples
- -
-"no-empty": true
-
- -
-"no-empty": [true, "allow-empty-catch"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-empty-catch"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-eval/index.html b/docs/_site/rules/no-eval/index.html deleted file mode 100644 index a061bb8633a..00000000000 --- a/docs/_site/rules/no-eval/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-eval - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-eval

-

-
- - -

Disallows eval function invocations.

- - - - -
Rationale
- -

eval() is dangerous as it allows arbitrary code execution with full privileges. There are -alternatives -for most of the use cases for eval().

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-eval": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-floating-promises/index.html b/docs/_site/rules/no-floating-promises/index.html deleted file mode 100644 index a7aa472656d..00000000000 --- a/docs/_site/rules/no-floating-promises/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: no-floating-promises - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-floating-promises

-

-
- - -

Promises returned by functions must be handled appropriately.

- - -

Use no-unused-expression in addition to this rule to reveal even more floating promises.

- - - - -
Rationale
-

Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.

- - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

A list of ‘string’ names of any additional classes that should also be handled as Promises.

- - - -
Config examples
- -
-"no-floating-promises": true
-
- -
-"no-floating-promises": [true, "JQueryPromise"]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-for-in-array/index.html b/docs/_site/rules/no-for-in-array/index.html deleted file mode 100644 index d330bfea921..00000000000 --- a/docs/_site/rules/no-for-in-array/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - Rule: no-for-in-array - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-for-in-array

-

-
- - -

Disallows iterating over an array with a for-in loop.

- - - -

A for-in loop (for (var k in o)) iterates over the properties of an Object.

- -

While it is legal to use for-in loops with array types, it is not common. -for-in will iterate over the indices of the array as strings, omitting any “holes” in -the array.

- -

More common is to use for-of, which iterates over the values of an array. -If you want to iterate over the indices, alternatives include:

- -

array.forEach((value, index) => { … }); -for (const [index, value] of array.entries()) { … } -for (let i = 0; i < array.length; i++) { … }

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-for-in-array": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-implicit-dependencies/index.html b/docs/_site/rules/no-implicit-dependencies/index.html deleted file mode 100644 index 3fb7e0d8a63..00000000000 --- a/docs/_site/rules/no-implicit-dependencies/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - Rule: no-implicit-dependencies - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-implicit-dependencies

-

-
- - -

Disallows importing modules that are not listed as dependency in the project’s package.json

- - - -

Disallows importing transient dependencies and modules installed above your package’s root directory.

- - - - - - - - -

Config

- -

By default the rule looks at "dependencies" and "peerDependencies". -By adding the "dev" option the rule looks at "devDependencies" instead of "peerDependencies". -By adding the "optional" option the rule also looks at "optionalDependencies".

- - - -
Config examples
- -
-"no-implicit-dependencies": true
-
- -
-"no-implicit-dependencies": [true, "dev"]
-
- -
-"no-implicit-dependencies": [true, "optional"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "dev",
-      "optional"
-    ]
-  },
-  "minItems": 0,
-  "maxItems": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-import-side-effect/index.html b/docs/_site/rules/no-import-side-effect/index.html deleted file mode 100644 index 9ccd1ea5bec..00000000000 --- a/docs/_site/rules/no-import-side-effect/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: no-import-side-effect - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-import-side-effect

-

-
- - -

Avoid import statements with side-effect.

- - - - -
Rationale
-

Imports with side effects may have behavior which is hard for static verification.

- - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • ignore-module allows to specify a regex and ignore modules which it matches.
  • -
- - -
Config examples
- -
-"no-import-side-effect": true
-
- -
-"no-import-side-effect": [true, {"ignore-module": "(\\.html|\\.css)$"}]
-
- - -
Schema
-
-{
-  "items": {
-    "properties": {
-      "ignore-module": {
-        "type": "string"
-      }
-    },
-    "type": "object"
-  },
-  "maxLength": 1,
-  "minLength": 0,
-  "type": "array"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-inferrable-types/index.html b/docs/_site/rules/no-inferrable-types/index.html deleted file mode 100644 index 31729be771b..00000000000 --- a/docs/_site/rules/no-inferrable-types/index.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - Rule: no-inferrable-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-inferrable-types

-

-
- - -

Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.

- - - - -
Rationale
-

Explicit types where they can be easily inferred by the compiler make code more verbose.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • ignore-params allows specifying an inferrable type annotation for function params. -This can be useful when combining with the typedef rule.
  • -
  • ignore-properties allows specifying an inferrable type annotation for class properties.
  • -
- - -
Config examples
- -
-"no-inferrable-types": true
-
- -
-"no-inferrable-types": [true, "ignore-params"]
-
- -
-"no-inferrable-types": [true, "ignore-params", "ignore-properties"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-params",
-      "ignore-properties"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-inferred-empty-object-type/index.html b/docs/_site/rules/no-inferred-empty-object-type/index.html deleted file mode 100644 index 3d5fe55a4d8..00000000000 --- a/docs/_site/rules/no-inferred-empty-object-type/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: no-inferred-empty-object-type - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-inferred-empty-object-type

-

-
- - -

Disallow type inference of {} (empty object type) at function and constructor call sites

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-inferred-empty-object-type": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-internal-module/index.html b/docs/_site/rules/no-internal-module/index.html deleted file mode 100644 index d4ba5ba4467..00000000000 --- a/docs/_site/rules/no-internal-module/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-internal-module - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-internal-module

-

-
- - -

Disallows internal module

- - - - -
Rationale
-

Using module leads to a confusion of concepts with external modules. Use the newer namespace keyword instead.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-internal-module": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-invalid-template-strings/index.html b/docs/_site/rules/no-invalid-template-strings/index.html deleted file mode 100644 index df9e1905b3f..00000000000 --- a/docs/_site/rules/no-invalid-template-strings/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-invalid-template-strings - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-invalid-template-strings

-

-
- - -

Warns on use of ${ in non-template strings.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-invalid-template-strings": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-invalid-this/index.html b/docs/_site/rules/no-invalid-this/index.html deleted file mode 100644 index dec83b55801..00000000000 --- a/docs/_site/rules/no-invalid-this/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - Rule: no-invalid-this - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-invalid-this

-

-
- - -

Disallows using the this keyword outside of classes.

- - - - -
Rationale
-

See the rule’s author’s rationale here.

- - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • check-function-in-method disallows using the this keyword in functions within class methods.
  • -
- - -
Config examples
- -
-"no-invalid-this": true
-
- -
-"no-invalid-this": [true, "check-function-in-method"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-function-in-method"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-irregular-whitespace/index.html b/docs/_site/rules/no-irregular-whitespace/index.html deleted file mode 100644 index 148af75f96d..00000000000 --- a/docs/_site/rules/no-irregular-whitespace/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-irregular-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-irregular-whitespace

-

-
- - -

Disallow irregular whitespace outside of strings and comments

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-irregular-whitespace": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-magic-numbers/index.html b/docs/_site/rules/no-magic-numbers/index.html deleted file mode 100644 index 6320e02a021..00000000000 --- a/docs/_site/rules/no-magic-numbers/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-magic-numbers - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-magic-numbers

-

-
- - - -

Disallows the use constant number values outside of variable assignments. -When no list of allowed values is specified, -1, 0 and 1 are allowed by default.

- - - - -
Rationale
- -

Magic numbers should be avoided as they often lack documentation, forcing -them to be stored in variables gives them implicit documentation.

- - - - - -

Config

-

A list of allowed numbers.

- - -
Config examples
- -
-"no-magic-numbers": true
-
- -
-"no-magic-numbers": [true, 1, 2, 3]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "number"
-  },
-  "minLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-mergeable-namespace/index.html b/docs/_site/rules/no-mergeable-namespace/index.html deleted file mode 100644 index 7261ea23cb3..00000000000 --- a/docs/_site/rules/no-mergeable-namespace/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-mergeable-namespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-mergeable-namespace

-

-
- - -

Disallows mergeable namespaces in the same file.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-mergeable-namespace": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-misused-new/index.html b/docs/_site/rules/no-misused-new/index.html deleted file mode 100644 index 66b1dd18dcf..00000000000 --- a/docs/_site/rules/no-misused-new/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-misused-new - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-misused-new

-

-
- - -

Warns on apparent attempts to define constructors for interfaces or new for classes.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-misused-new": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-namespace/index.html b/docs/_site/rules/no-namespace/index.html deleted file mode 100644 index a31424cc42a..00000000000 --- a/docs/_site/rules/no-namespace/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - Rule: no-namespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-namespace

-

-
- - -

Disallows use of internal modules and namespaces.

- - -

This rule still allows the use of declare module ... {}

- - - - -
Rationale
- -

ES6-style external modules are the standard way to modularize code. -Using module {} and namespace {} are outdated ways to organize TypeScript code.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

One argument may be optionally provided:

- -
    -
  • allow-declarations allows declare namespace ... {} to describe external APIs.
  • -
- - -
Config examples
- -
-"no-namespace": true
-
- -
-"no-namespace": [true, "allow-declarations"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-declarations"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-non-null-assertion/index.html b/docs/_site/rules/no-non-null-assertion/index.html deleted file mode 100644 index 38965c1b2d4..00000000000 --- a/docs/_site/rules/no-non-null-assertion/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-non-null-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-non-null-assertion

-

-
- - -

Disallows non-null assertions using the ! postfix operator.

- - - - -
Rationale
-

Using non-null assertion cancels the benefits of the strict null checking mode.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-non-null-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-null-keyword/index.html b/docs/_site/rules/no-null-keyword/index.html deleted file mode 100644 index 0f2bb6581f2..00000000000 --- a/docs/_site/rules/no-null-keyword/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-null-keyword - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-null-keyword

-

-
- - -

Disallows use of the null keyword literal.

- - - - -
Rationale
- -

Instead of having the dual concepts of null andundefined in a codebase, -this rule ensures that only undefined is used.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-null-keyword": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-object-literal-type-assertion/index.html b/docs/_site/rules/no-object-literal-type-assertion/index.html deleted file mode 100644 index 47ebbb0f87d..00000000000 --- a/docs/_site/rules/no-object-literal-type-assertion/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-object-literal-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-object-literal-type-assertion

-

-
- - - -

Forbids an object literal to appear in a type assertion expression. -Casting to any is still allowed.

- - - - -
Rationale
- -

Always prefer const x: T = { ... }; to const x = { ... } as T;. -The type assertion in the latter case is either unnecessary or hides an error. -The compiler will warn for excess properties with this syntax, but not missing required fields. -For example: const x: { foo: number } = {} will fail to compile, but -const x = {} as { foo: number } will succeed.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-object-literal-type-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-parameter-properties/index.html b/docs/_site/rules/no-parameter-properties/index.html deleted file mode 100644 index 1e63a106a7c..00000000000 --- a/docs/_site/rules/no-parameter-properties/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-parameter-properties - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-parameter-properties

-

-
- - -

Disallows parameter properties in class constructors.

- - - - -
Rationale
- -

Parameter properties can be confusing to those new to TS as they are less explicit -than other ways of declaring and initializing class members.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-parameter-properties": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-parameter-reassignment/index.html b/docs/_site/rules/no-parameter-reassignment/index.html deleted file mode 100644 index a5b844547ad..00000000000 --- a/docs/_site/rules/no-parameter-reassignment/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-parameter-reassignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-parameter-reassignment

-

-
- - -

Disallows reassigning parameters.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-parameter-reassignment": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-redundant-jsdoc/index.html b/docs/_site/rules/no-redundant-jsdoc/index.html deleted file mode 100644 index a4988e8ba0e..00000000000 --- a/docs/_site/rules/no-redundant-jsdoc/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-redundant-jsdoc - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-redundant-jsdoc

-

-
- - -

Forbids JSDoc which duplicates TypeScript functionality.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-redundant-jsdoc": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-reference-import/index.html b/docs/_site/rules/no-reference-import/index.html deleted file mode 100644 index 0ac920697b5..00000000000 --- a/docs/_site/rules/no-reference-import/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - Rule: no-reference-import - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-reference-import

-

-
- - -

Don’t <reference types="foo" /> if you import foo anyway.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-reference/index.html b/docs/_site/rules/no-reference/index.html deleted file mode 100644 index 6dadb22541b..00000000000 --- a/docs/_site/rules/no-reference/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - Rule: no-reference - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-reference

-

-
- - -

Disallows /// <reference path=> imports (use ES6-style imports instead).

- - - - -
Rationale
- -

Using /// <reference path=> comments to load other files is outdated. -Use ES6-style imports to reference other files.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-reference": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-require-imports/index.html b/docs/_site/rules/no-require-imports/index.html deleted file mode 100644 index 353eae206d2..00000000000 --- a/docs/_site/rules/no-require-imports/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-require-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-require-imports

-

-
- - -

Disallows invocation of require().

- - - - -
Rationale
-

Prefer the newer ES6-style imports over require().

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-require-imports": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-return-await/index.html b/docs/_site/rules/no-return-await/index.html deleted file mode 100644 index 07484172174..00000000000 --- a/docs/_site/rules/no-return-await/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - Rule: no-return-await - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-return-await

-

-
- - -

Disallows unnecessary return await.

- - - - -
Rationale
- -

An async function always wraps the return value in a Promise. -Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.

- - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-return-await": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-shadowed-variable/index.html b/docs/_site/rules/no-shadowed-variable/index.html deleted file mode 100644 index b9b771ba95b..00000000000 --- a/docs/_site/rules/no-shadowed-variable/index.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - Rule: no-shadowed-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-shadowed-variable

-

-
- - -

Disallows shadowing variable declarations.

- - - - -
Rationale
-

Shadowing a variable masks access to it and obscures to what value an identifier actually refers.

- - - - - -

Config

- -

You can optionally pass an object to disable checking for certain kinds of declarations. -Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" -and "typeParameter". Just set the value to false for the check you want to disable. -All checks default to true, i.e. are enabled by default. -Note that you cannot disable variables and parameters.

- -

The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their -temporal dead zone. When set to false parameters, classes, enums and variables declared -with let or const are not considered shadowed if the shadowing occurs within their -temporal dead zone.

- -

The following example shows how the "temporalDeadZone" option changes the linting result:

- -
function fn(value) {
-    if (value) {
-        const tmp = value; // no error on this line if "temporalDeadZone" is false
-        return tmp;
-    }
-    let tmp = undefined;
-    if (!value) {
-        const tmp = value; // this line always contains an error
-        return tmp;
-    }
-}
-
- - - -
Config examples
- -
-"no-shadowed-variable": true
-
- -
-"no-shadowed-variable": [
-  true,
-  {
-    "class": true,
-    "enum": true,
-    "function": true,
-    "interface": false,
-    "namespace": true,
-    "typeAlias": false,
-    "typeParameter": false
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "class": {
-      "type": "boolean"
-    },
-    "enum": {
-      "type": "boolean"
-    },
-    "function": {
-      "type": "boolean"
-    },
-    "import": {
-      "type": "boolean"
-    },
-    "interface": {
-      "type": "boolean"
-    },
-    "namespace": {
-      "type": "boolean"
-    },
-    "typeAlias": {
-      "type": "boolean"
-    },
-    "typeParameter": {
-      "type": "boolean"
-    },
-    "temporalDeadZone": {
-      "type": "boolean"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-sparse-arrays/index.html b/docs/_site/rules/no-sparse-arrays/index.html deleted file mode 100644 index dee04a79850..00000000000 --- a/docs/_site/rules/no-sparse-arrays/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-sparse-arrays - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-sparse-arrays

-

-
- - -

Forbids array literals to contain missing elements.

- - - - -
Rationale
-

Missing elements are probably an accidentally duplicated comma.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-sparse-arrays": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-string-literal/index.html b/docs/_site/rules/no-string-literal/index.html deleted file mode 100644 index 44babe9fca7..00000000000 --- a/docs/_site/rules/no-string-literal/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-string-literal - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-string-literal

-

-
- - - -

Forbids unnecessary string literal property access. -Allows obj["prop-erty"] (can’t be a regular property access). -Disallows obj["property"] (should be obj.property).

- - - - -
Rationale
- -

If --noImplicitAny is turned off, -property access via a string literal will be ‘any’ if the property does not exist.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-string-literal": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-string-throw/index.html b/docs/_site/rules/no-string-throw/index.html deleted file mode 100644 index f01098bb394..00000000000 --- a/docs/_site/rules/no-string-throw/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - Rule: no-string-throw - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-string-throw

-

-
- - -

Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-submodule-imports/index.html b/docs/_site/rules/no-submodule-imports/index.html deleted file mode 100644 index be3f5182f1f..00000000000 --- a/docs/_site/rules/no-submodule-imports/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-submodule-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-submodule-imports

-

-
- - - -

Disallows importing any submodule.

- - - - -
Rationale
- -

Submodules of some packages are treated as private APIs and the import -paths may change without deprecation periods. It’s best to stick with -top-level package exports.

- - - - - -

Config

-

A list of whitelisted package or submodule names.

- - -
Config examples
- -
-"no-submodule-imports": true
-
- -
-"no-submodule-imports": [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-switch-case-fall-through/index.html b/docs/_site/rules/no-switch-case-fall-through/index.html deleted file mode 100644 index cd6c370339a..00000000000 --- a/docs/_site/rules/no-switch-case-fall-through/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - Rule: no-switch-case-fall-through - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-switch-case-fall-through

-

-
- - -

Disallows falling through case statements.

- - - -

For example, the following is not allowed:

- -
switch(foo) {
-    case 1:
-        someFunc(foo);
-    case 2:
-        someOtherFunc(foo);
-}
-
- -

However, fall through is allowed when case statements are consecutive or -a magic /* falls through */ comment is present. The following is valid:

- -
switch(foo) {
-    case 1:
-        someFunc(foo);
-        /* falls through */
-    case 2:
-    case 3:
-        someOtherFunc(foo);
-}
-
- - - - -
Rationale
-

Fall though in switch statements is often unintentional and a bug.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-switch-case-fall-through": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-this-assignment/index.html b/docs/_site/rules/no-this-assignment/index.html deleted file mode 100644 index ab7ec59beca..00000000000 --- a/docs/_site/rules/no-this-assignment/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: no-this-assignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-this-assignment

-

-
- - -

Disallows unnecessary references to this.

- - - - -
Rationale
-

Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not manging scope well.

- - - - - -

Config

- -

Two options may be provided on an object:

- -
    -
  • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
  • -
  • allowed-names may be specified as a list of regular expressions to match allowed variable names.
  • -
- - -
Config examples
- -
-"no-this-assignment": true
-
- -
-"no-this-assignment": [true, {"allowed-names": ["^self$"], "allow-destructuring": true}]
-
- - -
Schema
-
-{
-  "additionalProperties": false,
-  "properties": {
-    "allow-destructuring": {
-      "type": "boolean"
-    },
-    "allowed-names": {
-      "listType": "string",
-      "type": "list"
-    }
-  },
-  "type": "object"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-trailing-whitespace/index.html b/docs/_site/rules/no-trailing-whitespace/index.html deleted file mode 100644 index c99e817afa9..00000000000 --- a/docs/_site/rules/no-trailing-whitespace/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: no-trailing-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-trailing-whitespace

-

-
- - -

Disallows trailing whitespace at the end of a line.

- - - - -
Rationale
-

Keeps version control diffs clean as it prevents accidental whitespace from being committed.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Possible settings are:

- -
    -
  • "ignore-template-strings": Allows trailing whitespace in template strings.
  • -
  • "ignore-comments": Allows trailing whitespace in comments.
  • -
  • "ignore-jsdoc": Allows trailing whitespace only in JSDoc comments.
  • -
  • "ignore-blank-lines": Allows trailing whitespace on empty lines.
  • -
- - -
Config examples
- -
-"no-trailing-whitespace": true
-
- -
-"no-trailing-whitespace": [true, "ignore-comments"]
-
- -
-"no-trailing-whitespace": [true, "ignore-jsdoc"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-comments",
-      "ignore-jsdoc",
-      "ignore-template-strings",
-      "ignore-blank-lines"
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unbound-method/index.html b/docs/_site/rules/no-unbound-method/index.html deleted file mode 100644 index 679558ef442..00000000000 --- a/docs/_site/rules/no-unbound-method/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-unbound-method - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unbound-method

-

-
- - -

Warns when a method is used as outside of a method call.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

You may optionally pass “ignore-static” to ignore static methods.

- - -
Config examples
- -
-"no-unbound-method": true
-
- -
-"no-unbound-method": [true, "ignore-static"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ignore-static"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html deleted file mode 100644 index 2db62dbb7a7..00000000000 --- a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-callback-wrapper - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-callback-wrapper

-

-
- - - -

Replaces x => f(x) with just f. -To catch more cases, enable only-arrow-functions and arrow-return-shorthand too.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-callback-wrapper": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-class/index.html b/docs/_site/rules/no-unnecessary-class/index.html deleted file mode 100644 index 7bed761e88f..00000000000 --- a/docs/_site/rules/no-unnecessary-class/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-class - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-class

-

-
- - - -

Disallows classes that are not strictly necessary.

- - - - -
Rationale
- -

Users who come from a Java-style OO language may wrap -their utility functions in an extra class, instead of -putting them at the top level.

- - - - - -

Config

- -

Three arguments may be optionally provided:

- -
    -
  • "allow-constructor-only" ignores classes whose members are constructors.
  • -
  • "allow-empty-class" ignores class DemoClass {}.
  • -
  • "allow-static-only" ignores classes whose members are static.
  • -
- - -
Config examples
- -
-"no-unnecessary-class": true
-
- -
-"no-unnecessary-class": ["allow-empty-class", "allow-constructor-only"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-initializer/index.html b/docs/_site/rules/no-unnecessary-initializer/index.html deleted file mode 100644 index dbd6e26171d..00000000000 --- a/docs/_site/rules/no-unnecessary-initializer/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-initializer - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-initializer

-

-
- - -

Forbids a ‘var’/’let’ statement or destructuring initializer to be initialized to ‘undefined’.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-initializer": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-qualifier/index.html b/docs/_site/rules/no-unnecessary-qualifier/index.html deleted file mode 100644 index ca3aabac10f..00000000000 --- a/docs/_site/rules/no-unnecessary-qualifier/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-qualifier - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-qualifier

-

-
- - -

Warns when a namespace qualifier (A.x) is unnecessary.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-qualifier": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-type-assertion/index.html b/docs/_site/rules/no-unnecessary-type-assertion/index.html deleted file mode 100644 index 5a2a395a3d1..00000000000 --- a/docs/_site/rules/no-unnecessary-type-assertion/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-type-assertion

-

-
- - -

Warns if a type assertion does not change the type of an expression.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

A list of whitelisted assertion types to ignore

- - -
Config examples
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unsafe-any/index.html b/docs/_site/rules/no-unsafe-any/index.html deleted file mode 100644 index c134d81b2fa..00000000000 --- a/docs/_site/rules/no-unsafe-any/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-unsafe-any - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unsafe-any

-

-
- - - -

Warns when using an expression of type ‘any’ in a dynamic way. -Uses are only allowed if they would work for {} | null | undefined. -Type casts and tests are allowed. -Expressions that work on all values (such as "" + x) are allowed.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unsafe-any": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unsafe-finally/index.html b/docs/_site/rules/no-unsafe-finally/index.html deleted file mode 100644 index 239dd8b4d8d..00000000000 --- a/docs/_site/rules/no-unsafe-finally/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-unsafe-finally - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unsafe-finally

-

-
- - - -

Disallows control flow statements, such as return, continue, -break and throws in finally blocks.

- - - - - - - -
Rationale
- -

When used inside finally blocks, control flow statements, -such as return, continue, break and throws -override any other control flow statements in the same try/catch scope. -This is confusing and unexpected behavior.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unsafe-finally": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unused-expression/index.html b/docs/_site/rules/no-unused-expression/index.html deleted file mode 100644 index 1fe05f0da72..00000000000 --- a/docs/_site/rules/no-unused-expression/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: no-unused-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unused-expression

-

-
- - -

Disallows unused expression statements.

- - - -

Unused expressions are expression statements which are not assignments or function calls -(and thus usually no-ops).

- - - - -
Rationale
- -

Detects potential errors where an assignment or function call was intended.

- - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform -method or function calls for side effects (e.g. e && e.preventDefault()).
  • -
  • allow-new allows ‘new’ expressions for side effects (e.g. new ModifyGlobalState();.
  • -
  • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
  • -
- - -
Config examples
- -
-"no-unused-expression": true
-
- -
-"no-unused-expression": [true, "allow-fast-null-checks"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-fast-null-checks",
-      "allow-new",
-      "allow-tagged-template"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unused-variable/index.html b/docs/_site/rules/no-unused-variable/index.html deleted file mode 100644 index eb2977a14a3..00000000000 --- a/docs/_site/rules/no-unused-variable/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - Rule: no-unused-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unused-variable

-

-
- - -

Disallows unused imports, variables, functions and - private class members. Similar to tsc’s –noUnusedParameters and –noUnusedLocals - options, but does not interrupt code compilation.

- - - -

In addition to avoiding compilation errors, this rule may still be useful if you -wish to have tslint automatically remove unused imports, variables, functions, -and private class members, when using TSLint’s --fix option.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

- -

Three optional arguments may be optionally provided:

- -
    -
  • "check-parameters" disallows unused function and constructor parameters. -
      -
    • NOTE: this option is experimental and does not work with classes - that use abstract method declarations, among other things.
    • -
    -
  • -
  • {"ignore-pattern": "pattern"} where pattern is a case-sensitive regexp. -Variable names and imports that match the pattern will be ignored.
  • -
- - -
Config examples
- -
-"no-unused-variable": true
-
- -
-"no-unused-variable": [true, {"ignore-pattern": "^_"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "oneOf": [
-      {
-        "type": "string",
-        "enum": [
-          "check-parameters"
-        ]
-      },
-      {
-        "type": "object",
-        "properties": {
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "additionalProperties": false
-      }
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-use-before-declare/index.html b/docs/_site/rules/no-use-before-declare/index.html deleted file mode 100644 index 1513735112a..00000000000 --- a/docs/_site/rules/no-use-before-declare/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: no-use-before-declare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-use-before-declare

-

-
- - -

Disallows usage of variables before their declaration.

- - - -

This rule is primarily useful when using the var keyword since the compiler will -automatically detect if a block-scoped let and const variable is used before -declaration. Since most modern TypeScript doesn’t use var, this rule is generally -discouraged and is kept around for legacy purposes. It is slow to compute, is not -enabled in the built-in configuration presets, and should not be used to inform TSLint -design decisions.

- - - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-use-before-declare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-var-keyword/index.html b/docs/_site/rules/no-var-keyword/index.html deleted file mode 100644 index 554d8876240..00000000000 --- a/docs/_site/rules/no-var-keyword/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: no-var-keyword - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-var-keyword

-

-
- - -

Disallows usage of the var keyword.

- - -

Use let or const instead.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-var-keyword": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-var-requires/index.html b/docs/_site/rules/no-var-requires/index.html deleted file mode 100644 index 768c7655fe8..00000000000 --- a/docs/_site/rules/no-var-requires/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: no-var-requires - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-var-requires

-

-
- - -

Disallows the use of require statements except in import statements.

- - - -

In other words, the use of forms such as var module = require("module") are banned. -Instead use ES6 style imports or import foo = require('foo') imports.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-var-requires": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-void-expression/index.html b/docs/_site/rules/no-void-expression/index.html deleted file mode 100644 index 72eb363ba52..00000000000 --- a/docs/_site/rules/no-void-expression/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-void-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-void-expression

-

-
- - -

Requires expressions of type void to appear in statement position.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- -

If ignore-arrow-function-shorthand is provided, () => returnsVoid() will be allowed. -Otherwise, it must be written as () => { returnsVoid(); }.

- - -
Config examples
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-arrow-function-shorthand"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/number-literal-format/index.html b/docs/_site/rules/number-literal-format/index.html deleted file mode 100644 index 451dc8d70cd..00000000000 --- a/docs/_site/rules/number-literal-format/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: number-literal-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: number-literal-format

-

-
- - -

Checks that decimal literals should begin with ‘0.’ instead of just ‘.’, and should not end with a trailing ‘0’.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"number-literal-format": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-key-quotes/index.html b/docs/_site/rules/object-literal-key-quotes/index.html deleted file mode 100644 index 114438125a4..00000000000 --- a/docs/_site/rules/object-literal-key-quotes/index.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - Rule: object-literal-key-quotes - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-key-quotes

-

-
- - -

Enforces consistent object literal property quote style.

- - - -

Object literal property names can be defined in two ways: using literals or using strings. -For example, these two objects are equivalent:

- -

var object1 = { - property: true -};

- -

var object2 = { - “property”: true -};

- -

In many cases, it doesn’t matter if you choose to use an identifier instead of a string -or vice-versa. Even so, you might decide to enforce a consistent style in your code.

- -

This rules lets you enforce consistent quoting of property names. Either they should always -be quoted (default behavior) or quoted only as needed (“as-needed”).

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Possible settings are:

- -
    -
  • "always": Property names should always be quoted. (This is the default.)
  • -
  • "as-needed": Only property names which require quotes may be quoted (e.g. those with spaces in them).
  • -
  • "consistent": Property names should either all be quoted or unquoted.
  • -
  • "consistent-as-needed": If any property name requires quotes, then all properties must be quoted. Otherwise, no -property names may be quoted.
  • -
- -

For ES6, computed property names ({[name]: value}) and methods ({foo() {}}) never need -to be quoted.

- - -
Config examples
- -
-"object-literal-key-quotes": [true, "as-needed"]
-
- -
-"object-literal-key-quotes": [true, "always"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always",
-    "as-needed",
-    "consistent",
-    "consistent-as-needed"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-shorthand/index.html b/docs/_site/rules/object-literal-shorthand/index.html deleted file mode 100644 index ba176698197..00000000000 --- a/docs/_site/rules/object-literal-shorthand/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: object-literal-shorthand - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-shorthand

-

-
- - -

Enforces/disallows use of ES6 object literal shorthand.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If the ‘never’ option is provided, any shorthand object literal syntax will cause a failure.

- - -
Config examples
- -
-"object-literal-shorthand": true
-
- -
-"object-literal-shorthand": [true, "never"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "never"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-sort-keys/index.html b/docs/_site/rules/object-literal-sort-keys/index.html deleted file mode 100644 index dffa767b71e..00000000000 --- a/docs/_site/rules/object-literal-sort-keys/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: object-literal-sort-keys - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-sort-keys

-

-
- - - -

Checks ordering of keys in object literals.

- -

When using the default alphabetical ordering, additional blank lines may be used to group -object properties together while keeping the elements within each group in alphabetical order.

- - - - - -
Rationale
-

Useful in preventing merge conflicts

- - - - - -

Config

- -

By default, this rule checks that keys are in alphabetical order. -The following may optionally be passed:

- -
    -
  • “ignore-case” will to compare keys in a case insensitive way.
  • -
  • -

    “match-declaration-order” will prefer to use the key ordering of the contextual type of the object literal, as in:

    - -

    interface I { foo: number; bar: number; } - const obj: I = { foo: 1, bar: 2 };

    -
  • -
- -

If a contextual type is not found, alphabetical ordering will be used instead.

- - -
Config examples
- -
-"object-literal-sort-keys": true
-
- -
-"object-literal-sort-keys": [true, "ignore-case", "match-declaration-order"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ignore-case",
-    "match-declaration-order"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/one-line/index.html b/docs/_site/rules/one-line/index.html deleted file mode 100644 index 24ef7fb4108..00000000000 --- a/docs/_site/rules/one-line/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: one-line - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: one-line

-

-
- - -

Requires the specified tokens to be on the same line as the expression preceding them.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • -
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • -
  • "check-else" checks that else is on the same line as the closing brace for if.
  • -
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • -
  • "check-whitespace" checks preceding whitespace for the specified tokens.
  • -
- - -
Config examples
- -
-"one-line": [true, "check-catch", "check-finally", "check-else"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-catch",
-      "check-finally",
-      "check-else",
-      "check-open-brace",
-      "check-whitespace"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/one-variable-per-declaration/index.html b/docs/_site/rules/one-variable-per-declaration/index.html deleted file mode 100644 index 244bc7da596..00000000000 --- a/docs/_site/rules/one-variable-per-declaration/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: one-variable-per-declaration - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: one-variable-per-declaration

-

-
- - -

Disallows multiple variable definitions in the same declaration statement.

- - - - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • ignore-for-loop allows multiple variable definitions in a for loop declaration.
  • -
- - -
Config examples
- -
-"one-variable-per-declaration": true
-
- -
-"one-variable-per-declaration": [true, "ignore-for-loop"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-for-loop"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/only-arrow-functions/index.html b/docs/_site/rules/only-arrow-functions/index.html deleted file mode 100644 index 34f30022312..00000000000 --- a/docs/_site/rules/only-arrow-functions/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: only-arrow-functions - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: only-arrow-functions

-

-
- - -

Disallows traditional (non-arrow) function expressions.

- - - - -
Rationale
-

Traditional functions don’t bind lexical scope, which can lead to unexpected behavior when accessing ‘this’.

- - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • "allow-declarations" allows standalone function declarations.
  • -
  • "allow-named-functions" allows the expression function foo() {} but not function() {}.
  • -
- - - -
Config examples
- -
-"only-arrow-functions": true
-
- -
-"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-declarations",
-      "allow-named-functions"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ordered-imports/index.html b/docs/_site/rules/ordered-imports/index.html deleted file mode 100644 index 2b0af21cb5e..00000000000 --- a/docs/_site/rules/ordered-imports/index.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - Rule: ordered-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ordered-imports

-

-
- - -

Requires that import statements be alphabetized and grouped.

- - - -

Enforce a consistent ordering for ES6 imports:

-
    -
  • Named imports must be alphabetized (i.e. “import {A, B, C} from “foo”;”) -
      -
    • The exact ordering can be controlled by the named-imports-order option.
    • -
    • “longName as name” imports are ordered by “longName”.
    • -
    -
  • -
  • Import sources must be alphabetized within groups, i.e.: - import * as foo from “a”; - import * as bar from “b”;
  • -
  • Groups of imports are delineated by blank lines. You can use these to group imports - however you like, e.g. by first- vs. third-party or thematically or can you can - enforce a grouping of third-party, parent directories and the current directory.
  • -
- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

You may set the "import-sources-order" option to control the ordering of source -imports (the "foo" in import {A, B, C} from "foo").

- -

Possible values for "import-sources-order" are:

- -
    -
  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • -
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • -
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • -
  • "any": Allow any order.
  • -
- -

You may set the "grouped-imports" option to control the grouping of source -imports (the "foo" in import {A, B, C} from "foo").

- -

Possible values for "grouped-imports" are:

- -
    -
  • false: Do not enforce grouping. (This is the default.)
  • -
  • true: Group source imports by "bar", "../baz", "./foo".
  • -
- -

You may set the "named-imports-order" option to control the ordering of named -imports (the {A, B, C} in import {A, B, C} from "foo").

- -

Possible values for "named-imports-order" are:

- -
    -
  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • -
  • "lowercase-first": Correct order is {b, A, C}.
  • -
  • "lowercase-last": Correct order is {A, C, b}.
  • -
  • "any": Allow any order.
  • -
- -

You may set the "module-source-path" option to control the ordering of imports based full path -or just the module name

- -

Possible values for "module-source-path" are:

- -
    -
  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • -
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
  • -
- - - -
Config examples
- -
-"ordered-imports": true
-
- -
-"ordered-imports": [
-  true,
-  {
-    "import-sources-order": "lowercase-last",
-    "named-imports-order": "lowercase-first"
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "grouped-imports": {
-      "type": "boolean"
-    },
-    "import-sources-order": {
-      "type": "string",
-      "enum": [
-        "case-insensitive",
-        "lowercase-first",
-        "lowercase-last",
-        "any"
-      ]
-    },
-    "named-imports-order": {
-      "type": "string",
-      "enum": [
-        "case-insensitive",
-        "lowercase-first",
-        "lowercase-last",
-        "any"
-      ]
-    },
-    "module-source-path": {
-      "type": "string",
-      "enum": [
-        "full",
-        "basename"
-      ]
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-conditional-expression/index.html b/docs/_site/rules/prefer-conditional-expression/index.html deleted file mode 100644 index 0ceb1ab03d3..00000000000 --- a/docs/_site/rules/prefer-conditional-expression/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: prefer-conditional-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-conditional-expression

-

-
- - - -

Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

- - - - -
Rationale
- -

This reduces duplication and can eliminate an unnecessary variable declaration.

- - - - - -

Config

-

If check-else-if is specified, the rule also checks nested if-else-if statements.

- - -
Config examples
- -
-"prefer-conditional-expression": true
-
- -
-"prefer-conditional-expression": [true, "check-else-if"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "check-else-if"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-const/index.html b/docs/_site/rules/prefer-const/index.html deleted file mode 100644 index a8bd2397065..00000000000 --- a/docs/_site/rules/prefer-const/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: prefer-const - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-const

-

-
- - -

Requires that variable declarations use const instead of let and var if possible.

- - - -

If a variable is only assigned to once when it is declared, it should be declared using ‘const’

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

An optional object containing the property “destructuring” with two possible values:

- -
    -
  • “any” (default) - If any variable in destructuring can be const, this rule warns for those variables.
  • -
  • “all” - Only warns if all variables in destructuring can be const.
  • -
- - -
Config examples
- -
-"prefer-const": true
-
- -
-"prefer-const": [true, {"destructuring": "all"}]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "destructuring": {
-      "type": "string",
-      "enum": [
-        "all",
-        "any"
-      ]
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-for-of/index.html b/docs/_site/rules/prefer-for-of/index.html deleted file mode 100644 index 50b0ab9dcad..00000000000 --- a/docs/_site/rules/prefer-for-of/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: prefer-for-of - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-for-of

-

-
- - -

Recommends a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated.

- - - - -
Rationale
-

A for(… of …) loop is easier to implement and read when the index is not needed.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-for-of": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-function-over-method/index.html b/docs/_site/rules/prefer-function-over-method/index.html deleted file mode 100644 index 5a7f2260e15..00000000000 --- a/docs/_site/rules/prefer-function-over-method/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: prefer-function-over-method - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-function-over-method

-

-
- - -

Warns for class methods that do not use ‘this’.

- - - - - - - -

Config

- -

“allow-public” excludes checking of public methods. -“allow-protected” excludes checking of protected methods.

- - -
Config examples
- -
-"prefer-function-over-method": true
-
- -
-"prefer-function-over-method": [true, "allow-public", "allow-protected"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-public",
-    "allow-protected"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-method-signature/index.html b/docs/_site/rules/prefer-method-signature/index.html deleted file mode 100644 index 5e19bbedb0c..00000000000 --- a/docs/_site/rules/prefer-method-signature/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: prefer-method-signature - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-method-signature

-

-
- - -

Prefer foo(): void over foo: () => void in interfaces and types.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-method-signature": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-object-spread/index.html b/docs/_site/rules/prefer-object-spread/index.html deleted file mode 100644 index 508b297c200..00000000000 --- a/docs/_site/rules/prefer-object-spread/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: prefer-object-spread - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-object-spread

-

-
- - -

Enforces the use of the ES2015 object spread operator over Object.assign() where appropriate.

- - - - -
Rationale
-

Object spread allows for better type checking and inference.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-object-spread": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-readonly/index.html b/docs/_site/rules/prefer-readonly/index.html deleted file mode 100644 index b457aa3e537..00000000000 --- a/docs/_site/rules/prefer-readonly/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: prefer-readonly - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-readonly

-

-
- - -

Requires that private variables are marked as readonly if they’re never modified outside of the constructor.

- - - -

If a private variable is only assigned to in the constructor, it should be declared as readonly.

- - - - - -
Rationale
- -

Marking never-modified variables as readonly helps enforce the code’s intent of keeping them as never-modified. -It can also help prevent accidental changes of members not meant to be changed.

- - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

If only-inline-lambdas is specified, only immediately-declared arrow functions are checked.

- - -
Config examples
- -
-"prefer-readonly": true
-
- -
-"prefer-readonly": [true, "only-inline-lambdas"]
-
- - -
Schema
-
-{
-  "enum": [
-    "only-inline-lambdas"
-  ],
-  "type": "string"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-switch/index.html b/docs/_site/rules/prefer-switch/index.html deleted file mode 100644 index 01260987a4b..00000000000 --- a/docs/_site/rules/prefer-switch/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: prefer-switch - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-switch

-

-
- - -

Prefer a switch statement to an if statement with simple === comparisons.

- - - - - - - -

Config

- -

An optional object with the property ‘min-cases’. -This is the number cases needed before a switch statement is recommended. -Defaults to 3.

- - -
Config examples
- -
-"prefer-switch": true
-
- -
-"prefer-switch": [true, {"min-cases": 2}]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "min-cases": {
-      "type": "number"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-template/index.html b/docs/_site/rules/prefer-template/index.html deleted file mode 100644 index 0b217edf748..00000000000 --- a/docs/_site/rules/prefer-template/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: prefer-template - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-template

-

-
- - -

Prefer a template expression over string literal concatenation.

- - - - - - - -

Config

- -

If allow-single-concat is specified, then a single concatenation (x + y) is allowed, but not more (x + y + z).

- - -
Config examples
- -
-"prefer-template": true
-
- -
-"prefer-template": [true, "allow-single-concat"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-single-concat"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/promise-function-async/index.html b/docs/_site/rules/promise-function-async/index.html deleted file mode 100644 index 17910e28437..00000000000 --- a/docs/_site/rules/promise-function-async/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: promise-function-async - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: promise-function-async

-

-
- - -

Requires any function or method that returns a promise to be marked async.

- - - - -
Rationale
- -

Ensures that each function is only capable of 1) returning a rejected promise, or 2) -throwing an Error object. In contrast, non-async Promise-returning functions -are technically capable of either. This practice removes a requirement for consuming -code to handle both cases.

- - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"promise-function-async": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/quotemark/index.html b/docs/_site/rules/quotemark/index.html deleted file mode 100644 index 9eecc3cb306..00000000000 --- a/docs/_site/rules/quotemark/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: quotemark - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: quotemark

-

-
- - -

Requires single or double quotes for string literals.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "single" enforces single quotes.
  • -
  • "double" enforces double quotes.
  • -
  • "jsx-single" enforces single quotes for JSX attributes.
  • -
  • "jsx-double" enforces double quotes for JSX attributes.
  • -
  • "avoid-template" forbids single-line untagged template strings that do not contain string interpolations.
  • -
  • "avoid-escape" allows you to use the “other” quotemark in cases where escaping would normally be required. -For example, [true, "double", "avoid-escape"] would not report a failure on the string literal -'Hello "World"'.
  • -
- - -
Config examples
- -
-"quotemark": [true, "single", "avoid-escape", "avoid-template"]
-
- -
-"quotemark": [true, "single", "jsx-double"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "single",
-      "double",
-      "jsx-single",
-      "jsx-double",
-      "avoid-escape",
-      "avoid-template"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/radix/index.html b/docs/_site/rules/radix/index.html deleted file mode 100644 index 9a8ceca4e16..00000000000 --- a/docs/_site/rules/radix/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: radix - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: radix

-

-
- - -

Requires the radix parameter to be specified when calling parseInt.

- - - - -
Rationale
- -

From MDN:

-
-

Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. -Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

-
- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"radix": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/restrict-plus-operands/index.html b/docs/_site/rules/restrict-plus-operands/index.html deleted file mode 100644 index 1275aa0163f..00000000000 --- a/docs/_site/rules/restrict-plus-operands/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: restrict-plus-operands - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: restrict-plus-operands

-

-
- - -

When adding two variables, operands must both be of type number or of type string.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"restrict-plus-operands": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/return-undefined/index.html b/docs/_site/rules/return-undefined/index.html deleted file mode 100644 index 283dff0140b..00000000000 --- a/docs/_site/rules/return-undefined/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: return-undefined - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: return-undefined

-

-
- - -

Prefer return; in void functions and return undefined; in value-returning functions.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"return-undefined": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/semicolon/index.html b/docs/_site/rules/semicolon/index.html deleted file mode 100644 index 5ee5bc6c5ce..00000000000 --- a/docs/_site/rules/semicolon/index.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - Rule: semicolon - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: semicolon

-

-
- - -

Enforces consistent semicolon usage at the end of every statement.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • "always" enforces semicolons at the end of every statement.
  • -
  • "never" disallows semicolons at the end of every statement except for when they are necessary.
  • -
- -

The following arguments may be optionally provided:

- -
    -
  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • -
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • -
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any -other assignment. This option overrides "ignore-bound-class-methods".
  • -
- - - -
Config examples
- -
-"semicolon": [true, "always"]
-
- -
-"semicolon": [true, "never"]
-
- -
-"semicolon": [true, "always", "ignore-interfaces"]
-
- -
-"semicolon": [true, "always", "ignore-bound-class-methods"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string",
-      "enum": [
-        "always",
-        "never"
-      ]
-    },
-    {
-      "type": "string",
-      "enum": [
-        "ignore-interfaces"
-      ]
-    }
-  ],
-  "additionalItems": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/space-before-function-paren/index.html b/docs/_site/rules/space-before-function-paren/index.html deleted file mode 100644 index 1b86f637dd2..00000000000 --- a/docs/_site/rules/space-before-function-paren/index.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - Rule: space-before-function-paren - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: space-before-function-paren

-

-
- - -

Require or disallow a space before function parenthesis

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One argument which is an object which may contain the keys anonymous, named, and asyncArrow -These should be set to either "always" or "never".

- -
    -
  • "anonymous" checks before the opening paren in anonymous functions
  • -
  • "named" checks before the opening paren in named functions
  • -
  • "asyncArrow" checks before the opening paren in async arrow functions
  • -
  • "method" checks before the opening paren in class methods
  • -
  • "constructor" checks before the opening paren in class constructors
  • -
- - - -
Config examples
- -
-"space-before-function-paren": true
-
- -
-"space-before-function-paren": [true, "always"]
-
- -
-"space-before-function-paren": [true, "never"]
-
- -
-"space-before-function-paren": [true, {"anonymous": "always", "named": "never", "asyncArrow": "always"}]
-
- - -
Schema
-
-{
-  "properties": {
-    "anonymous": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "asyncArrow": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "constructor": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "method": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "named": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    }
-  },
-  "type": "object"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/space-within-parens/index.html b/docs/_site/rules/space-within-parens/index.html deleted file mode 100644 index 164b8dd93b5..00000000000 --- a/docs/_site/rules/space-within-parens/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: space-within-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: space-within-parens

-

-
- - -

Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

You may enforce the amount of whitespace within parentheses.

- - - -
Config examples
- - -
Schema
-
-{
-  "type": "number",
-  "min": 0
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/strict-boolean-expressions/index.html b/docs/_site/rules/strict-boolean-expressions/index.html deleted file mode 100644 index b17f9c49c8e..00000000000 --- a/docs/_site/rules/strict-boolean-expressions/index.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - Rule: strict-boolean-expressions - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: strict-boolean-expressions

-

-
- - - -

Restricts the types allowed in boolean expressions. By default only booleans are allowed.

- -

The following nodes are checked:

- -
    -
  • Arguments to the !, &&, and || operators
  • -
  • The condition in a conditional expression (cond ? x : y)
  • -
  • Conditions for if, for, while, and do-while statements.
  • -
- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

These options may be provided:

- -
    -
  • allow-null-union allows union types containing null. -
      -
    • It does not allow null itself.
    • -
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • -
    -
  • -
  • allow-undefined-union allows union types containing undefined. -
      -
    • It does not allow undefined itself.
    • -
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • -
    -
  • -
  • allow-string allows strings. -
      -
    • It does not allow unions containing string.
    • -
    • It does not allow string literal types.
    • -
    -
  • -
  • allow-number allows numbers. -
      -
    • It does not allow unions containing number.
    • -
    • It does not allow enums or number literal types.
    • -
    -
  • -
  • allow-mix allows multiple of the above to appear together. -
      -
    • For example, string | number or RegExp | null | undefined would normally not be allowed.
    • -
    • A type like "foo" | "bar" | undefined is always allowed, because it has only one way to be false.
    • -
    -
  • -
  • allow-boolean-or-undefined allows boolean | undefined. -
      -
    • Also allows true | false | undefined.
    • -
    • Does not allow false | undefined.
    • -
    • This option is a subset of allow-undefined-union, so you don’t need to enable both options at the same time.
    • -
    -
  • -
- - - -
Config examples
- -
-"strict-boolean-expressions": true
-
- -
-"strict-boolean-expressions": [
-  true,
-  "allow-null-union",
-  "allow-undefined-union",
-  "allow-string",
-  "allow-number"
-]
-
- -
-"strict-boolean-expressions": [true, "allow-boolean-or-undefined"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-null-union",
-      "allow-undefined-union",
-      "allow-string",
-      "allow-number",
-      "allow-boolean-or-undefined"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/strict-type-predicates/index.html b/docs/_site/rules/strict-type-predicates/index.html deleted file mode 100644 index 90551c4f0ac..00000000000 --- a/docs/_site/rules/strict-type-predicates/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: strict-type-predicates - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: strict-type-predicates

-

-
- - - -

Warns for type predicates that are always true or always false. -Works for ‘typeof’ comparisons to constants (e.g. ‘typeof foo === “string”’), and equality comparison to ‘null’/’undefined’. -(TypeScript won’t let you compare ‘1 === 2’, but it has an exception for ‘1 === undefined’.) -Does not yet work for ‘instanceof’. -Does not warn for ‘if (x.y)’ where ‘x.y’ is always truthy. For that, see strict-boolean-expressions.

- -

This rule requires strictNullChecks to work properly.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"strict-type-predicates": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/switch-default/index.html b/docs/_site/rules/switch-default/index.html deleted file mode 100644 index 9a259fcd44a..00000000000 --- a/docs/_site/rules/switch-default/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: switch-default - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: switch-default

-

-
- - -

Require a default case in all switch statements.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"switch-default": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/switch-final-break/index.html b/docs/_site/rules/switch-final-break/index.html deleted file mode 100644 index a3c7ec04bea..00000000000 --- a/docs/_site/rules/switch-final-break/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: switch-final-break - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: switch-final-break

-

-
- - -

Checks whether the final clause of a switch statement ends in break;.

- - - - - - - -

Config

- -

If no options are passed, a final ‘break;’ is forbidden. -If the “always” option is passed this will require a ‘break;’ to always be present -unless control flow is escaped in some other way.

- - -
Config examples
- -
-"switch-final-break": true
-
- -
-"switch-final-break": [true, "always"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/trailing-comma/index.html b/docs/_site/rules/trailing-comma/index.html deleted file mode 100644 index 91ca73fee0e..00000000000 --- a/docs/_site/rules/trailing-comma/index.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - Rule: trailing-comma - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: trailing-comma

-

-
- - - -

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, -named imports and exports and function parameters.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One argument which is an object with the keys multiline and singleline. -Both can be set to a string ("always" or "never") or an object.

- -

The object can contain any of the following keys: "arrays", "objects", "functions", -"imports", "exports", and "typeLiterals"; each key can have one of the following -values: "always", "never", and "ignore". Any missing keys will default to "ignore".

- -
    -
  • "multiline" checks multi-line object literals.
  • -
  • "singleline" checks single-line object literals.
  • -
- -

An array is considered “multiline” if its closing bracket is on a line -after the last array element. The same general logic is followed for -object literals, function typings, named import statements -and function parameters.

- -

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, -there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on -object and array rest and rest parameters.

- - - -
Config examples
- -
-"trailing-comma": [true, {"multiline": "always", "singleline": "never"}]
-
- -
-"trailing-comma": [
-  true,
-  {
-    "multiline": {
-      "objects": "always",
-      "arrays": "always",
-      "functions": "never",
-      "typeLiterals": "ignore"
-    },
-    "esSpecCompliant": true
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "multiline": {
-      "anyOf": [
-        {
-          "type": "string",
-          "enum": [
-            "always",
-            "never"
-          ]
-        },
-        {
-          "type": "object",
-          "properties": {
-            "arrays": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "exports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "functions": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "imports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "objects": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "typeLiterals": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            }
-          }
-        }
-      ]
-    },
-    "singleline": {
-      "anyOf": [
-        {
-          "type": "string",
-          "enum": [
-            "always",
-            "never"
-          ]
-        },
-        {
-          "type": "object",
-          "properties": {
-            "arrays": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "exports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "functions": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "imports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "objects": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "typeLiterals": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            }
-          }
-        }
-      ]
-    },
-    "esSpecCompliant": {
-      "type": "boolean"
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/triple-equals/index.html b/docs/_site/rules/triple-equals/index.html deleted file mode 100644 index e1a52692712..00000000000 --- a/docs/_site/rules/triple-equals/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: triple-equals - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: triple-equals

-

-
- - -

Requires === and !== in place of == and !=.

- - - - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • "allow-null-check" allows == and != when comparing to null.
  • -
  • "allow-undefined-check" allows == and != when comparing to undefined.
  • -
- - -
Config examples
- -
-"triple-equals": true
-
- -
-"triple-equals": [true, "allow-null-check"]
-
- -
-"triple-equals": [true, "allow-undefined-check"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-null-check",
-      "allow-undefined-check"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/type-literal-delimiter/index.html b/docs/_site/rules/type-literal-delimiter/index.html deleted file mode 100644 index cc11e78c589..00000000000 --- a/docs/_site/rules/type-literal-delimiter/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: type-literal-delimiter - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: type-literal-delimiter

-

-
- - - -

Checks that type literal members are separated by semicolons. -Enforces a trailing semicolon for multiline type literals.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"type-literal-delimiter": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typedef-whitespace/index.html b/docs/_site/rules/typedef-whitespace/index.html deleted file mode 100644 index 9577ca446ee..00000000000 --- a/docs/_site/rules/typedef-whitespace/index.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - Rule: typedef-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typedef-whitespace

-

-
- - -

Requires or disallows whitespace for type definitions.

- - -

Determines if a space is required or not before the colon in a type specifier.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

Two arguments which are both objects. -The first argument specifies how much space should be to the left of a typedef colon. -The second argument specifies how much space should be to the right of a typedef colon. -Each key should have a value of "onespace", "space" or "nospace". -Possible keys are:

- -
    -
  • "call-signature" checks return type of functions.
  • -
  • "index-signature" checks index type specifier of indexers.
  • -
  • "parameter" checks function parameters.
  • -
  • "property-declaration" checks object property declarations.
  • -
  • "variable-declaration" checks variable declaration.
  • -
- - -
Config examples
- -
-"typedef-whitespace": [
-  true,
-  {
-    "call-signature": "nospace",
-    "index-signature": "nospace",
-    "parameter": "nospace",
-    "property-declaration": "nospace",
-    "variable-declaration": "nospace"
-  },
-  {
-    "call-signature": "onespace",
-    "index-signature": "onespace",
-    "parameter": "onespace",
-    "property-declaration": "onespace",
-    "variable-declaration": "onespace"
-  }
-]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "object",
-      "properties": {
-        "call-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "index-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "parameter": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "property-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "variable-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        }
-      },
-      "additionalProperties": false
-    },
-    {
-      "type": "object",
-      "properties": {
-        "call-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "index-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "parameter": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "property-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "variable-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        }
-      },
-      "additionalProperties": false
-    }
-  ],
-  "additionalItems": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typedef/index.html b/docs/_site/rules/typedef/index.html deleted file mode 100644 index db818114025..00000000000 --- a/docs/_site/rules/typedef/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: typedef - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typedef

-

-
- - -

Requires type definitions to exist.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

Several arguments may be optionally provided:

- -
    -
  • "call-signature" checks return type of functions.
  • -
  • "arrow-call-signature" checks return type of arrow functions.
  • -
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • -
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • -
  • "property-declaration" checks return types of interface properties.
  • -
  • "variable-declaration" checks non-binding variable declarations.
  • -
  • "member-variable-declaration" checks member variable declarations.
  • -
  • "object-destructuring" checks object destructuring declarations.
  • -
  • "array-destructuring" checks array destructuring declarations.
  • -
- - -
Config examples
- -
-"typedef": [true, "call-signature", "parameter", "member-variable-declaration"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "call-signature",
-      "arrow-call-signature",
-      "parameter",
-      "arrow-parameter",
-      "property-declaration",
-      "variable-declaration",
-      "member-variable-declaration",
-      "object-destructuring",
-      "array-destructuring"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 7
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typeof-compare/index.html b/docs/_site/rules/typeof-compare/index.html deleted file mode 100644 index 8bf29aeea38..00000000000 --- a/docs/_site/rules/typeof-compare/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: typeof-compare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typeof-compare

-

-
- - -

Makes sure result of typeof is compared to correct string values

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"typeof-compare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/unified-signatures/index.html b/docs/_site/rules/unified-signatures/index.html deleted file mode 100644 index 35d5c431165..00000000000 --- a/docs/_site/rules/unified-signatures/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: unified-signatures - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: unified-signatures

-

-
- - -

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"unified-signatures": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/use-default-type-parameter/index.html b/docs/_site/rules/use-default-type-parameter/index.html deleted file mode 100644 index 00af31cac99..00000000000 --- a/docs/_site/rules/use-default-type-parameter/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: use-default-type-parameter - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: use-default-type-parameter

-

-
- - -

Warns if an explicitly specified type argument is the default for that type parameter.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"use-default-type-parameter": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/use-isnan/index.html b/docs/_site/rules/use-isnan/index.html deleted file mode 100644 index a857b2254da..00000000000 --- a/docs/_site/rules/use-isnan/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - Rule: use-isnan - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: use-isnan

-

-
- - -

Enforces use of the isNaN() function to check for NaN references instead of a comparison to the NaN constant.

- - - - -
Rationale
- -

Since NaN !== NaN, comparisons with regular operators will produce unexpected results. -So, instead of if (myVar === NaN), do if (isNaN(myVar)).

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"use-isnan": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/variable-name/index.html b/docs/_site/rules/variable-name/index.html deleted file mode 100644 index 591b3432fce..00000000000 --- a/docs/_site/rules/variable-name/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: variable-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: variable-name

-

-
- - -

Checks variable names for various errors.

- - - - - - - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "check-format": allows only lowerCamelCased or UPPER_CASED variable names -
      -
    • "allow-leading-underscore" allows underscores at the beginning (only has an effect if “check-format” specified)
    • -
    • "allow-trailing-underscore" allows underscores at the end. (only has an effect if “check-format” specified)
    • -
    • "allow-pascal-case" allows PascalCase in addition to lowerCamelCase.
    • -
    • "allow-snake-case" allows snake_case in addition to lowerCamelCase.
    • -
    -
  • -
  • "ban-keywords": disallows the use of certain TypeScript keywords as variable or parameter names. -
      -
    • These are: any, Number, number, String, string, Boolean, boolean, Undefined, undefined
    • -
    -
  • -
- - -
Config examples
- -
-"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-format",
-      "allow-leading-underscore",
-      "allow-trailing-underscore",
-      "allow-pascal-case",
-      "allow-snake-case",
-      "ban-keywords"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/whitespace/index.html b/docs/_site/rules/whitespace/index.html deleted file mode 100644 index 39b41928e7e..00000000000 --- a/docs/_site/rules/whitespace/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - Rule: whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: whitespace

-

-
- - -

Enforces whitespace style conventions.

- - - - -
Rationale
-

Helps maintain a readable, consistent style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Ten arguments may be optionally provided:

- -
    -
  • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
  • -
  • "check-decl"checks that variable declarations have whitespace around the equals token.
  • -
  • "check-operator" checks for whitespace around operator tokens.
  • -
  • "check-module" checks for whitespace in import & export statements.
  • -
  • "check-separator" checks for whitespace after separator tokens (,/;).
  • -
  • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
  • -
  • "check-type" checks for whitespace before a variable type specification.
  • -
  • "check-typecast" checks for whitespace between a typecast and its target.
  • -
  • "check-type-operator" checks for whitespace between type operators | and &.
  • -
  • "check-preblock" checks for whitespace before the opening brace of a block
  • -
- - -
Config examples
- -
-"whitespace": [true, "check-branch", "check-operator", "check-typecast"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-branch",
-      "check-decl",
-      "check-operator",
-      "check-module",
-      "check-separator",
-      "check-rest-spread",
-      "check-type",
-      "check-typecast",
-      "check-type-operator",
-      "check-preblock"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 10
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/cli/index.html b/docs/_site/usage/cli/index.html deleted file mode 100644 index 770702a244e..00000000000 --- a/docs/_site/usage/cli/index.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - TSLint command-line interface - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint command-line interface

-

-
- - -

Installation

- -

Local (in your project’s working directory):

- -
npm install tslint typescript --save-dev
-# or
-yarn add tslint typescript --dev
-
- -

Global:

- -
npm install tslint typescript -g
-# or
-yarn global add tslint typescript
-
- -
Peer dependencies
- -

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. -This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

- -

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

- -

CLI Usage

- -

Please ensure that the TypeScript source files compile correctly before running the linter.

- -

Usage: tslint [options] [file ...]

- -

Options:

- -
-v, --version                          output the version number
--c, --config [config]                  configuration file
--e, --exclude <exclude>                exclude globs from path expansion
---fix                                  fixes linting errors for select rules (this may overwrite linted files)
---force                                return status code 0 even if there are lint errors
--i, --init                             generate a tslint.json config file in the current working directory
--o, --out [out]                        output file
---outputAbsolutePaths                  whether or not outputted file paths are absolute
--r, --rules-dir [rules-dir]            rules directory
--s, --formatters-dir [formatters-dir]  formatters directory
--t, --format [format]                  output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)
---test                                 test that tslint produces the correct output for the specified directory
--p, --project [project]                tsconfig.json file
---type-check                           (deprecated) check for type errors before linting the project
--h, --help                             output usage information
-
- -

By default, TSLint looks for a configuration file named tslint.json in the directory -of the file being linted and, if not found, searches ancestor directories. Check out the rules section for more details on what rules are available.

- -

tslint accepts the following command-line options:

- -
-c, --config:
-    The location of the configuration file that tslint will use to
-    determine which rules are activated and what options to provide
-    to the rules. If no option is specified, the config file named
-    tslint.json is used, so long as it exists in the path.
-    The format of the file is { rules: { /* rules list */ } },
-    where /* rules list */ is a key: value comma-separated list of
-    rulename: rule-options pairs. Rule-options can be either a
-    boolean true/false value denoting whether the rule is used or not,
-    or a list [boolean, ...] where the boolean provides the same role
-    as in the non-list case, and the rest of the list are options passed
-    to the rule that will determine what it checks for (such as number
-    of characters for the max-line-length rule, or what functions to ban
-    for the ban rule).
-
--e, --exclude:
-    A filename or glob which indicates files to exclude from linting.
-    This option can be supplied multiple times if you need multiple
-    globs to indicate which files to exclude.
-
---fix:
-    Fixes linting errors for select rules. This may overwrite linted files.
-
---force:
-    Return status code 0 even if there are any lint errors.
-    Useful while running as npm script.
-
--i, --init:
-    Generates a tslint.json config file in the current working directory.
-
--o, --out:
-    A filename to output the results to. By default, tslint outputs to
-    stdout, which is usually the console where you're running it from.
-
---outputAbsolutePaths:
-    If true, all paths in the output will be absolute.
-
--r, --rules-dir:
-    An additional rules directory, for user-created rules.
-    tslint will always check its default rules directory, in
-    node_modules/tslint/lib/rules, before checking the user-provided
-    rules directory, so rules in the user-provided rules directory
-    with the same name as the base rules will not be loaded.
-
--s, --formatters-dir:
-    An additional formatters directory, for user-created formatters.
-    Formatters are files that will format the tslint output, before
-    writing it to stdout or the file passed in --out. The default
-    directory, node_modules/tslint/build/formatters, will always be
-    checked first, so user-created formatters with the same names
-    as the base formatters will not be loaded.
-
--t, --format:
-    The formatter to use to format the results of the linter before
-    outputting it to stdout or the file passed in --out. The core
-    formatters are prose (human readable), json (machine readable)
-    and verbose. prose is the default if this option is not used.
-    Other built-in options include pmd, msbuild, checkstyle, and vso.
-    Additional formatters can be added and used if the --formatters-dir
-    option is set.
-
---test:
-    Runs tslint on matched directories and checks if tslint outputs
-    match the expected output in .lint files. Automatically loads the
-    tslint.json files in the directories as the configuration file for
-    the tests. See the full tslint documentation for more details on how
-    this can be used to test custom rules.
-
--p, --project:
-    The path or directory containing a tsconfig.json file that will be
-    used to determine which files will be linted. This flag also enables
-    rules that require the type checker.
-
---type-check:
-    (deprecated) Checks for type errors before linting a project.
-    --project must be specified in order to enable type checking.
-
--v, --version:
-    The current version of tslint.
-
--h, --help:
-    Prints this help message.
-
- -

Exit Codes

- -

The CLI process may exit with the following codes:

- -
    -
  • 0: Linting succeeded without errors (warnings may have occurred)
  • -
  • 1: An invalid command line argument or combination thereof was used
  • -
  • 2: Linting failed with one or more rule violations with severity error
  • -
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/configuration/index.html b/docs/_site/usage/configuration/index.html deleted file mode 100644 index 8396f37921a..00000000000 --- a/docs/_site/usage/configuration/index.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - Configuring TSLint - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Configuring TSLint

-

-
- - -

TSLint Configuration

- -

When using the CLI or many third-party tools, a file named tslint.json or tslint.yaml is used to -configure which rules get run and each of their options.

- -

tslint.json or tslint.yaml files can have the following fields specified:

- -
    -
  • extends?: string | string[]: -The name of a built-in configuration preset (see built-in presets below), or a path or -array of paths to other configuration files which are extended by this configuration. -This value is handled using node module resolution semantics. -For example, a value of "tslint-config" would tell TSLint to try and load the main file of a module -named “tslint-config” as a configuration file. Specific files inside node modules can also be -specified, eg. "tslint-config/path/to/submodule". Relative paths to JSON files or JS modules -are also supported, e.g. "./tslint-config".
  • -
  • rulesDirectory?: string | string[]: -A path to a directory or an array of paths to directories of custom rules. These values are handled using node module resolution semantics, if an index.js is placed in your rules directory. We fallback to use relative or absolute paths, if the module can’t be resolved. If you want to avoid module resolution you can directly use a relative or absolute path (e.g. with ./).
  • -
  • rules?: { [name: string]: RuleSetting }: A map of rule names to their configuration settings. -
      -
    • These rules are applied to .ts and .tsx files.
    • -
    • Each rule is associated with an object containing: -
        -
      • options?: any: An array of values that are specific to a rule.
      • -
      • severity?: "default" | "error" | "warning" | "off": Severity level. Level “error” will cause exit code 2.
      • -
      -
    • -
    • A boolean value may be specified instead of the above object, and is equivalent to setting no options with default severity.
    • -
    • Any rules specified in this block will override those configured in any base configuration being extended.
    • -
    • Check out the full rules list here.
    • -
    -
  • -
  • jsRules?: any: Same format as rules. These rules are applied to .js and .jsx files.
  • -
  • defaultSeverity?: "error" | "warning" | "off": The severity level used when a rule specifies a default warning level. If undefined, “error” is used. This value is not inherited and is only applied to rules in this file.
  • -
  • linterOptions?: { exclude?: string[] }: -
      -
    • exclude: string[]: An array of globs. Any file matching these globs will not be linted. All exclude patterns are relative to the configuration file they were specified in.
    • -
    -
  • -
- -

tslint.json configuration files may have JavaScript-style // single-line and /* multi-line */ comments in them (even though this is technically invalid JSON). If this confuses your syntax highlighter, you may want to switch it to JavaScript format.

- -

An example tslint.json file might look like this:

- -
{
-    "extends": "tslint:recommended",
-    "rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"],
-    "rules": {
-        "max-line-length": {
-            "options": [120]
-        },
-        "new-parens": true,
-        "no-arg": true,
-        "no-bitwise": true,
-        "no-conditional-assignment": true,
-        "no-consecutive-blank-lines": false,
-        "no-console": {
-            "severity": "warning",
-            "options": [
-                "debug",
-                "info",
-                "log",
-                "time",
-                "timeEnd",
-                "trace",
-            ]
-        }
-    },
-    "jsRules": {
-        "max-line-length": {
-            "options": [120]
-        }
-    }
-}
-
- -

The corresponding YAML file looks like this:

- -
---
-extends: "tslint:recommended"
-rulesDirectory:
-    - path/to/custom/rules/directory/
-    - another/path/
-rules:
-    max-line-length:
-        options: [120]
-    new-parens: true
-    no-arg: true
-    no-bitwise: true
-    no-conditional-assignment: true
-    no-consecutive-blank-lines: false
-    no-console:
-        severity: warning
-        options:
-            - debug
-            - info
-            - log
-            - time
-            - timeEnd
-            - trace
-jsRules:
-    max-line-length:
-        options: [120]
-...
-
- -

Rule severity

- -

The severity level of each rule can can be configured to default, error, warning/warn, or off/none. If no severity level is specified, default is used. The defaultSeverity top-level option replaces the severity level for each rule that uses severity level default in the current file. Valid values for defaultSeverity include error, warning/warn, and off/none.

- -

Configuration presets

- -

TSLint ships with a handful of built-in configurations presets. You may inspect their source here.

- -

tslint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will not have breaking changes across minor or patch releases.

- -

tslint:latest extends tslint:recommended and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, tslint:recommended will be updated to be identical to tslint:latest.

- -

tslint:all turns on all rules to their strictest settings. This will use type checking, so it must be combined with the --project option. -(Exceptions include rules such as "ban", "import-blacklist", and "file-header", which have no sensible defaults, and deprecated rules.)

- -

Custom rules

- -

If TSLint’s core rules don’t have all the lint checks you’re looking for, -you may write your own custom rules or use custom rules that others have developed.

- -

Some commonly used custom rule packages in the TSLint community are listed in the -README.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/library/index.html b/docs/_site/usage/library/index.html deleted file mode 100644 index b34cb6228f6..00000000000 --- a/docs/_site/usage/library/index.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - Using TSLint as a Node.js library - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Using TSLint as a Node.js library

-

-
- - -

Installation

- -
npm install tslint typescript
-# or
-yarn add tslint typescript
-
- -
Peer dependencies
- -

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. -This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

- -

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

- -

Library usage

- -

Please ensure that the TypeScript source files compile correctly before running the linter.

- -

TypeScript

- -

This code will need to be transpiled to JavaScript to run under Node.js.

- -
import { Linter, Configuration } from "tslint";
-import * as fs from "fs";
-
-const fileName = "Specify input file name";
-const configurationFilename = "Specify configuration file name";
-const options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-
-const fileContents = fs.readFileSync(fileName, "utf8");
-const linter = new Linter(options);
-const configuration = Configuration.findConfiguration(configurationFilename, fileName).results;
-linter.lint(fileName, fileContents, configuration);
-const result = linter.getResult();
-
- -

JavaScript (ES5)

- -

This code will run directly under Node.js, including if it’s called from the command line.

- -
"use strict";
-var tslint = require("tslint");
-var fs = require("fs");
-var fileName = "Specify input file name";
-var configurationFilename = "Specify configuration file name";
-var options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-var fileContents = fs.readFileSync(fileName, "utf8");
-var linter = new tslint.Linter(options);
-var configuration = tslint.Configuration.findConfiguration(configurationFilename, fileName).results;
-linter.lint(fileName, fileContents, configuration);
-var result = linter.getResult();
-
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/rule-flags/index.html b/docs/_site/usage/rule-flags/index.html deleted file mode 100644 index 68c2da9dd46..00000000000 --- a/docs/_site/usage/rule-flags/index.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - TSLint rule flags - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint rule flags

-

-
- - -

Comment flags in source code

- -

In addition to global configuration, you may also enable/disable linting or a subset of lint rules within a file with the following comment rule flags:

- -
    -
  • /* tslint:disable */ - Disable all rules for the rest of the file
  • -
  • /* tslint:enable */ - Enable all rules for the rest of the file
  • -
  • /* tslint:disable:rule1 rule2 rule3... */ - Disable the listed rules for the rest of the file
  • -
  • /* tslint:enable:rule1 rule2 rule3... */ - Enable the listed rules for the rest of the file
  • -
  • // tslint:disable-next-line - Disables all rules for the following line
  • -
  • someCode(); // tslint:disable-line - Disables all rules for the current line
  • -
  • // tslint:disable-next-line:rule1 rule2 rule3... - Disables the listed rules for the next line
  • -
  • etc.
  • -
- -

Rules flags enable or disable rules as they are parsed. Disabling an already disabled rule or enabling an already enabled rule has no effect. Enabling a rule that is not present or disabled in tslint.json has also no effect.

- -

For example, imagine the directive /* tslint:disable */ on the first line of a file, /* tslint:enable:ban class-name */ on the 10th line and /* tslint:enable */ on the 20th. No rules will be checked between the 1st and 10th lines, only the ban and class-name rules will be checked between the 10th and 20th, and all rules will be checked for the remainder of the file.

- -

Here’s an example:

- -
function validRange (range: any) {
-   return range.min <= range.middle && range.middle <= range.max;
-}
-
-/* tslint:disable:object-literal-sort-keys */
-const range = {
-   min: 5,
-   middle: 10,    // TSLint will *not* warn about unsorted keys here
-   max: 20
-};
-/* tslint:enable:object-literal-sort-keys */
-
-const point = {
-   x: 3,
-   z: 5,          // TSLint will warn about unsorted keys here
-   y: 4,
-}
-
-console.log(validRange(range));
-
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/third-party-tools/index.html b/docs/_site/usage/third-party-tools/index.html deleted file mode 100644 index c34ca08b36b..00000000000 --- a/docs/_site/usage/third-party-tools/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Third-Party Tools - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Third-Party Tools

-

-
- - -

A variety of tools and libraries are available to help you integrate TSLint automatically into your build process or IDE. Please see their respective sites for usage.

- -

Note: Most of these tools are not maintained by TSLint.

- - - - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/type-checking/index.html b/docs/_site/usage/type-checking/index.html deleted file mode 100644 index 19fbe5be788..00000000000 --- a/docs/_site/usage/type-checking/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - Type Checking - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Type Checking

-

-
- - -

Semantic lint rules

- -

Some TSLint rules go further than linting code syntax. Semantic rules use the compiler’s program APIs to inspect static types and validate code patterns.

- -
CLI
- -

When using the CLI, use the --project flag and specify your tsconfig.json to enable rules that work with the type checker. TSLint will lint all files included in your project as specified in tsconfig.json.

- -
tslint --project tsconfig.json --config tslint.json # lints every file in your project
-tslint -p . -c tslint.json # shorthand of the command above
-tslint -p tsconfig.json --exclude '**/*.d.ts' # lint all files in the project excluding declaration files
-tslint -p tsconfig.json **/*.ts # ignores files in tsconfig.json and uses the provided glob instead
-
- -
Library
- -

To enable rules that work with the type checker, a TypeScript program object must be passed to the linter when using the programmatic API. Helper functions are provided to create a program from a tsconfig.json file. A project directory can be specified if project files do not lie in the same directory as the tsconfig.json file.

- -
import { Linter, Configuration } from "tslint";
-
-const configurationFilename = "Specify configuration file name";
-const options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-
-const program = Linter.createProgram("tsconfig.json", "projectDir/");
-const linter = new Linter(options, program);
-
-const files = Linter.getFileNames(program);
-files.forEach(file => {
-    const fileContents = program.getSourceFile(file).getFullText();
-    const configuration = Configuration.findConfiguration(configurationFilename, file).results;
-    linter.lint(file, fileContents, configuration);
-});
-
-const results = linter.getResult();
-
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - From 6ba33dfb146ffe1dbcd0811b2659fca23ba3cf1e Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Fri, 13 Apr 2018 07:59:04 -0400 Subject: [PATCH 11/12] moving code examples to dedicated dir to avoid bloat in rule files --- docs/_layouts/rule.html | 4 +- .../2015/12/10/a-new-tslint-website.html | 122 + .../03/31/sharable-configurations-rules.html | 203 ++ docs/_site/2016/11/17/new-for-4.0.html | 163 ++ docs/_site/Gemfile | 2 + docs/_site/Gemfile.lock | 238 ++ docs/_site/circle.yml | 7 + docs/_site/css/main.css | 989 ++++++++ docs/_site/develop/contributing/index.html | 178 ++ .../develop/custom-formatters/index.html | 162 ++ docs/_site/develop/custom-rules/index.html | 224 ++ .../custom-rules/performance-tips.html | 295 +++ .../develop/custom-rules/walker-design.html | 320 +++ docs/_site/develop/docs/index.html | 163 ++ docs/_site/develop/testing-rules/index.html | 322 +++ docs/_site/feed.xml | 232 ++ docs/_site/formatters/checkstyle/index.html | 130 + docs/_site/formatters/codeFrame/index.html | 134 ++ docs/_site/formatters/filesList/index.html | 120 + docs/_site/formatters/index.html | 155 ++ docs/_site/formatters/json/index.html | 142 ++ docs/_site/formatters/junit/index.html | 132 + docs/_site/formatters/msbuild/index.html | 123 + docs/_site/formatters/pmd/index.html | 128 + docs/_site/formatters/prose/index.html | 120 + docs/_site/formatters/stylish/index.html | 127 + docs/_site/formatters/tap/index.html | 137 ++ docs/_site/formatters/verbose/index.html | 123 + docs/_site/formatters/vso/index.html | 125 + docs/_site/index.html | 117 + docs/_site/news/index.html | 202 ++ .../adjacent-overload-signatures/index.html | 150 ++ docs/_site/rules/align/index.html | 174 ++ docs/_site/rules/array-type/index.html | 170 ++ docs/_site/rules/arrow-parens/index.html | 161 ++ .../rules/arrow-return-shorthand/index.html | 156 ++ docs/_site/rules/await-promise/index.html | 173 ++ .../_site/rules/ban-comma-operator/index.html | 170 ++ docs/_site/rules/ban-types/index.html | 160 ++ docs/_site/rules/ban/index.html | 212 ++ .../index.html | 139 ++ docs/_site/rules/callable-types/index.html | 148 ++ docs/_site/rules/class-name/index.html | 141 ++ docs/_site/rules/comment-format/index.html | 201 ++ docs/_site/rules/completed-docs/index.html | 553 +++++ docs/_site/rules/curly/index.html | 263 ++ .../rules/cyclomatic-complexity/index.html | 168 ++ docs/_site/rules/deprecation/index.html | 151 ++ docs/_site/rules/encoding/index.html | 137 ++ docs/_site/rules/eofline/index.html | 153 ++ docs/_site/rules/file-header/index.html | 162 ++ docs/_site/rules/forin/index.html | 150 ++ docs/_site/rules/import-blacklist/index.html | 155 ++ docs/_site/rules/import-spacing/index.html | 137 ++ docs/_site/rules/indent/index.html | 197 ++ docs/_site/rules/index.html | 2129 +++++++++++++++++ docs/_site/rules/interface-name/index.html | 166 ++ .../interface-over-type-literal/index.html | 152 ++ docs/_site/rules/jsdoc-format/index.html | 171 ++ docs/_site/rules/label-position/index.html | 147 ++ docs/_site/rules/linebreak-style/index.html | 162 ++ .../match-default-export-name/index.html | 150 ++ .../rules/max-classes-per-file/index.html | 167 ++ .../rules/max-file-line-count/index.html | 146 ++ docs/_site/rules/max-line-length/index.html | 191 ++ docs/_site/rules/member-access/index.html | 181 ++ docs/_site/rules/member-ordering/index.html | 266 ++ docs/_site/rules/new-parens/index.html | 141 ++ .../rules/newline-before-return/index.html | 141 ++ .../rules/newline-per-chained-call/index.html | 139 ++ .../index.html | 155 ++ docs/_site/rules/no-any/index.html | 150 ++ docs/_site/rules/no-arg/index.html | 144 ++ docs/_site/rules/no-bitwise/index.html | 151 ++ .../no-boolean-literal-compare/index.html | 150 ++ .../no-conditional-assignment/index.html | 147 ++ .../no-consecutive-blank-lines/index.html | 159 ++ docs/_site/rules/no-console/index.html | 146 ++ docs/_site/rules/no-construct/index.html | 147 ++ docs/_site/rules/no-debugger/index.html | 141 ++ docs/_site/rules/no-default-export/index.html | 147 ++ .../rules/no-duplicate-imports/index.html | 144 ++ .../_site/rules/no-duplicate-super/index.html | 141 ++ .../rules/no-duplicate-switch-case/index.html | 137 ++ .../rules/no-duplicate-variable/index.html | 157 ++ docs/_site/rules/no-dynamic-delete/index.html | 148 ++ .../_site/rules/no-empty-interface/index.html | 146 ++ docs/_site/rules/no-empty/index.html | 154 ++ docs/_site/rules/no-eval/index.html | 144 ++ .../rules/no-floating-promises/index.html | 169 ++ docs/_site/rules/no-for-in-array/index.html | 161 ++ .../rules/no-implicit-dependencies/index.html | 165 ++ .../rules/no-import-side-effect/index.html | 162 ++ .../rules/no-inferrable-types/index.html | 178 ++ .../no-inferred-empty-object-type/index.html | 148 ++ .../_site/rules/no-internal-module/index.html | 152 ++ .../no-invalid-template-strings/index.html | 137 ++ docs/_site/rules/no-invalid-this/index.html | 160 ++ .../rules/no-irregular-whitespace/index.html | 146 ++ docs/_site/rules/no-magic-numbers/index.html | 155 ++ .../rules/no-mergeable-namespace/index.html | 146 ++ docs/_site/rules/no-misused-new/index.html | 146 ++ docs/_site/rules/no-namespace/index.html | 174 ++ .../rules/no-non-null-assertion/index.html | 150 ++ docs/_site/rules/no-null-keyword/index.html | 152 ++ .../index.html | 157 ++ .../rules/no-parameter-properties/index.html | 152 ++ .../no-parameter-reassignment/index.html | 137 ++ .../_site/rules/no-redundant-jsdoc/index.html | 146 ++ .../rules/no-reference-import/index.html | 142 ++ docs/_site/rules/no-reference/index.html | 143 ++ .../_site/rules/no-require-imports/index.html | 141 ++ docs/_site/rules/no-return-await/index.html | 153 ++ .../rules/no-shadowed-variable/index.html | 213 ++ docs/_site/rules/no-sparse-arrays/index.html | 141 ++ docs/_site/rules/no-string-literal/index.html | 155 ++ docs/_site/rules/no-string-throw/index.html | 142 ++ .../rules/no-submodule-imports/index.html | 154 ++ .../no-switch-case-fall-through/index.html | 166 ++ .../_site/rules/no-this-assignment/index.html | 163 ++ .../rules/no-trailing-whitespace/index.html | 177 ++ docs/_site/rules/no-unbound-method/index.html | 157 ++ .../index.html | 139 ++ .../rules/no-unnecessary-class/index.html | 163 ++ .../no-unnecessary-initializer/index.html | 146 ++ .../rules/no-unnecessary-qualifier/index.html | 150 ++ .../no-unnecessary-type-assertion/index.html | 154 ++ docs/_site/rules/no-unsafe-any/index.html | 152 ++ docs/_site/rules/no-unsafe-finally/index.html | 150 ++ .../rules/no-unused-expression/index.html | 171 ++ .../_site/rules/no-unused-variable/index.html | 197 ++ .../rules/no-use-before-declare/index.html | 156 ++ docs/_site/rules/no-var-keyword/index.html | 149 ++ docs/_site/rules/no-var-requires/index.html | 151 ++ .../_site/rules/no-void-expression/index.html | 154 ++ .../rules/number-literal-format/index.html | 137 ++ .../object-literal-key-quotes/index.html | 189 ++ .../rules/object-literal-shorthand/index.html | 156 ++ .../rules/object-literal-sort-keys/index.html | 170 ++ docs/_site/rules/one-line/index.html | 169 ++ .../one-variable-per-declaration/index.html | 156 ++ .../rules/only-arrow-functions/index.html | 163 ++ docs/_site/rules/ordered-imports/index.html | 251 ++ .../prefer-conditional-expression/index.html | 152 ++ docs/_site/rules/prefer-const/index.html | 171 ++ docs/_site/rules/prefer-for-of/index.html | 141 ++ .../prefer-function-over-method/index.html | 149 ++ .../rules/prefer-method-signature/index.html | 146 ++ .../rules/prefer-object-spread/index.html | 150 ++ docs/_site/rules/prefer-readonly/index.html | 169 ++ docs/_site/rules/prefer-switch/index.html | 151 ++ docs/_site/rules/prefer-template/index.html | 147 ++ .../rules/promise-function-async/index.html | 155 ++ docs/_site/rules/quotemark/index.html | 177 ++ docs/_site/rules/radix/index.html | 146 ++ .../rules/restrict-plus-operands/index.html | 146 ++ docs/_site/rules/return-undefined/index.html | 146 ++ docs/_site/rules/semicolon/index.html | 192 ++ .../space-before-function-paren/index.html | 208 ++ .../rules/space-within-parens/index.html | 147 ++ .../strict-boolean-expressions/index.html | 227 ++ .../rules/strict-type-predicates/index.html | 155 ++ docs/_site/rules/switch-default/index.html | 137 ++ .../_site/rules/switch-final-break/index.html | 149 ++ docs/_site/rules/trailing-comma/index.html | 320 +++ docs/_site/rules/triple-equals/index.html | 162 ++ .../rules/type-literal-delimiter/index.html | 148 ++ .../_site/rules/typedef-whitespace/index.html | 277 +++ docs/_site/rules/typedef/index.html | 177 ++ docs/_site/rules/typeof-compare/index.html | 137 ++ .../_site/rules/unified-signatures/index.html | 146 ++ .../use-default-type-parameter/index.html | 148 ++ docs/_site/rules/use-isnan/index.html | 143 ++ docs/_site/rules/variable-name/index.html | 169 ++ docs/_site/rules/whitespace/index.html | 183 ++ docs/_site/usage/cli/index.html | 290 +++ docs/_site/usage/configuration/index.html | 273 +++ docs/_site/usage/library/index.html | 205 ++ docs/_site/usage/rule-flags/index.html | 185 ++ docs/_site/usage/third-party-tools/index.html | 162 ++ docs/_site/usage/type-checking/index.html | 183 ++ src/rules/code-examples/curly.examples.ts | 72 + src/rules/curlyRule.ts | 55 +- 183 files changed, 32581 insertions(+), 55 deletions(-) create mode 100644 docs/_site/2015/12/10/a-new-tslint-website.html create mode 100644 docs/_site/2016/03/31/sharable-configurations-rules.html create mode 100644 docs/_site/2016/11/17/new-for-4.0.html create mode 100644 docs/_site/Gemfile create mode 100644 docs/_site/Gemfile.lock create mode 100644 docs/_site/circle.yml create mode 100644 docs/_site/css/main.css create mode 100644 docs/_site/develop/contributing/index.html create mode 100644 docs/_site/develop/custom-formatters/index.html create mode 100644 docs/_site/develop/custom-rules/index.html create mode 100644 docs/_site/develop/custom-rules/performance-tips.html create mode 100644 docs/_site/develop/custom-rules/walker-design.html create mode 100644 docs/_site/develop/docs/index.html create mode 100644 docs/_site/develop/testing-rules/index.html create mode 100644 docs/_site/feed.xml create mode 100644 docs/_site/formatters/checkstyle/index.html create mode 100644 docs/_site/formatters/codeFrame/index.html create mode 100644 docs/_site/formatters/filesList/index.html create mode 100644 docs/_site/formatters/index.html create mode 100644 docs/_site/formatters/json/index.html create mode 100644 docs/_site/formatters/junit/index.html create mode 100644 docs/_site/formatters/msbuild/index.html create mode 100644 docs/_site/formatters/pmd/index.html create mode 100644 docs/_site/formatters/prose/index.html create mode 100644 docs/_site/formatters/stylish/index.html create mode 100644 docs/_site/formatters/tap/index.html create mode 100644 docs/_site/formatters/verbose/index.html create mode 100644 docs/_site/formatters/vso/index.html create mode 100644 docs/_site/index.html create mode 100644 docs/_site/news/index.html create mode 100644 docs/_site/rules/adjacent-overload-signatures/index.html create mode 100644 docs/_site/rules/align/index.html create mode 100644 docs/_site/rules/array-type/index.html create mode 100644 docs/_site/rules/arrow-parens/index.html create mode 100644 docs/_site/rules/arrow-return-shorthand/index.html create mode 100644 docs/_site/rules/await-promise/index.html create mode 100644 docs/_site/rules/ban-comma-operator/index.html create mode 100644 docs/_site/rules/ban-types/index.html create mode 100644 docs/_site/rules/ban/index.html create mode 100644 docs/_site/rules/binary-expression-operand-order/index.html create mode 100644 docs/_site/rules/callable-types/index.html create mode 100644 docs/_site/rules/class-name/index.html create mode 100644 docs/_site/rules/comment-format/index.html create mode 100644 docs/_site/rules/completed-docs/index.html create mode 100644 docs/_site/rules/curly/index.html create mode 100644 docs/_site/rules/cyclomatic-complexity/index.html create mode 100644 docs/_site/rules/deprecation/index.html create mode 100644 docs/_site/rules/encoding/index.html create mode 100644 docs/_site/rules/eofline/index.html create mode 100644 docs/_site/rules/file-header/index.html create mode 100644 docs/_site/rules/forin/index.html create mode 100644 docs/_site/rules/import-blacklist/index.html create mode 100644 docs/_site/rules/import-spacing/index.html create mode 100644 docs/_site/rules/indent/index.html create mode 100644 docs/_site/rules/index.html create mode 100644 docs/_site/rules/interface-name/index.html create mode 100644 docs/_site/rules/interface-over-type-literal/index.html create mode 100644 docs/_site/rules/jsdoc-format/index.html create mode 100644 docs/_site/rules/label-position/index.html create mode 100644 docs/_site/rules/linebreak-style/index.html create mode 100644 docs/_site/rules/match-default-export-name/index.html create mode 100644 docs/_site/rules/max-classes-per-file/index.html create mode 100644 docs/_site/rules/max-file-line-count/index.html create mode 100644 docs/_site/rules/max-line-length/index.html create mode 100644 docs/_site/rules/member-access/index.html create mode 100644 docs/_site/rules/member-ordering/index.html create mode 100644 docs/_site/rules/new-parens/index.html create mode 100644 docs/_site/rules/newline-before-return/index.html create mode 100644 docs/_site/rules/newline-per-chained-call/index.html create mode 100644 docs/_site/rules/no-angle-bracket-type-assertion/index.html create mode 100644 docs/_site/rules/no-any/index.html create mode 100644 docs/_site/rules/no-arg/index.html create mode 100644 docs/_site/rules/no-bitwise/index.html create mode 100644 docs/_site/rules/no-boolean-literal-compare/index.html create mode 100644 docs/_site/rules/no-conditional-assignment/index.html create mode 100644 docs/_site/rules/no-consecutive-blank-lines/index.html create mode 100644 docs/_site/rules/no-console/index.html create mode 100644 docs/_site/rules/no-construct/index.html create mode 100644 docs/_site/rules/no-debugger/index.html create mode 100644 docs/_site/rules/no-default-export/index.html create mode 100644 docs/_site/rules/no-duplicate-imports/index.html create mode 100644 docs/_site/rules/no-duplicate-super/index.html create mode 100644 docs/_site/rules/no-duplicate-switch-case/index.html create mode 100644 docs/_site/rules/no-duplicate-variable/index.html create mode 100644 docs/_site/rules/no-dynamic-delete/index.html create mode 100644 docs/_site/rules/no-empty-interface/index.html create mode 100644 docs/_site/rules/no-empty/index.html create mode 100644 docs/_site/rules/no-eval/index.html create mode 100644 docs/_site/rules/no-floating-promises/index.html create mode 100644 docs/_site/rules/no-for-in-array/index.html create mode 100644 docs/_site/rules/no-implicit-dependencies/index.html create mode 100644 docs/_site/rules/no-import-side-effect/index.html create mode 100644 docs/_site/rules/no-inferrable-types/index.html create mode 100644 docs/_site/rules/no-inferred-empty-object-type/index.html create mode 100644 docs/_site/rules/no-internal-module/index.html create mode 100644 docs/_site/rules/no-invalid-template-strings/index.html create mode 100644 docs/_site/rules/no-invalid-this/index.html create mode 100644 docs/_site/rules/no-irregular-whitespace/index.html create mode 100644 docs/_site/rules/no-magic-numbers/index.html create mode 100644 docs/_site/rules/no-mergeable-namespace/index.html create mode 100644 docs/_site/rules/no-misused-new/index.html create mode 100644 docs/_site/rules/no-namespace/index.html create mode 100644 docs/_site/rules/no-non-null-assertion/index.html create mode 100644 docs/_site/rules/no-null-keyword/index.html create mode 100644 docs/_site/rules/no-object-literal-type-assertion/index.html create mode 100644 docs/_site/rules/no-parameter-properties/index.html create mode 100644 docs/_site/rules/no-parameter-reassignment/index.html create mode 100644 docs/_site/rules/no-redundant-jsdoc/index.html create mode 100644 docs/_site/rules/no-reference-import/index.html create mode 100644 docs/_site/rules/no-reference/index.html create mode 100644 docs/_site/rules/no-require-imports/index.html create mode 100644 docs/_site/rules/no-return-await/index.html create mode 100644 docs/_site/rules/no-shadowed-variable/index.html create mode 100644 docs/_site/rules/no-sparse-arrays/index.html create mode 100644 docs/_site/rules/no-string-literal/index.html create mode 100644 docs/_site/rules/no-string-throw/index.html create mode 100644 docs/_site/rules/no-submodule-imports/index.html create mode 100644 docs/_site/rules/no-switch-case-fall-through/index.html create mode 100644 docs/_site/rules/no-this-assignment/index.html create mode 100644 docs/_site/rules/no-trailing-whitespace/index.html create mode 100644 docs/_site/rules/no-unbound-method/index.html create mode 100644 docs/_site/rules/no-unnecessary-callback-wrapper/index.html create mode 100644 docs/_site/rules/no-unnecessary-class/index.html create mode 100644 docs/_site/rules/no-unnecessary-initializer/index.html create mode 100644 docs/_site/rules/no-unnecessary-qualifier/index.html create mode 100644 docs/_site/rules/no-unnecessary-type-assertion/index.html create mode 100644 docs/_site/rules/no-unsafe-any/index.html create mode 100644 docs/_site/rules/no-unsafe-finally/index.html create mode 100644 docs/_site/rules/no-unused-expression/index.html create mode 100644 docs/_site/rules/no-unused-variable/index.html create mode 100644 docs/_site/rules/no-use-before-declare/index.html create mode 100644 docs/_site/rules/no-var-keyword/index.html create mode 100644 docs/_site/rules/no-var-requires/index.html create mode 100644 docs/_site/rules/no-void-expression/index.html create mode 100644 docs/_site/rules/number-literal-format/index.html create mode 100644 docs/_site/rules/object-literal-key-quotes/index.html create mode 100644 docs/_site/rules/object-literal-shorthand/index.html create mode 100644 docs/_site/rules/object-literal-sort-keys/index.html create mode 100644 docs/_site/rules/one-line/index.html create mode 100644 docs/_site/rules/one-variable-per-declaration/index.html create mode 100644 docs/_site/rules/only-arrow-functions/index.html create mode 100644 docs/_site/rules/ordered-imports/index.html create mode 100644 docs/_site/rules/prefer-conditional-expression/index.html create mode 100644 docs/_site/rules/prefer-const/index.html create mode 100644 docs/_site/rules/prefer-for-of/index.html create mode 100644 docs/_site/rules/prefer-function-over-method/index.html create mode 100644 docs/_site/rules/prefer-method-signature/index.html create mode 100644 docs/_site/rules/prefer-object-spread/index.html create mode 100644 docs/_site/rules/prefer-readonly/index.html create mode 100644 docs/_site/rules/prefer-switch/index.html create mode 100644 docs/_site/rules/prefer-template/index.html create mode 100644 docs/_site/rules/promise-function-async/index.html create mode 100644 docs/_site/rules/quotemark/index.html create mode 100644 docs/_site/rules/radix/index.html create mode 100644 docs/_site/rules/restrict-plus-operands/index.html create mode 100644 docs/_site/rules/return-undefined/index.html create mode 100644 docs/_site/rules/semicolon/index.html create mode 100644 docs/_site/rules/space-before-function-paren/index.html create mode 100644 docs/_site/rules/space-within-parens/index.html create mode 100644 docs/_site/rules/strict-boolean-expressions/index.html create mode 100644 docs/_site/rules/strict-type-predicates/index.html create mode 100644 docs/_site/rules/switch-default/index.html create mode 100644 docs/_site/rules/switch-final-break/index.html create mode 100644 docs/_site/rules/trailing-comma/index.html create mode 100644 docs/_site/rules/triple-equals/index.html create mode 100644 docs/_site/rules/type-literal-delimiter/index.html create mode 100644 docs/_site/rules/typedef-whitespace/index.html create mode 100644 docs/_site/rules/typedef/index.html create mode 100644 docs/_site/rules/typeof-compare/index.html create mode 100644 docs/_site/rules/unified-signatures/index.html create mode 100644 docs/_site/rules/use-default-type-parameter/index.html create mode 100644 docs/_site/rules/use-isnan/index.html create mode 100644 docs/_site/rules/variable-name/index.html create mode 100644 docs/_site/rules/whitespace/index.html create mode 100644 docs/_site/usage/cli/index.html create mode 100644 docs/_site/usage/configuration/index.html create mode 100644 docs/_site/usage/library/index.html create mode 100644 docs/_site/usage/rule-flags/index.html create mode 100644 docs/_site/usage/third-party-tools/index.html create mode 100644 docs/_site/usage/type-checking/index.html create mode 100644 src/rules/code-examples/curly.examples.ts diff --git a/docs/_layouts/rule.html b/docs/_layouts/rule.html index 42ea25a5518..dbb94d88fe2 100644 --- a/docs/_layouts/rule.html +++ b/docs/_layouts/rule.html @@ -47,8 +47,8 @@

Code examples:

{{ codeExample.description }}
{{ codeExample.config | markdownify }} -
Passes
-
+
Passes
+
{{ codeExample.pass | markdownify }}
{% if codeExample.fail %} diff --git a/docs/_site/2015/12/10/a-new-tslint-website.html b/docs/_site/2015/12/10/a-new-tslint-website.html new file mode 100644 index 00000000000..f362acb439e --- /dev/null +++ b/docs/_site/2015/12/10/a-new-tslint-website.html @@ -0,0 +1,122 @@ + + + + + + + + + A New TSLint Website + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

A New TSLint Website

+ +
+ +
+

As TSLint has grown in usage and popularity alongside of TypeScript, it also has +evolved in terms of functionality and complexity. Today, all sorts of projects and products, +from Angular 2 to the TypeScript compiler itself use TSLint +to help keep their code high-quality.

+ +

Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. +For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long TSLint README. +Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. +There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.

+ +

This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:

+ +
    +
  • A documentation overhaul that will provide +more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.
  • +
  • A new --init feature in the TSLint CLI that will make it easier to +generate a sensible initial tslint.json config file.
  • +
  • An improved contributor experience that will make things easier for those who want to contribute code to TSLint.
  • +
+ +

Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!

+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/2016/03/31/sharable-configurations-rules.html b/docs/_site/2016/03/31/sharable-configurations-rules.html new file mode 100644 index 00000000000..065d65b4638 --- /dev/null +++ b/docs/_site/2016/03/31/sharable-configurations-rules.html @@ -0,0 +1,203 @@ + + + + + + + + + Sharable Configurations and Rules + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

Sharable Configurations and Rules

+ +
+ +
+

With the release of TSLint v3.7.0 comes a few new features that will make configuration files (aka tslint.json files) +easier to maintain and share. The crux of the changes is a new extends field, which when provided indicates that a configuration +file augments another configuration file.

+ +

Example

+ +

Let’s imagine you’ve created some custom rules and want to share them with others. +You also have a couple of configurations for them you want to share.

+ +

Here’s the layout of our NPM package, which we’ll call shared-tslint-rules. We have a directory with rules, +as well as a few different config files for TSLint.

+ +
shared-tslint-rules
+├── package.json
+├── rules
+│   ├── noAdditionRule.js
+│   ├── noErrorsRule.js
+│   └── noExcessiveCommentingRule.js
+├── tslint-base.json
+├── tslint-config.json
+└── tslint-crazy-config.js
+
+ +

Our starting-point config file just references the directory the custom rules are in +but doesn’t enable any of them:

+ +

tslint-base.json:

+ +
{
+    "rulesDirectory": "./rules"
+}
+
+ +

We also want to provide a sane default config for our rules. +Notice how it extends our base config, so we don’t have to redeclare rulesDirectory here:

+ +

tslint-config.json:

+ +
{
+    "extends": "./tslint-base.json",
+    "rules": {
+        "no-errors": true,
+        "no-addition": false
+    }
+}
+
+ +

Finally, we can even make a crazy config file for fun that gives you back a different config +each time you run TSLint. Notice how this is a .js file that exports an object:

+ +

tslint-crazy-config.js

+ +
module.exports = {
+    extends: "./tslint-base.json",
+    rules: {
+        "no-excessive-commenting": [true, {maxComments: Math.random() * 10}]
+    }
+};
+
+ +

Finally, we have our package.json file which references our base config file through its main field:

+ +

package.json:

+ +
{
+  "name": "shared-tslint-rules",
+  "version": "1.0.0",
+  "description": "Some TSLint rules that are great!",
+  "main": "tslint-base.json",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "MIT"
+}
+
+ +

We can publish our package on NPM to let the world use it!

+ +
+ +

Now let’s say we’re a user, and we want to use the custom rules above to lint our code. +First, we’ll make sure we have the necessary npm packages installed:

+ +
npm install -g tslint shared-tslint-rules
+
+ +

Then, in our tslint.json file for our project, we can reference the package of custom rules with extends:

+ +
{
+    "extends": "shared-tslint-rules/tslint-config",
+    "rules": {
+        "no-addition": true
+    }
+}
+
+ +

and that’s all we have to do to use the custom rules! +We can now run TSLint as we would normally and see any lint errors produced by the custom rules:

+ +
tslint -c path/to/tslint.json my/files/**/to/lint.ts
+
+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/2016/11/17/new-for-4.0.html b/docs/_site/2016/11/17/new-for-4.0.html new file mode 100644 index 00000000000..55be6d39ddc --- /dev/null +++ b/docs/_site/2016/11/17/new-for-4.0.html @@ -0,0 +1,163 @@ + + + + + + + + + TSLint 4.0 Released + + + + + + + + + + + +
+ + +
+ + +
+
+ +
+

TSLint 4.0 Released

+ +
+ +
+

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

+ + + +
+ +

Create your own fixer

+

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

+ +

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+const fix = new Lint.Fix("no-imports", [replacement]);
+
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+ + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/Gemfile b/docs/_site/Gemfile new file mode 100644 index 00000000000..053c27dc351 --- /dev/null +++ b/docs/_site/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'github-pages' diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock new file mode 100644 index 00000000000..3eaa6478c32 --- /dev/null +++ b/docs/_site/Gemfile.lock @@ -0,0 +1,238 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.2.9) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorator (1.1.0) + commonmarker (0.17.7.1) + ruby-enum (~> 0.5) + concurrent-ruby (1.0.5) + ethon (0.11.0) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) + ffi (1.9.18) + forwardable-extended (2.6.0) + gemoji (3.0.0) + github-pages (172) + activesupport (= 4.2.9) + github-pages-health-check (= 1.3.5) + jekyll (= 3.6.2) + jekyll-avatar (= 0.5.0) + jekyll-coffeescript (= 1.0.2) + jekyll-commonmark-ghpages (= 0.1.3) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.9.2) + jekyll-gist (= 1.4.1) + jekyll-github-metadata (= 2.9.3) + jekyll-mentions (= 1.2.0) + jekyll-optional-front-matter (= 0.3.0) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.2.0) + jekyll-redirect-from (= 0.12.1) + jekyll-relative-links (= 0.5.2) + jekyll-remote-theme (= 0.2.3) + jekyll-sass-converter (= 1.5.0) + jekyll-seo-tag (= 2.3.0) + jekyll-sitemap (= 1.1.1) + jekyll-swiss (= 0.4.0) + jekyll-theme-architect (= 0.1.0) + jekyll-theme-cayman (= 0.1.0) + jekyll-theme-dinky (= 0.1.0) + jekyll-theme-hacker (= 0.1.0) + jekyll-theme-leap-day (= 0.1.0) + jekyll-theme-merlot (= 0.1.0) + jekyll-theme-midnight (= 0.1.0) + jekyll-theme-minimal (= 0.1.0) + jekyll-theme-modernist (= 0.1.0) + jekyll-theme-primer (= 0.5.2) + jekyll-theme-slate (= 0.1.0) + jekyll-theme-tactile (= 0.1.0) + jekyll-theme-time-machine (= 0.1.0) + jekyll-titles-from-headings (= 0.5.0) + jemoji (= 0.8.1) + kramdown (= 1.14.0) + liquid (= 4.0.0) + listen (= 3.0.6) + mercenary (~> 0.3) + minima (= 2.1.1) + rouge (= 2.2.1) + terminal-table (~> 1.4) + github-pages-health-check (1.3.5) + addressable (~> 2.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 2.0) + typhoeus (~> 0.7) + html-pipeline (2.7.1) + activesupport (>= 2) + nokogiri (>= 1.4) + i18n (0.9.1) + concurrent-ruby (~> 1.0) + jekyll (3.6.2) + addressable (~> 2.4) + colorator (~> 1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.14) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 3) + safe_yaml (~> 1.0) + jekyll-avatar (0.5.0) + jekyll (~> 3.0) + jekyll-coffeescript (1.0.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.1.0) + commonmarker (~> 0.14) + jekyll (>= 3.0, < 4.0) + jekyll-commonmark-ghpages (0.1.3) + commonmarker (~> 0.17.6) + jekyll-commonmark (~> 1) + rouge (~> 2) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.9.2) + jekyll (~> 3.3) + jekyll-gist (1.4.1) + octokit (~> 4.2) + jekyll-github-metadata (2.9.3) + jekyll (~> 3.1) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.2.0) + activesupport (~> 4.0) + html-pipeline (~> 2.3) + jekyll (~> 3.0) + jekyll-optional-front-matter (0.3.0) + jekyll (~> 3.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.2.0) + jekyll (~> 3.0) + jekyll-redirect-from (0.12.1) + jekyll (~> 3.3) + jekyll-relative-links (0.5.2) + jekyll (~> 3.3) + jekyll-remote-theme (0.2.3) + jekyll (~> 3.5) + rubyzip (>= 1.2.1, < 3.0) + typhoeus (>= 0.7, < 2.0) + jekyll-sass-converter (1.5.0) + sass (~> 3.4) + jekyll-seo-tag (2.3.0) + jekyll (~> 3.3) + jekyll-sitemap (1.1.1) + jekyll (~> 3.3) + jekyll-swiss (0.4.0) + jekyll-theme-architect (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.5.2) + jekyll (~> 3.5) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.2) + jekyll-theme-slate (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.1.0) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.0) + jekyll (~> 3.3) + jekyll-watch (1.5.1) + listen (~> 3.0) + jemoji (0.8.1) + activesupport (~> 4.0, >= 4.2.9) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0) + kramdown (1.14.0) + liquid (4.0.0) + listen (3.0.6) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) + mercenary (0.3.6) + mini_portile2 (2.3.0) + minima (2.1.1) + jekyll (~> 3.3) + minitest (5.10.3) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + pathutil (0.16.1) + forwardable-extended (~> 2.6) + public_suffix (2.0.5) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (2.2.1) + ruby-enum (0.7.1) + i18n + rubyzip (1.2.1) + safe_yaml (1.0.4) + sass (3.5.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.4) + thread_safe (~> 0.1) + unicode-display_width (1.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + github-pages + +BUNDLED WITH + 1.16.1 diff --git a/docs/_site/circle.yml b/docs/_site/circle.yml new file mode 100644 index 00000000000..1e8b5a738ae --- /dev/null +++ b/docs/_site/circle.yml @@ -0,0 +1,7 @@ +machine: + ruby: + # see available versions here: https://circleci.com/docs/build-image-precise/#ruby + version: 2.2.3 +test: + override: + - bundle exec jekyll build diff --git a/docs/_site/css/main.css b/docs/_site/css/main.css new file mode 100644 index 00000000000..f8b2fda7512 --- /dev/null +++ b/docs/_site/css/main.css @@ -0,0 +1,989 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ +html { + font-family: sans-serif; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ } + +/** + * Remove default margin. + */ +body { + margin: 0; } + +/* HTML5 display definitions + ========================================================================== */ +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; } + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ + vertical-align: baseline; + /* 2 */ } + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +audio:not([controls]) { + display: none; + height: 0; } + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ +[hidden], +template { + display: none; } + +/* Links + ========================================================================== */ +/** + * Remove the gray background color from active links in IE 10. + */ +a { + background-color: transparent; } + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ +a:active, +a:hover { + outline: 0; } + +/* Text-level semantics + ========================================================================== */ +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ +abbr[title] { + border-bottom: 1px dotted; } + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ +b, +strong { + font-weight: bold; } + +/** + * Address styling not present in Safari and Chrome. + */ +dfn { + font-style: italic; } + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ +h1 { + font-size: 2em; + margin: 0.67em 0; } + +/** + * Address styling not present in IE 8/9. + */ +mark { + background: #ff0; + color: #000; } + +/** + * Address inconsistent and variable font size in all browsers. + */ +small { + font-size: 80%; } + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +/* Embedded content + ========================================================================== */ +/** + * Remove border when inside `a` element in IE 8/9/10. + */ +img { + border: 0; } + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +svg:not(:root) { + overflow: hidden; } + +/* Grouping content + ========================================================================== */ +/** + * Address margin not present in IE 8/9 and Safari. + */ +figure { + margin: 1em 40px; } + +/** + * Address differences between Firefox and other browsers. + */ +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; } + +/** + * Contain overflow in all browsers. + */ +pre { + overflow: auto; } + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; } + +/* Forms + ========================================================================== */ +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +button, +input, +optgroup, +select, +textarea { + color: inherit; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ } + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +button { + overflow: visible; } + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +button, +select { + text-transform: none; } + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ } + +/** + * Re-set default cursor for disabled elements. + */ +button[disabled], +html input[disabled] { + cursor: default; } + +/** + * Remove inner padding and border in Firefox 4+. + */ +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; } + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ +input { + line-height: normal; } + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; } + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ +input[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + /* 2 */ + box-sizing: content-box; } + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +/** + * Define consistent border, margin, and padding. + */ +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; } + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ +legend { + border: 0; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ +textarea { + overflow: auto; } + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +optgroup { + font-weight: bold; } + +/* Tables + ========================================================================== */ +/** + * Remove most spacing between table cells. + */ +table { + border-collapse: collapse; + border-spacing: 0; } + +td, +th { + padding: 0; } + +/** + * Reset some basic elements + */ +body, h1, h2, h3, h4, h5, h6, +p, blockquote, pre, hr, +dl, dd, ol, ul, figure { + margin: 0; + padding: 0; } + +/** + * Set `margin-bottom` to maintain vertical rhythm + */ +h1, h2, h3, h4, h5, h6, +p, blockquote, pre, +ul, ol, dl, figure, +.highlight { + margin-bottom: 1rem; } + +/** + * Images + */ +img { + max-width: 100%; + vertical-align: middle; } + +/** + * Figures + */ +figure > img { + display: block; } + +figcaption { + font-size: 14px; } + +/** + * Clearfix + */ +.site-header:after, .page:after, .footer-col-wrapper:after { + content: ""; + display: table; + clear: both; } + +/** + * Icons + */ +.icon > svg { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: middle; } + .icon > svg path { + fill: #606c71; } + +/** + * Rules & Feature Badges + */ +.rules-list { + list-style: none; + margin: 0 !important; } + .rules-list > li:nth-child(odd) a { + background-color: rgba(0, 0, 0, 0.03); } + .rules-list > li a { + display: block; + border-left: 3px solid transparent; + text-decoration: none; + padding: .75rem; } + .rules-list > li a:hover { + background-color: rgba(0, 0, 0, 0.075); + border-left-color: #159957; } + +.rule-features { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; } + +.feature { + display: inline-block; + margin-right: 2px; + padding: 2px 4px; + font-weight: 700; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border: 1px solid transparent; + border-radius: .25rem; + cursor: help; } + .feature:before { + display: inline-block; + margin-right: 2px; } + .feature.feature-sm { + padding: 1px 3px; + font-size: 75%; } + .feature.feature-ts-only { + background-color: #FCF8E3; + border-color: #FAF2CC; + color: #8A6D3B; } + .feature.feature-ts-only:before { + content: "\1F4C4"; } + .feature.feature-fixer { + background-color: #DFF0D8; + border-color: #D0E9C6; + color: #3C763D; } + .feature.feature-fixer:before { + content: "\1f527"; } + .feature.feature-requires-type-info { + background-color: #F2DEDE; + border-color: #EBCCCC; + color: #A94442; } + .feature.feature-requires-type-info:before { + content: "\2139"; + border-radius: 50%; + background: #0078D7; + color: #FFF; + width: 1em; } + +.wrapper__code-example { + margin-bottom: 64px; } + .wrapper__code-example:last-of-type { + margin-bottom: 24px; } + .wrapper__code-example h6.heading-fail { + color: #d14; } + .wrapper__code-example .code-example { + background-color: #f1fff1; } + .wrapper__code-example .code-example.code-example-fail { + background-color: #fff5f5; } + .wrapper__code-example .code-example pre, .wrapper__code-example .code-example .highlight { + background: transparent; } + +* { + box-sizing: border-box; } + +body { + padding: 0; + margin: 0; + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; + color: #606c71; } + +a { + color: #1e6bb8; + text-decoration: none; } + a:hover { + text-decoration: underline; } + a:visited { + color: #7d0ce8; } + +h1 { + font-size: 2.5rem; } + +h2 { + font-size: 2rem; } + +h3 { + font-size: 1.6rem; } + +h4 { + font-size: 1.4rem; } + +h5 { + font-size: 1.2rem; } + +h6 { + font-size: 1rem; } + +/** + * Site header + */ +.site-header { + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + padding: 0 20px; + min-height: 56px; } + +.site-title { + font-size: 26px; + line-height: 56px; + margin-bottom: 0; + float: left; } + .site-title, .site-title:visited { + color: rgba(255, 255, 255, 0.7); } + .site-title:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; } + @media screen and (max-width: 36em) { + .site-title { + display: block; + text-align: left; } } + +.site-nav { + float: right; + line-height: 56px; } + .site-nav .page-link { + line-height: 1.5; } + .site-nav .page-link, .site-nav .page-link:visited { + color: rgba(255, 255, 255, 0.7); } + .site-nav .page-link:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; } + .site-nav .page-link:not(:first-child) { + margin-left: 20px; } + @media screen and (max-width: 36em) { + .site-nav .page-link { + display: block; + text-align: left; } + .site-nav .page-link:not(:first-child) { + margin-left: 0; } } + +.btn { + display: inline-block; + margin-bottom: 1rem; + background-color: rgba(255, 255, 255, 0.08); + border-color: rgba(255, 255, 255, 0.2); + border-style: solid; + border-width: 1px; + border-radius: 0.3rem; + transition: color 0.2s, background-color 0.2s, border-color 0.2s; } + .btn, .btn:visited { + color: rgba(255, 255, 255, 0.7); } + .btn:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; + background-color: rgba(255, 255, 255, 0.2); + border-color: rgba(255, 255, 255, 0.3); } + .btn + .btn { + margin-left: 1rem; } + @media screen and (min-width: 64em) { + .btn { + padding: 0.75rem 1rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .btn { + padding: 0.6rem 0.9rem; + font-size: 0.9rem; } } + @media screen and (max-width: 36em) { + .btn { + display: block; + width: 100%; + padding: 0.75rem; + font-size: 0.9rem; } + .btn + .btn { + margin-top: 1rem; + margin-left: 0; } } + +.header { + color: #fff; + text-align: center; + background-color: #159957; + background-image: linear-gradient(120deg, #155799, #159957); } + +@media screen and (min-width: 64em) { + .page-header { + padding: 3rem; } } +@media screen and (min-width: 36em) and (max-width: 64em) { + .page-header { + padding: 2rem; } } +@media screen and (max-width: 36em) { + .page-header { + padding: 1rem; } } + +.project-name { + margin-top: 0; + margin-bottom: 0.1rem; } + @media screen and (min-width: 64em) { + .project-name { + font-size: 3.25rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .project-name { + font-size: 2.25rem; } } + @media screen and (max-width: 36em) { + .project-name { + font-size: 1.75rem; } } + +.project-tagline { + margin-bottom: 2rem; + font-weight: normal; + opacity: 0.7; } + @media screen and (min-width: 64em) { + .project-tagline { + font-size: 1.25rem; } } + @media screen and (min-width: 36em) and (max-width: 64em) { + .project-tagline { + font-size: 1.15rem; } } + @media screen and (max-width: 36em) { + .project-tagline { + font-size: 1rem; } } + +.main-content :first-child { + margin-top: 0; } +@media screen and (min-width: 64em) { + .main-content { + max-width: 68rem; + padding: 2rem 6rem; + margin: 0 auto; + font-size: 1.1rem; } } +@media screen and (min-width: 36em) and (max-width: 64em) { + .main-content { + padding: 2rem 4rem; + font-size: 1.1rem; } } +@media screen and (max-width: 36em) { + .main-content { + padding: 2rem 1rem; + font-size: 1rem; } } +.main-content img { + max-width: 100%; } +.main-content h1, +.main-content h2, +.main-content h3, +.main-content h4, +.main-content h5, +.main-content h6 { + margin-top: 2rem; + margin-bottom: 1rem; + font-weight: normal; + color: #159957; } +.main-content p { + margin-bottom: 1rem; } +.main-content code { + padding: 2px 4px; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 0.9rem; + color: #383e41; + background-color: #f3f6fa; + border-radius: 0.3rem; } +.main-content pre { + padding: 0.8rem; + margin-top: 0; + margin-bottom: 1rem; + font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; + color: #567482; + word-wrap: normal; + background-color: #f3f6fa; + border: solid 1px #dce6f0; + border-radius: 0.3rem; } + .main-content pre > code { + padding: 0; + margin: 0; + font-size: 0.9rem; + color: #567482; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; } +.main-content .highlight { + margin-bottom: 1rem; } + .main-content .highlight pre { + margin-bottom: 0; + word-break: normal; } +.main-content .highlight pre, +.main-content pre { + padding: 0.8rem; + overflow: auto; + font-size: 0.9rem; + line-height: 1.45; + border-radius: 0.3rem; + -webkit-overflow-scrolling: touch; } +.main-content pre code, +.main-content pre tt { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; } + .main-content pre code:before, .main-content pre code:after, + .main-content pre tt:before, + .main-content pre tt:after { + content: normal; } +.main-content ul, +.main-content ol { + margin-top: 0; + margin-left: 30px; + margin-bottom: 1rem; } + .main-content ul ul, + .main-content ul ol, + .main-content ol ul, + .main-content ol ol { + margin-bottom: 0; } +.main-content blockquote { + padding: 0 1rem; + margin-left: 0; + color: #819198; + border-left: 0.3rem solid #dce6f0; } + .main-content blockquote > :first-child { + margin-top: 0; } + .main-content blockquote > :last-child { + margin-bottom: 0; } +.main-content table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; + -webkit-overflow-scrolling: touch; } + .main-content table th { + font-weight: bold; } + .main-content table th, + .main-content table td { + padding: 0.5rem 1rem; + border: 1px solid #e9ebec; } +.main-content dl { + padding: 0; } + .main-content dl dt { + padding: 0; + margin-top: 1rem; + font-size: 1rem; + font-weight: bold; } + .main-content dl dd { + padding: 0; + margin-bottom: 1rem; } +.main-content hr { + height: 2px; + padding: 0; + margin: 1rem 0; + background-color: #eff0f1; + border: 0; } + +.page { + width: 100%; } + +.page-content { + width: 80%; + padding: 1rem; + float: left; } + +.page-sidebar { + width: 20%; + padding: 1rem; + float: left; } + .page-sidebar .active { + font-style: italic; } + +.sidebar-title { + border-bottom: 1px solid #159957; } + +ul.sidebar-links { + list-style: none; + margin-left: 0; } + ul.sidebar-links h6 { + margin-bottom: 0.33rem; } + +/** + * Posts + */ +ul.post-list { + margin-left: 0; + list-style: none; } + ul.post-list > li { + margin-bottom: 1rem; } + +.post-meta { + font-size: 14px; + color: #828282; + font-style: italic; } + +.post-link { + display: inline-block; + color: inherit; } + +.post-header { + margin-bottom: 2rem; } + +.post-title { + letter-spacing: -1px; + line-height: 1; } + +/** + * Site footer + */ +.site-footer { + padding-top: 2rem; + margin-top: 2rem; + border-top: solid 1px #eff0f1; + font-size: 0.9rem; } + +ul.contact-list, +ul.social-media-list { + list-style: none; + margin-left: 0; } + +.footer-col { + float: left; } + +.footer-col-2 { + float: right; } + @media screen and (max-width: 36em) { + .footer-col-2 { + float: left; } } + +/** + * Syntax highlighting styles + */ +.highlight { + background: #fff; } + .highlight .c { + color: #998; + font-style: italic; } + .highlight .err { + color: #a61717; + background-color: #e3d2d2; } + .highlight .k { + font-weight: bold; } + .highlight .o { + font-weight: bold; } + .highlight .cm { + color: #998; + font-style: italic; } + .highlight .cp { + color: #999; + font-weight: bold; } + .highlight .c1 { + color: #998; + font-style: italic; } + .highlight .cs { + color: #999; + font-weight: bold; + font-style: italic; } + .highlight .gd { + color: #000; + background-color: #fdd; } + .highlight .gd .x { + color: #000; + background-color: #faa; } + .highlight .ge { + font-style: italic; } + .highlight .gr { + color: #a00; } + .highlight .gh { + color: #999; } + .highlight .gi { + color: #000; + background-color: #dfd; } + .highlight .gi .x { + color: #000; + background-color: #afa; } + .highlight .go { + color: #888; } + .highlight .gp { + color: #555; } + .highlight .gs { + font-weight: bold; } + .highlight .gu { + color: #aaa; } + .highlight .gt { + color: #a00; } + .highlight .kc { + font-weight: bold; } + .highlight .kd { + font-weight: bold; } + .highlight .kp { + font-weight: bold; } + .highlight .kr { + font-weight: bold; } + .highlight .kt { + color: #458; + font-weight: bold; } + .highlight .m { + color: #099; } + .highlight .s { + color: #d14; } + .highlight .na { + color: #008080; } + .highlight .nb { + color: #0086B3; } + .highlight .nc { + color: #458; + font-weight: bold; } + .highlight .no { + color: #008080; } + .highlight .ni { + color: #800080; } + .highlight .ne { + color: #900; + font-weight: bold; } + .highlight .nf { + color: #900; + font-weight: bold; } + .highlight .nn { + color: #555; } + .highlight .nt { + color: #000080; } + .highlight .nv { + color: #008080; } + .highlight .ow { + font-weight: bold; } + .highlight .w { + color: #bbb; } + .highlight .mf { + color: #099; } + .highlight .mh { + color: #099; } + .highlight .mi { + color: #099; } + .highlight .mo { + color: #099; } + .highlight .sb { + color: #d14; } + .highlight .sc { + color: #d14; } + .highlight .sd { + color: #d14; } + .highlight .s2 { + color: #d14; } + .highlight .se { + color: #d14; } + .highlight .sh { + color: #d14; } + .highlight .si { + color: #d14; } + .highlight .sx { + color: #d14; } + .highlight .sr { + color: #009926; } + .highlight .s1 { + color: #d14; } + .highlight .ss { + color: #990073; } + .highlight .bp { + color: #999; } + .highlight .vc { + color: #008080; } + .highlight .vg { + color: #008080; } + .highlight .vi { + color: #008080; } + .highlight .il { + color: #099; } diff --git a/docs/_site/develop/contributing/index.html b/docs/_site/develop/contributing/index.html new file mode 100644 index 00000000000..407c93a6cd2 --- /dev/null +++ b/docs/_site/develop/contributing/index.html @@ -0,0 +1,178 @@ + + + + + + + + + Contributing to TSLint + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Contributing to TSLint

+

+
+ + +

To develop TSLint, clone the repository and install its dependencies:

+ +
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf
+yarn
+yarn compile
+yarn test
+
+ +

Running a specific test

+ +

You can test a specific test by using the --test command line parameter followed by your test directory. For example:

+
// global tslint
+// point to a dir that has tslint.json and .lint files
+tslint --test test/rules/semicolon/always
+
+// locally built tslint
+./bin/tslint --test test/rules/semicolon/always
+
+ +

Debugging in Visual Studio Code

+ +

Configuration files to work with Visual Studio Code are included when you check out the source code. These files live in the .vscode directory. To run TSLint in the debugger, switch to Debug view and use the dropdown at the top of the Debug pane to select the launch configuration (specified in .vscode/launch.json). Press F5 to debug. You should be able to set breakpoints and debug as usual.

+ +

The current debug configurations are:

+ +
    +
  • Debug CLI: Used to debug TSLint using command line arguments. Modify the args array in .vscode/launch.json to add arguments.
  • +
  • Debug Mocha Tests: Runs non-rule tests
  • +
  • Debug Rule Tests: Runs rule tests (under test/rules)
  • +
  • Debug Document Generation: Debug the scripts/buildDocs.ts script.
  • +
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-formatters/index.html b/docs/_site/develop/custom-formatters/index.html new file mode 100644 index 00000000000..d91b99b9aff --- /dev/null +++ b/docs/_site/develop/custom-formatters/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Custom Formatters + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Custom Formatters

+

+
+ + +

Just like custom rules, additional formatters can also be supplied to TSLint via --formatters-dir on the CLI or formattersDirectory option on the library or grunt-tslint. Writing a new formatter is simpler than writing a new rule, as shown in the JSON formatter’s code.

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Formatter extends Lint.Formatters.AbstractFormatter {
+    public format(failures: Lint.RuleFailure[]): string {
+        var failuresJSON = failures.map((failure: Lint.RuleFailure) => failure.toJson());
+        return JSON.stringify(failuresJSON);
+    }
+}
+
+ +

Such custom formatters can also be written in Javascript. Additionally, formatter files are always named with the suffix Formatter, and referenced from TSLint without its suffix.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/index.html b/docs/_site/develop/custom-rules/index.html new file mode 100644 index 00000000000..41b32272a14 --- /dev/null +++ b/docs/_site/develop/custom-rules/index.html @@ -0,0 +1,224 @@ + + + + + + + + + Developing TSLint rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Developing TSLint rules

+

+
+ + +

TSLint ships with a set of core rules that can be configured. However, users are also allowed to write their own rules, which allows them to enforce specific behavior not covered by the core of TSLint. TSLint’s internal rules are itself written to be pluggable, so adding a new rule is as simple as creating a new rule file named by convention. New rules can be written in either TypeScript or JavaScript; if written in TypeScript, the code must be compiled to JavaScript before invoking TSLint.

+ +

Let us take the example of how to write a new rule to forbid all import statements (you know, for science). Let us name the rule file noImportsRule.ts. Rules are referenced in tslint.json with their kebab-cased identifer, so "no-imports": true would configure the rule.

+ +

Important conventions:

+ +
    +
  • Rule identifiers are always kebab-cased.
  • +
  • Rule files are always camel-cased (camelCasedRule.ts).
  • +
  • Rule files must contain the suffix Rule.
  • +
  • The exported class must always be named Rule and extend from Lint.Rules.AbstractRule.
  • +
+ +

Now, let us first write the rule in TypeScript:

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "import statement forbidden";
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        return this.applyWithWalker(new NoImportsWalker(sourceFile, this.getOptions()));
+    }
+}
+
+// The walker takes care of all the work.
+class NoImportsWalker extends Lint.RuleWalker {
+    public visitImportDeclaration(node: ts.ImportDeclaration) {
+        // create a failure at the current position
+        this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
+
+        // call the base version of this visitor to actually parse this node
+        super.visitImportDeclaration(node);
+    }
+}
+
+ +

Given a walker, TypeScript’s parser visits the AST using the visitor pattern. So the rule walkers only need to override the appropriate visitor methods to enforce its checks. For reference, the base walker can be found in syntaxWalker.ts. To see what your Typescript file or snippet looks like as an AST, visit astexplorer.net (note: current version of TypeScript may not be supported, yet).

+ +

We still need to hook up this new rule to TSLint. First make sure to compile noImportsRule.ts:

+ +
tsc noImportsRule.ts
+
+ +

Then, if using the CLI, provide the directory that contains this rule as an option to --rules-dir. If using TSLint as a library or via grunt-tslint, the options hash must contain "rulesDirectory": "...". If you run the linter, you’ll see that we have now successfully banned all import statements via TSLint!

+ +

Finally, add a line to your tslint.json config file for each of your custom rules.

+ +
+ +

Now that you’re written a rule to detect problems, let’s modify it to fix them.

+ +

Instantiate a Fix object and pass it in as an argument to addFailure. This snippet replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const fix = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+
+// create a failure at the current position
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+
+

Final notes:

+ +
    +
  • Core rules cannot be overwritten with a custom implementation.
  • +
  • Custom rules can also take in options just like core rules (retrieved via this.getOptions()).
  • +
  • As of TSLint v5.7.0 you no longer need to compile your custom rules before using them. You need to tell node.js how to load .ts files for example by using ts-node:
  • +
+ +
ts-node node_modules/.bin/tslint <your options>
+# or
+node -r ts-node/register node_modules/.bin/tslint <your options>
+# or
+NODE_OPTIONS="-r ts-node/register" tslint <your options>
+
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/performance-tips.html b/docs/_site/develop/custom-rules/performance-tips.html new file mode 100644 index 00000000000..82660c2df98 --- /dev/null +++ b/docs/_site/develop/custom-rules/performance-tips.html @@ -0,0 +1,295 @@ + + + + + + + + + TSLint performance tips + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint performance tips

+

+
+ + +

As TSLint has matured, we have developed some best practices for making rules run faster. TSLint 5.0 was a particularly +significant release that featured many performance enhancements using the below tips (some codebases experienced lint times +cut in half).

+ +

Use the TypeChecker only when needed

+ +

The TypeChecker is a really mighty tool, but that comes with a cost. To create a TypeChecker the Program first has to locate, read, parse and bind all SourceFiles referenced. +To avoid that cost, try to avoid the TypeChecker where possible.

+ +

If you are interested in the JSDoc of a function for example, you could ask the TypeChecker. +But there’s another way: call .getChildren() on the FunctionDeclaration and search for nodes of kind ts.SyntaxKind.JSDocComment. +Those nodes will precede other nodes in the array.

+ +

Avoid walking the AST if possible

+ +

Some rules work directly on the content of the source file.

+ +

For example, max-file-line-count and linebreak-style don’t need to walk the AST at all.

+ +

Other rules define exceptions: no-consecutive-blank-lines ignores template strings. +To optimize for the best case, this rule can first look for failures in the source. +If and only if there are any failures, walk the AST to find the location of all template strings to filter the failures.

+ +

Implement your own walking algorithm

+ +

Convenience comes with a price. When using SyntaxWalker or any subclass thereof like RuleWalker you pay the price for the +big switch statement in visitNode which then calls the appropriate visitXXX method for every node in the AST, even if you don’t use them.

+ +

Use AbstractWalker instead and implement the walk method to fit the needs of your rule. +It’s as simple as this:

+ +
class MyWalker extends Lint.AbstractWalker<MyOptionsType> {
+    public walk(sourceFile: ts.SourceFile) {
+        const cb = (node: ts.Node): void => {
+            if (someCondition) {
+                // do stuff
+            }
+            // Wondering why return is used below? Refer to "Make use of tail calls"
+            return ts.forEachChild(node, cb); // recurse deeper
+        };
+        return ts.forEachChild(sourceFile, cb); // start recursion with children of sourceFile
+    }
+
+ +

Don’t walk the whole AST if possible

+ +

The language specification is your friend: +The language spec defines where each statement can occur. +For example, if you are interested in import statements, you only need to search in sourceFile.statements and nested NamespaceDeclarations.

+ +

Don’t visit AST branches you’re not interested in: +For example, no-null-keyword creates no failure if the null keyword is part of another type. +There are two ways to achieve this:

+ +
    +
  • Recurse into the AST until you find a token of kind NullKeyword and then walk up its parent chain to find out if it is part of a type node.
  • +
  • Stop recursing deeper into that branch as soon as you hit a type node (preferred).
  • +
+ +

Avoid frequently creating one-time closures in the hot path

+
class SomeClass {
+    // this is a simplified version of what SyntaxWalker does under the hood
+    doStuff(node: ts.Node) {
+        // do stuff ...
+
+        ts.forEachChild(node, (n) => this.doStuff(n));
+                           // ~~~~~~~~~~~~~~~~~~~~~~ [a new closure is created for EVERY node in the AST and remains on the call stack
+                           //                         until processing of all children is done]
+    }
+}
+
+ +

Instead use the same closure for every call like the example above in Implement your own walking algorithm.

+ +

Create small specialized functions / methods

+ +

Instead of stuffing the whole logic in a single closure, consider splitting it up into smaller functions or methods. +Each function should handle similar kinds of nodes. Don’t worry too much about the function call, since V8 eventually inlines the function +if possible.

+ +

The AST nodes have different properties, therefore they have a different hidden class in V8. A function can only be optimized for a certain +amount of different hidden classes. Above that threshold the function will be deoptimized and is never optimized again.

+ +

Supply the optional sourceFile parameter

+ +

There are serveral methods that have an optional parameter sourceFile. Don’t omit this parameter if you care for performance. +If ommitted, typescript needs to walk up the node’s parent chain until it reaches the SourceFile. This can be quite costly when done +frequently on deeply nested nodes.

+ +

Some examples:

+ +
    +
  • node.getStart()
  • +
  • node.getWidth()
  • +
  • node.getText()
  • +
  • node.getChildren()
  • +
  • node.getFirstToken()
  • +
  • node.getLeadingTriviaWidth()
  • +
+ +

Avoid excessive calls to node.getStart(), node.getWidth() and node.getText()

+ +

node.getStart() scans the source to skip all the leading trivia. Although barely noticeable, this operation is not for free. +If you need the start position of a node more than once per function, consider caching it.

+ +

node.getWidth() is most of the time used together with node.getStart() to get the node’s span. Internally it uses node.getEnd() - node.getStart() which effectively doubles the calls to node.getStart(). Consider using node.getEnd() instead and calculate the width yourself if necessary.

+ +

node.getText() calculates the start of the node and returns a substring until the end of the token. +Most of the time this not needed, because this substring is already contained in the node.

+ +
declare node: ts.Identifier;
+node.getText() === node.text; // prefer node.text where available
+
+ +

Bonus points: If you know the width of the node (either from the text property or because it is a keyword of known width), +you can use node.getEnd() - width to calculate the node’s start. +node.getEnd() is effectively for free as it only returns the end property. This way you avoid the cost of skipping leading trivia.

+ +

Make use of tail calls

+ +

Tail calls are function or method calls at the end of the control flow of a function. It’s only a tail call if the return value of that call +is directly returned unchanged. Browsers can optimize this pattern for performance. +Further optimization is specced in ES2015 as “Proper Tail Calls”. +With proper tail calls the browser reuses the stack frame of the current function. When done right this allows for infinite recursion.

+ +
function foo() {
+    if (condition)
+        return bar(); // tail call
+    if (someOtherCondition)
+        return foo() + 1; // no tail call, return value is modified
+    return baz(); // tail call
+}
+
+function bas() {
+    if (cond)
+        return someGlobalVariable = bar(); // no tail call, return value is stored in value before it is returned
+    foo(); // no tail call because there is no return
+}
+
+ +

Typeguards

+ +

Typeguard functions are very small by default. These functions will be inlined into the containing function. +After inlining you no longer pay the cost of the function call.

+ +

But beware of the inlining limit. If a function is big enough or already has many inlined functions, V8 will stop inlining other functions.

+ +

Try to use a discriminated union if possible. A typeguard makes sense if you can save up multiple type assertions.

+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/custom-rules/walker-design.html b/docs/_site/develop/custom-rules/walker-design.html new file mode 100644 index 00000000000..bb02ca8fb15 --- /dev/null +++ b/docs/_site/develop/custom-rules/walker-design.html @@ -0,0 +1,320 @@ + + + + + + + + + Designing rule walkers + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Designing rule walkers

+

+
+ + +

Using WalkContext and applyWithFunction

+ +

If you have a rule with a pretty simple implementation, you don’t need to declare a class which extends the Walker class. Instead, you can define a callback function that accepts following argument:

+ +
    +
  • ctx: WalkContext<T>: An object containing rule information, an object options: T containing the parsed rule arguments, the ts.sourceFile object, and functions for adding failures
  • +
+ +

Use this callback as an argument to applyWithFunction. You can also pass your parsed rule arguments as optional 3rd parameter.

+ +

Let’s look at no-null-keyword as an example:

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "Use 'undefined' instead of 'null'";
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        // Call `applyWithFunction` with your callback function, `walk`.
+        // This creates a `WalkContext<T>` and passes it in as an argument.
+        // An optional 3rd parameter allows you to pass in a parsed version of `this.ruleArguments`. If used, it is not recommended to
+        //     simply pass in `this.getOptions()`, but to parse it into a more useful object instead.
+        return this.applyWithFunction(sourceFile, walk);
+    }
+}
+
+// Here, the options object type is `void` because we don't pass any options in this example.
+function walk(ctx: Lint.WalkContext<void>) {
+    // Recursively walk the AST starting with root node, `ctx.sourceFile`.
+    // Call the function `cb` (defined below) for each child.
+    return ts.forEachChild(ctx.sourceFile, cb);
+    
+    function cb(node: ts.Node): void {
+        // Stop recursing further into the AST by returning early. Here, we ignore type nodes.
+        if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) {
+            return;
+        }
+        
+        // Add failures using the `WalkContext<T>` object. Here, we add a failure if we find the null keyword.
+        if (node.kind === ts.SyntaxKind.NullKeyword) {
+            return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+        }
+        
+        // Continue recursion into the AST by calling function `cb` for every child of the current node.
+        return ts.forEachChild(node, cb);
+    }
+}
+
+ +

Using AbstractWalker

+ +

If your rule implementation is a bit more involved than the above example, you can also implement it as a class. +Simply extend AbstractWalker<T> and implement the walk method.

+ +
import * as ts from "typescript";
+import * as Lint from "tslint";
+
+export class Rule extends Lint.Rules.AbstractRule {
+    public static FAILURE_STRING = "'magic numbers' are not allowed";
+
+    public static ALLOWED_NODES = new Set<ts.SyntaxKind>([
+        ...
+    ]);
+
+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+        // We convert the `ruleArguments` into a useful format before passing it to the constructor of AbstractWalker.
+        return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String))));
+    }
+}
+
+// The type parameter of AbstractWalker corresponds to the third constructor parameter.
+class NoMagicNumbersWalker extends Lint.AbstractWalker<Set<string>> {
+    public walk(sourceFile: ts.SourceFile) {
+        const cb = (node: ts.Node): void => {
+            // Finds specific node types and do checking.
+            if (node.kind === ts.SyntaxKind.NumericLiteral) {
+                this.checkNumericLiteral(node, (node as ts.NumericLiteral).text);
+            } else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression &&
+                       (node as ts.PrefixUnaryExpression).operator === ts.SyntaxKind.MinusToken) {
+                this.checkNumericLiteral(node, "-" + ((node as ts.PrefixUnaryExpression).operand as ts.NumericLiteral).text);
+            } else {
+                // Continue rescursion: call function `cb` for all children of the current node.
+                return ts.forEachChild(node, cb);
+            }
+        };
+        
+        // Start recursion for all children of `sourceFile`.
+        return ts.forEachChild(sourceFile, cb);
+    }
+
+    private checkNumericLiteral(node: ts.Node, num: string) {
+        // `this.options` is the third constructor parameter from above (the Set we created in `Rule.apply`)
+        if (!Rule.ALLOWED_NODES.has(node.parent!.kind) && !this.options.has(num)) {
+            // Add failures to the Walker.
+            this.addFailureAtNode(node, Rule.FAILURE_STRING);
+        }
+    }
+}
+
+ +

Migrating from RuleWalker to AbstractWalker

+ +

The main difference between RuleWalker and AbstractWalker is that you need to implement the AST recursion yourself. But why would you want to do that? +Performance! RuleWalker wants to be “one walker to rule them all” (pun intended). It’s easy to use but that convenience +makes it slow by default. When implementing the walking yourself, you only need to do as much work as needed.

+ +

Besides that you should convert the ruleArguments to a useful format before passing it to AbstractWalker as seen above.

+ +

This table describes the equivalent methods between the two classes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleWalkerAbstractWalker
this.createFailure() and this.addFailure()this.addFailureAt()
this.addFailureFromStartToEnd()this.addFailure()
this.createReplacement()new Lint.Replacement()
this.deleteText()Lint.Replacement.deleteText()
this.deleteFromTo()Lint.Replacement.deleteFromTo()
this.appendText()Lint.Replacement.appendText()
this.hasOption() and this.getOptions()use this.options directly
this.getLineAndCharacterOfPosition()ts.getLineAndCharacterOfPosition(this.sourceFile, ...)
this.getLimit()this.sourceFile.end
this.getSourceFile()is available to be compatible, but prefer this.sourceFile
this.getFailures()is available to be compatible, but prefer this.failures
this.skip()just don’t use it, it’s a noop
this.getRuleName()this.ruleName
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/docs/index.html b/docs/_site/develop/docs/index.html new file mode 100644 index 00000000000..5d03263cfc0 --- /dev/null +++ b/docs/_site/develop/docs/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Docs Development + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Docs Development

+

+
+ + +

This docs site is a Jekyll site hosted on GitHub pages. +It is maintained in the /docs directory of TSLint. +To contribute to the docs, whether it be better styling, functionality, or content, just create a PR as you would for any code contribution.

+ +

Updating Rule Documentation

+

The documentation for rules is automatically generated from the metadata supplied by each rule in its corresponding .ts file. +If you’d like to help improve documentation for them, simply file a PR improving a rule’s metadata and a project collaborator will take care of regenerating the docs site once your PR is merged.

+ +

Running the npm run docs command will regenerate the rules docs based off of the metadata provided in the code. This is normally done each release so that the public docs site is up to date with the latest release.

+ +

Creating New Pages

+

To create a new page, follow the pattern of existing pages. You’ll also need to add appropriate metadata in the _data/*_sidebar.json data file if you want it to show up in a sidebar.

+ +

Creating News Posts

+

To create a new news post, simply add a new markdown file to the _posts directory, following the same pattern as existing ones.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/develop/testing-rules/index.html b/docs/_site/develop/testing-rules/index.html new file mode 100644 index 00000000000..bece43db06c --- /dev/null +++ b/docs/_site/develop/testing-rules/index.html @@ -0,0 +1,322 @@ + + + + + + + + + Testing Rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Testing Rules

+

+
+ + +

Every TSLint rule has a corresponding directory inside test/rules/ which contains one or more test cases for the rule.

+ +

Each test case contains:

+ +
    +
  • A tslint.json file which specifies the configuration for TSLint to use
  • +
  • .ts.lint test files which contain TypeScript code and a special markup which indicate where lint failures should be found
  • +
+ +

The test system lints the .ts.lint files with the settings specified in tslint.json and makes sure that failures generated by the TSLint match the failures marked in the .ts.lint files.

+ +

Example

+ +
Testing a New Rule
+ +

Say we’re contributing a new rule to TSLint that bans the use of animal variable names and we now need to test it. First we create our configuration file which enables only the rule to be tested:

+ +

test/rules/no-animal-variable-names/default/tslint.json:

+ +
{
+  "rules": {
+    "no-animal-variable-names": true
+  }
+}
+
+ +

In this case, we placed our configuration inside no-animal-variable-names/default to indicate that we’re testing the default configuration for our rule.

+ +

Now let’s make the actual test file:

+ +

test/rules/no-animal-variable-names/default/test.ts.lint:

+ +
const octopus = 5;
+      ~~~~~~~      [Variables named after animals are not allowed!]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [Variables named after animals are not allowed!]
+                     ~~~~~  [Variables named after animals are not allowed!]
+
+const tree = 5;
+const skyscraper = 100;
+
+ +

In the above file, ~ characters “underline” where our rule should generate a lint failure +and the message that should be produced appears in brackets afterwards.

+ +

If multiple lint failures occur on the same line of TypeScript code, the markup for them is placed on consecutive lines, +as shown in the above example with the line let giraffe: number, tiger: number;

+ +

Notice how we also include lines of code that shouldn’t generate lint failures. +This is important to ensure that the rule isn’t creating false-positives.

+ +

We can now run yarn compile:test && yarn test:rules to make sure that our rule produces the output we expect.

+ +
Testing a New Rule Option
+ +

Let’s look at one more example. Say we’ve added an also-no-plants option to our rule above that disallows variable names that are plants. We should add a test for this new option:

+ +

test/rules/no-animal-variable-names/also-no-plants/tslint.json:

+ +
{
+  "rules": {
+    "no-animal-variable-names": [true, "also-no-plants"]
+  }
+}
+
+ +

test/rules/no-animal-variable-names/also-no-plants/test.ts.lint:

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal]
+                     ~~~~~  [no-animal]
+
+const tree = 5;
+      ~~~~      [no-plant]
+const skyscraper = 100;
+
+[no-animal]: Variables named after animals are not allowed!
+[no-plant]: Variables named after plants are not allowed!
+
+ +

We’ve now used a special message shorthand syntax so we don’t have to type out the same failure message over and over. +Instead of writing out the full lint failure message after each occurance of it, we instead just specify a shortcut name. +(Shortcut names can only consist of letters, numbers, underscores, and hyphens.) +Then, at the bottom of our test file, we specify what full message each shortcut should expand to.

+ +

Again, we can run yarn compile:test && yarn test:rules to make sure our rule is producing the output we expect. If it isn’t we’ll see the difference between the output from the rule and the output we marked.

+ +

You can also use placeholders to format messages. That’s useful if the error message contains non-static parts, e.g. variable names. But let’s stick to the above example for now.

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal]
+                     ~~~~~  [no-animal]
+
+const tree = 5;
+      ~~~~      [error % ("plants")]
+const skyscraper = 100;
+
+[error] Variables named after %s are not allowed!
+[no-animal]: error % ('animals')
+
+ +

We created a message template called error which has one placeholder %s. For a complete list of supported placeholders, please refer to the documentation of node’s util.format(). +To use the template for formatting, you need to use a special syntax: template_name % ('substitution1' [, "substitution2" [, ...]]). +Substitutions are passed as comma separated list of javascript string literals. The strings need to be wrapped in single or double quotes. Escaping characters works like you would expect in javascript.

+ +

You may have noticed that the template is used for formatting in two different places. Use it in inline errors to pass another substitution every time. +If you use formatting in another message shorthand (like we did for [no-animal]), you need to make sure the template is defined before its use. That means swapping the lines of [error] and [no-animal] will not work. There are no restrictions for the use of [no-animal] in inline errors, though.

+ +

Now let’s pretend the rule changed its error message to include the variable name at the end. The following example shows how to substitute multiple placeholders.

+ +
const octopus = 5;
+      ~~~~~~~     [no-animal % ('octopus')]
+
+let giraffe: number, tiger: number;
+    ~~~~~~~                 [no-animal % ('giraffe')]
+                     ~~~~~  [no-animal % ('tiger')]
+
+const tree = 5;
+      ~~~~      [error % ("plants", "tree")]
+const skyscraper = 100;
+
+[error] Variables named after %s are not allowed: '%s'
+[no-animal]: error % ('animals')
+
+ +
Typescript version requirement
+ +

Sometimes a rule requires a minimum version of the typescript compiler or your test contains syntax that older versions of the typescript parser cannot handle. +When testing with multiple versions of typescript - like tslint does in CI - those tests will fail.

+ +

To avoid failing tests, each test file can specify a version requirement for typescript in the first line. If you don’t specify one, the test will always be executed.

+ +

Example:

+
[typescript]: >= 2.1.0
+
+ +

The syntax should look familiar, because it is basically the shorthand syntax from the chapter above. It needs to start with [typescript]:. +The following part can be any version range. The prerelease suffix will be removed before matching to allow testing with nightly builds.

+ +

Tips & Tricks

+ +
    +
  • +

    You can use this system to test rules outside of the TSLint build! Use the tslint --test path/to/dir command to test your own custom rules. +You can specify one or more paths to tslint.json files or directories containing a tslint.json. Glob patterns are also supported. +Besides the tslint.json each directory you pass should contain *.ts.lint files. You can try this out on the TSLint rule test cases, for example, tslint --test path/to/tslint-code/test/rules/quotemark/single. +If you want to test all of your rules at once, you can use it like this: tslint --test rules/test/**/tslint.json

    +
  • +
  • +

    To test rules that need type information, you can simply add a tsconfig.json with the desired configuration next to tslint.json.

    +
  • +
  • +

    Lint failures sometimes span over multiple lines. To handle this case, don’t specify a message until the end of the error. For example:

    +
  • +
+ +
for (let key in obj) {
+~~~~~~~~~~~~~~~~~~~~~~
+  console.log(key);
+~~~~~~~~~~~~~~~~~~~
+}
+~ [for-in loops are not allowed]
+
+ +
    +
  • If for some reason your lint rule generates a failure that has zero width, you can use the ~nil mark to indicate this.
  • +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/feed.xml b/docs/_site/feed.xml new file mode 100644 index 00000000000..4509afb3a2e --- /dev/null +++ b/docs/_site/feed.xml @@ -0,0 +1,232 @@ + + + + TSLint + TSLint documentation. A linter for the TypeScript language. + + http://localhost:4000/tslint/ + + Fri, 13 Apr 2018 07:56:05 -0400 + Fri, 13 Apr 2018 07:56:05 -0400 + Jekyll v3.6.2 + + + TSLint 4.0 Released + <p>TSLint 4.0 has been released! With this release comes a few exciting <a href="https://github.com/palantir/tslint/releases">changes</a>. Some of the highlights:</p> + +<ul> + <li><strong>Fixers</strong>. Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we’ll fix them for you. To use this feature, run <code class="highlighter-rouge">tslint</code> with the <code class="highlighter-rouge">--fix</code> option. Rules that support the <code class="highlighter-rouge">--fix</code> feature: + <ul> + <li><a href="/tslint/rules/array-type">array-type</a></li> + <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> + <li><a href="/tslint/rules/no-unused-variable">no-unused-variable</a> (for imports)</li> + <li><a href="/tslint/rules/no-var-keyword">no-var-keyword</a></li> + <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> + <li><a href="/tslint/rules/semicolon">semicolon</a></li> + <li><a href="/tslint/rules/trailing-comma">trailing-comma</a></li> + </ul> + </li> + <li> + <p><strong>Linting <code class="highlighter-rouge">.js</code> files</strong>. <em>A much-requested feature from our community</em>. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a <code class="highlighter-rouge">jsRules</code> <a href="https://raw.githubusercontent.com/palantir/tslint/master/src/configs/recommended.ts">section</a> to your <code class="highlighter-rouge">tslint.json</code> file, and TSLint will lint your JavaScript files.</p> + </li> + <li><strong>TypeScript 2.0+ required</strong>. This lets us deprecate/remove rules that are checked by the compiler. Problematic code that once violated these rules now cause compilation errors in <code class="highlighter-rouge">tsc</code>: + <ul> + <li>no-duplicate-key</li> + <li>no-unreachable</li> + <li>no-unused-variable</li> + </ul> + </li> + <li> + <p><strong>Node.js API Change</strong>. <a href="https://github.com/palantir/tslint/pull/1720">Moved and renamed</a> some things to make more sense. Get it all when you use <code class="highlighter-rouge">import * as TSLint from "tslint"</code>.</p> + </li> + <li><strong><a href="https://github.com/palantir/tslint/pull/1717/files#diff-6e3940e8ec3d59837c4435f32975ed2c">Recommended Rules Updated</a></strong> + <ul> + <li><a href="/tslint/rules/adjacent-overload-signatures">adjacent-overload-signatures</a></li> + <li><a href="/tslint/rules/array-type">array-type</a></li> + <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> + <li><a href="/tslint/rules/max-classes-per-file">max-classes-per-file</a></li> + <li><a href="/tslint/rules/no-unsafe-finally">no-unsafe-finally</a></li> + <li><a href="/tslint/rules/object-literal-key-quotes">object-literal-key-quotes</a> (as needed)</li> + <li><a href="/tslint/rules/object-literal-shorthand">object-literal-shorthand</a></li> + <li><a href="/tslint/rules/only-arrow-functions">only-arrow-functions</a></li> + <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> + <li><a href="/tslint/rules/prefer-for-of">prefer-for-of</a></li> + </ul> + </li> + <li><strong>Other rules you might find handy</strong>: + <ul> + <li><a href="/tslint/rules/completed-docs">completed-docs</a></li> + <li><a href="/tslint/rules/cyclomatic-complexity">cyclomatic-complexity</a></li> + </ul> + </li> +</ul> + +<hr /> + +<h2 id="create-your-own-fixer">Create your own fixer</h2> +<p>To create your own fixer, instantiate a <code class="highlighter-rouge">Fix</code> object and pass it in as an argument to <code class="highlighter-rouge">addFailure</code>.</p> + +<p>This snippet updates the <a href="/tslint/develop/custom-rules">sample custom rule</a> by adding a fixer which replaces the offending import statement with an empty string:</p> + +<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// create a fixer for this failure</span> +<span class="kd">const</span> <span class="nx">replacement</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Replacement</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="s2">""</span><span class="p">);</span> +<span class="kd">const</span> <span class="nx">fix</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Fix</span><span class="p">(</span><span class="s2">"no-imports"</span><span class="p">,</span> <span class="p">[</span><span class="nx">replacement</span><span class="p">]);</span> + +<span class="k">this</span><span class="p">.</span><span class="nx">addFailure</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">createFailure</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="nx">Rule</span><span class="p">.</span><span class="nx">FAILURE_STRING</span><span class="p">,</span> <span class="nx">fix</span><span class="p">));</span> +</code></pre></div></div> + + + Thu, 17 Nov 2016 10:19:00 -0500 + http://localhost:4000/tslint/2016/11/17/new-for-4.0.html + http://localhost:4000/tslint/2016/11/17/new-for-4.0.html + + + + + + Sharable Configurations and Rules + <p>With the release of <a href="https://github.com/palantir/tslint/releases">TSLint v3.7.0</a> comes a few new features that will make configuration files (aka <a href="/tslint/usage/tslint-json"><code class="highlighter-rouge">tslint.json</code> files</a>) +easier to maintain and share. The crux of the changes is a new <code class="highlighter-rouge">extends</code> field, which when provided indicates that a configuration +file augments another configuration file.</p> + +<h3 id="example">Example</h3> + +<p>Let’s imagine you’ve created some custom rules and want to share them with others. +You also have a couple of configurations for them you want to share.</p> + +<p>Here’s the layout of our NPM package, which we’ll call <code class="highlighter-rouge">shared-tslint-rules</code>. We have a directory with rules, +as well as a few different config files for TSLint.</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>shared-tslint-rules +├── package.json +├── rules +│   ├── noAdditionRule.js +│   ├── noErrorsRule.js +│   └── noExcessiveCommentingRule.js +├── tslint-base.json +├── tslint-config.json +└── tslint-crazy-config.js +</code></pre></div></div> + +<p>Our starting-point config file just references the directory the custom rules are in +but doesn’t enable any of them:</p> + +<p><strong>tslint-base.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"rulesDirectory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./rules"</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>We also want to provide a sane default config for our rules. +Notice how it extends our base config, so we don’t have to redeclare <code class="highlighter-rouge">rulesDirectory</code> here:</p> + +<p><strong>tslint-config.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"extends"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./tslint-base.json"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"rules"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> + </span><span class="s2">"no-errors"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> + </span><span class="s2">"no-addition"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> + </span><span class="p">}</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>Finally, we can even make a crazy config file for fun that gives you back a different config +each time you run TSLint. Notice how this is a <code class="highlighter-rouge">.js</code> file that exports an object:</p> + +<p><strong>tslint-crazy-config.js</strong></p> + +<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">{</span> + <span class="na">extends</span><span class="p">:</span> <span class="s2">"./tslint-base.json"</span><span class="p">,</span> + <span class="na">rules</span><span class="p">:</span> <span class="p">{</span> + <span class="s2">"no-excessive-commenting"</span><span class="p">:</span> <span class="p">[</span><span class="kc">true</span><span class="p">,</span> <span class="p">{</span><span class="na">maxComments</span><span class="p">:</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="mi">10</span><span class="p">}]</span> + <span class="p">}</span> +<span class="p">};</span> +</code></pre></div></div> + +<p>Finally, we have our <code class="highlighter-rouge">package.json</code> file which references our base config file through its <code class="highlighter-rouge">main</code> field:</p> + +<p><strong>package.json</strong>:</p> + +<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> + </span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shared-tslint-rules"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Some TSLint rules that are great!"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"main"</span><span class="p">:</span><span class="w"> </span><span class="s2">"tslint-base.json"</span><span class="p">,</span><span class="w"> + </span><span class="s2">"scripts"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> + </span><span class="s2">"test"</span><span class="p">:</span><span class="w"> </span><span class="s2">"echo </span><span class="se">\"</span><span class="s2">Error: no test specified</span><span class="se">\"</span><span class="s2"> &amp;&amp; exit 1"</span><span class="w"> + </span><span class="p">},</span><span class="w"> + </span><span class="s2">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> + </span><span class="s2">"license"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MIT"</span><span class="w"> +</span><span class="p">}</span><span class="w"> +</span></code></pre></div></div> + +<p>We can publish our package on NPM to let the world use it!</p> + +<hr /> + +<p>Now let’s say we’re a user, and we want to use the custom rules above to lint our code. +First, we’ll make sure we have the necessary npm packages installed:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install -g tslint shared-tslint-rules +</code></pre></div></div> + +<p>Then, in our <code class="highlighter-rouge">tslint.json</code> file for our project, we can reference the package of custom rules with <code class="highlighter-rouge">extends</code>:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ + "extends": "shared-tslint-rules/tslint-config", + "rules": { + "no-addition": true + } +} +</code></pre></div></div> + +<p>and that’s all we have to do to use the custom rules! +We can now run TSLint as we would normally and see any lint errors produced by the custom rules:</p> + +<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tslint -c path/to/tslint.json my/files/**/to/lint.ts +</code></pre></div></div> + + + Thu, 31 Mar 2016 11:19:00 -0400 + http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html + http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html + + + + + + A New TSLint Website + <p>As TSLint has grown in usage and popularity alongside of TypeScript, it also has +evolved in terms of functionality and complexity. Today, all sorts of projects and products, +from <a href="https://angular.io/">Angular 2</a> to the <a href="https://github.com/Microsoft/TypeScript">TypeScript compiler itself</a> use TSLint +to help keep their code high-quality.</p> + +<p>Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. +For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long <a href="https://github.com/palantir/tslint/blob/409aa6e4aa4b63da11fd61e15b26b0100cf1e845/README.md">TSLint README</a>. +Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. +There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.</p> + +<p>This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:</p> + +<ul> + <li><a href="https://github.com/palantir/tslint/issues/830">A documentation overhaul</a> that will provide +more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.</li> + <li><a href="https://github.com/palantir/tslint/pull/871">A new <code class="highlighter-rouge">--init</code> feature</a> in the TSLint CLI that will make it easier to +generate a sensible initial <code class="highlighter-rouge">tslint.json</code> config file.</li> + <li><a href="https://github.com/palantir/tslint/issues/831">An improved contributor experience</a> that will make things easier for those who want to contribute code to TSLint.</li> +</ul> + +<p>Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!</p> + + + Thu, 10 Dec 2015 15:15:21 -0500 + http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html + http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html + + + + + + diff --git a/docs/_site/formatters/checkstyle/index.html b/docs/_site/formatters/checkstyle/index.html new file mode 100644 index 00000000000..d97cd74a7c6 --- /dev/null +++ b/docs/_site/formatters/checkstyle/index.html @@ -0,0 +1,130 @@ + + + + + + + + + TSLint formatter: checkstyle + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: checkstyle

+

+
+ + +

Formats errors as through they were Checkstyle output.

+ + + +

Imitates the XMLLogger from Checkstyle 4.3. All failures have the ‘warning’ severity.

+ + + +
Sample Output
+
+

<?xml version="1.0" encoding="utf-8"?> +<checkstyle version="4.3"> + <file name="myFile.ts"> + <error line="1" column="14" severity="warning" message="Missing semicolon" source="failure.tslint.semicolon" /> + </file> +</checkstyle>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/codeFrame/index.html b/docs/_site/formatters/codeFrame/index.html new file mode 100644 index 00000000000..646aee20242 --- /dev/null +++ b/docs/_site/formatters/codeFrame/index.html @@ -0,0 +1,134 @@ + + + + + + + + + TSLint formatter: codeFrame + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: codeFrame

+

+
+ + +

Framed formatter which creates a frame of error code.

+ + + +

Prints syntax highlighted code in a frame with a pointer to where +exactly lint error is happening.

+ + + +
Sample Output
+
+

src/components/Payment.tsx +Parentheses are required around the parameters of an arrow function definition (arrow-parens) + 21 | public componentDidMount() { + 22 | this.input.focus(); +> 23 | loadStripe().then(Stripe => Stripe.pay()); + | ^ + 24 | } + 25 | + 26 | public render() {

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/filesList/index.html b/docs/_site/formatters/filesList/index.html new file mode 100644 index 00000000000..7b62038c1bb --- /dev/null +++ b/docs/_site/formatters/filesList/index.html @@ -0,0 +1,120 @@ + + + + + + + + + TSLint formatter: filesList + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: filesList

+

+
+ + +

Lists files containing lint errors.

+ + + +
Sample Output
+

directory/myFile.ts

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/index.html b/docs/_site/formatters/index.html new file mode 100644 index 00000000000..98e0245ee62 --- /dev/null +++ b/docs/_site/formatters/index.html @@ -0,0 +1,155 @@ + + + + + + + + + TSLint core formatters + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint core formatters

+

+
+ + +

Lint formatters allow for transformation of lint results into various forms before outputting to stdout or a file.

+ +

Built-in formatters

+ +
    +
  • +

    checkstyle - Formats errors as through they were Checkstyle output.

    +
  • +
  • +

    codeFrame - Framed formatter which creates a frame of error code.

    +
  • +
  • +

    filesList - Lists files containing lint errors.

    +
  • +
  • +

    json - Formats errors as simple JSON.

    +
  • +
  • +

    junit - Formats errors as through they were JUnit output.

    +
  • +
  • +

    msbuild - Formats errors for consumption by msbuild.

    +
  • +
  • +

    pmd - Formats errors as through they were PMD output.

    +
  • +
  • +

    prose - The default formatter which outputs simple human-readable messages.

    +
  • +
  • +

    stylish - Human-readable formatter which creates stylish messages.

    +
  • +
  • +

    tap - Formats output as TAP stream.

    +
  • +
  • +

    verbose - The human-readable formatter which includes the rule name in messages.

    +
  • +
  • +

    vso - Formats output as VSO/TFS logging commands.

    +
  • +
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/json/index.html b/docs/_site/formatters/json/index.html new file mode 100644 index 00000000000..c78ec762b77 --- /dev/null +++ b/docs/_site/formatters/json/index.html @@ -0,0 +1,142 @@ + + + + + + + + + TSLint formatter: json + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: json

+

+
+ + +

Formats errors as simple JSON.

+ + + +
Sample Output
+
+

[ + { + "endPosition": { + "character": 13, + "line": 0, + "position": 13 + }, + "failure": "Missing semicolon", + "fix": { + "innerStart": 13, + "innerLength": 0, + "innerText": ";" + }, + "name": "myFile.ts", + "ruleName": "semicolon", + "startPosition": { + "character": 13, + "line": 0, + "position": 13 + } + } +]

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/junit/index.html b/docs/_site/formatters/junit/index.html new file mode 100644 index 00000000000..c250017c108 --- /dev/null +++ b/docs/_site/formatters/junit/index.html @@ -0,0 +1,132 @@ + + + + + + + + + TSLint formatter: junit + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: junit

+

+
+ + +

Formats errors as through they were JUnit output.

+ + + +

Imitates the JUnit XML Output

+ + + +
Sample Output
+
+

<?xml version="1.0" encoding="utf-8"?> +<testsuites package="tslint"> + <testsuite name="myFile.ts"> + <testcase name="Line 1, Column 14: semicolon"> + <failure type="warning">Missing semicolon</failure> + </testcase> + </testsuite> +</testsuites>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/msbuild/index.html b/docs/_site/formatters/msbuild/index.html new file mode 100644 index 00000000000..1fd56587a41 --- /dev/null +++ b/docs/_site/formatters/msbuild/index.html @@ -0,0 +1,123 @@ + + + + + + + + + TSLint formatter: msbuild + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: msbuild

+

+
+ + +

Formats errors for consumption by msbuild.

+ + +

The output is compatible with both msbuild and Visual Studio.

+ + + +
Sample Output
+

myFile.ts(1,14): warning: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/pmd/index.html b/docs/_site/formatters/pmd/index.html new file mode 100644 index 00000000000..1cbfa0afbd9 --- /dev/null +++ b/docs/_site/formatters/pmd/index.html @@ -0,0 +1,128 @@ + + + + + + + + + TSLint formatter: pmd + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: pmd

+

+
+ + +

Formats errors as through they were PMD output.

+ + +

Imitates the XML output from PMD. All errors have a priority of 1.

+ + + +
Sample Output
+
+

<pmd version="tslint"> + <file name="myFile.ts"> + <violation begincolumn="14" beginline="1" priority="3" rule="Missing semicolon"></violation> + </file> +</pmd>

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/prose/index.html b/docs/_site/formatters/prose/index.html new file mode 100644 index 00000000000..9f2f5064551 --- /dev/null +++ b/docs/_site/formatters/prose/index.html @@ -0,0 +1,120 @@ + + + + + + + + + TSLint formatter: prose + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: prose

+

+
+ + +

The default formatter which outputs simple human-readable messages.

+ + + +
Sample Output
+

ERROR: myFile.ts[1, 14]: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/stylish/index.html b/docs/_site/formatters/stylish/index.html new file mode 100644 index 00000000000..2a5a45e35b2 --- /dev/null +++ b/docs/_site/formatters/stylish/index.html @@ -0,0 +1,127 @@ + + + + + + + + + TSLint formatter: stylish + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: stylish

+

+
+ + +

Human-readable formatter which creates stylish messages.

+ + + +

The output matches what is produced by ESLint’s stylish formatter. +Its readability is enhanced through spacing and colouring.

+ + + +
Sample Output
+
+

myFile.ts +1:14 semicolon Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/tap/index.html b/docs/_site/formatters/tap/index.html new file mode 100644 index 00000000000..2d49c37147a --- /dev/null +++ b/docs/_site/formatters/tap/index.html @@ -0,0 +1,137 @@ + + + + + + + + + TSLint formatter: tap + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: tap

+

+
+ + +

Formats output as TAP stream.

+ + +

Provides error messages output in TAP13 format which can be consumed by any TAP formatter.

+ + + +
Sample Output
+
+

TAP version 13 +1..1 +not ok 1 - Some error + — + message: Variable has any type + severity: error + data: + ruleName: no-any + fileName: test-file.ts + line: 10 + character: 10 + failureString: Some error + rawLines: Some raw output + …

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/verbose/index.html b/docs/_site/formatters/verbose/index.html new file mode 100644 index 00000000000..e4a50b64168 --- /dev/null +++ b/docs/_site/formatters/verbose/index.html @@ -0,0 +1,123 @@ + + + + + + + + + TSLint formatter: verbose + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: verbose

+

+
+ + +

The human-readable formatter which includes the rule name in messages.

+ + +

The output is the same as the prose formatter with the rule name included

+ + + +
Sample Output
+

ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/formatters/vso/index.html b/docs/_site/formatters/vso/index.html new file mode 100644 index 00000000000..9d75a798dd9 --- /dev/null +++ b/docs/_site/formatters/vso/index.html @@ -0,0 +1,125 @@ + + + + + + + + + TSLint formatter: vso + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint formatter: vso

+

+
+ + +

Formats output as VSO/TFS logging commands.

+ + + +

Integrates with Visual Studio Online and Team Foundation Server by outputting errors +as ‘warning’ logging commands.

+ + + +
Sample Output
+

##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon

+
+ + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/index.html b/docs/_site/index.html new file mode 100644 index 00000000000..783c4e542bc --- /dev/null +++ b/docs/_site/index.html @@ -0,0 +1,117 @@ + + + + + + + + + TSLint + + + + + + + + + + + +
+ + + + +
+ + +
+

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.

+ +

Quick start

+ +
# Install the global CLI and its peer dependency
+yarn global add tslint typescript
+
+# Navigate to to your sources folder
+cd path/to/project
+
+# Generate a basic configuration file
+tslint --init
+
+# Lint TypeScript source globs
+tslint -c tslint.json 'src/**/*.ts'
+
+ +

Check out the full usage guide to learn more.

+ + + + +
+ + + + diff --git a/docs/_site/news/index.html b/docs/_site/news/index.html new file mode 100644 index 00000000000..6f757ed92e5 --- /dev/null +++ b/docs/_site/news/index.html @@ -0,0 +1,202 @@ + + + + + + + + + News + + + + + + + + + + + +
+ + +
+ + +
+
+
+ + + +
+

TSLint 4.0 Released

+ +
+
+

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

+ + + +
+ +

Create your own fixer

+

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

+ +

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

+ +
// create a fixer for this failure
+const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
+const fix = new Lint.Fix("no-imports", [replacement]);
+
+this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
+
+ + +
+ +
+ + +

Also Read...

+ + + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/adjacent-overload-signatures/index.html b/docs/_site/rules/adjacent-overload-signatures/index.html new file mode 100644 index 00000000000..bac8513a733 --- /dev/null +++ b/docs/_site/rules/adjacent-overload-signatures/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: adjacent-overload-signatures + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: adjacent-overload-signatures

+

+
+ + +

Enforces function overloads to be consecutive.

+ + + + +
Rationale
+

Improves readability and organization by grouping naturally related items together.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"adjacent-overload-signatures": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/align/index.html b/docs/_site/rules/align/index.html new file mode 100644 index 00000000000..4f02cdd3092 --- /dev/null +++ b/docs/_site/rules/align/index.html @@ -0,0 +1,174 @@ + + + + + + + + + Rule: align + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: align

+

+
+ + +

Enforces vertical alignment.

+ + + + +
Rationale
+

Helps maintain a readable, consistent style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "parameters" checks alignment of function parameters.
  • +
  • "arguments" checks alignment of function call arguments.
  • +
  • "statements" checks alignment of statements.
  • +
  • "members" checks alignment of members of classes, interfaces, type literal, object literals and +object destructuring.
  • +
  • "elements" checks alignment of elements of array iterals, array destructuring and tuple types.
  • +
+ + +
Config examples
+ +
+"align": [true, "parameters", "statements"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "arguments",
+      "elements",
+      "members",
+      "parameters",
+      "statements"
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/array-type/index.html b/docs/_site/rules/array-type/index.html new file mode 100644 index 00000000000..d4a3ee2a3bf --- /dev/null +++ b/docs/_site/rules/array-type/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: array-type + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: array-type

+

+
+ + +

Requires using either ‘T[]’ or ‘Array' for arrays.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • "array" enforces use of T[] for all types T.
  • +
  • "generic" enforces use of Array<T> for all types T.
  • +
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
  • +
+ + +
Config examples
+ +
+"array-type": [true, "array"]
+
+ +
+"array-type": [true, "generic"]
+
+ +
+"array-type": [true, "array-simple"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "array",
+    "generic",
+    "array-simple"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/arrow-parens/index.html b/docs/_site/rules/arrow-parens/index.html new file mode 100644 index 00000000000..d3a3ac56769 --- /dev/null +++ b/docs/_site/rules/arrow-parens/index.html @@ -0,0 +1,161 @@ + + + + + + + + + Rule: arrow-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: arrow-parens

+

+
+ + +

Requires parentheses around the parameters of arrow function definitions.

+ + + + +
Rationale
+

Maintains stylistic consistency with other arrow function definitions.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If ban-single-arg-parens is specified, then arrow functions with one parameter +must not have parentheses if removing them is allowed by TypeScript.

+ + +
Config examples
+ +
+"arrow-parens": true
+
+ +
+"arrow-parens": [true, "ban-single-arg-parens"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ban-single-arg-parens"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/arrow-return-shorthand/index.html b/docs/_site/rules/arrow-return-shorthand/index.html new file mode 100644 index 00000000000..6dacef1b99b --- /dev/null +++ b/docs/_site/rules/arrow-return-shorthand/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: arrow-return-shorthand + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: arrow-return-shorthand

+

+
+ + +

Suggests to convert () => { return x; } to () => x.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If multiline is specified, then this will warn even if the function spans multiple lines.

+ + +
Config examples
+ +
+"arrow-return-shorthand": true
+
+ +
+"arrow-return-shorthand": [true, "multiline"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "multiline"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/await-promise/index.html b/docs/_site/rules/await-promise/index.html new file mode 100644 index 00000000000..d1a701b8ed7 --- /dev/null +++ b/docs/_site/rules/await-promise/index.html @@ -0,0 +1,173 @@ + + + + + + + + + Rule: await-promise + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: await-promise

+

+
+ + +

Warns for an awaited value that is not a Promise.

+ + + + +
Rationale
+ +

While it is valid TypeScript to await a non-Promise-like value (it will resolve immediately), +this pattern is often a programmer error and the resulting semantics can be unintuitive.

+ + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

A list of ‘string’ names of any additional classes that should also be treated as Promises. +For example, if you are using a class called ‘Future’ that implements the Thenable interface, +you might tell the rule to consider type references with the name ‘Future’ as valid Promise-like +types. Note that this rule doesn’t check for type assignability or compatibility; it just checks +type reference names.

+ + + +
Config examples
+ +
+"await-promise": true
+
+ +
+"await-promise": [true, "Thenable"]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban-comma-operator/index.html b/docs/_site/rules/ban-comma-operator/index.html new file mode 100644 index 00000000000..d5d006d0c53 --- /dev/null +++ b/docs/_site/rules/ban-comma-operator/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: ban-comma-operator + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban-comma-operator

+

+
+ + +

Disallows the comma operator to be used.

+ + +

Read more about the comma operator here.

+ + + + +
Rationale
+ +

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

+ +

Examples

+
foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
+
+ +
switch (foo) {
+    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
+        return true;
+    case 3:
+        return false;
+}
+
+ +
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
+
+ + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ + + +
Config examples
+ +
+"ban-comma-operator": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban-types/index.html b/docs/_site/rules/ban-types/index.html new file mode 100644 index 00000000000..e59fdf5938f --- /dev/null +++ b/docs/_site/rules/ban-types/index.html @@ -0,0 +1,160 @@ + + + + + + + + + Rule: ban-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban-types

+

+
+ + + +

Bans specific types from being used. Does not ban the +corresponding runtime objects from being used.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

A list of ["regex", "optional explanation here"], which bans +types that match regex

+ + +
Config examples
+ +
+"ban-types": [true, ["Object", "Use {} instead."], ["String"]]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "minLength": 1,
+    "maxLength": 2
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ban/index.html b/docs/_site/rules/ban/index.html new file mode 100644 index 00000000000..e47ac88aa1d --- /dev/null +++ b/docs/_site/rules/ban/index.html @@ -0,0 +1,212 @@ + + + + + + + + + Rule: ban + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ban

+

+
+ + +

Bans the use of specific functions or global methods.

+ + + + + + + +

Config

+ +

A list of banned functions or methods in the following format:

+ +
    +
  • banning functions: +
      +
    • just the name of the function: "functionName"
    • +
    • the name of the function in an array with one element: ["functionName"]
    • +
    • an object in the following format: {"name": "functionName", "message": "optional explanation message"}
    • +
    +
  • +
  • banning methods: +
      +
    • an array with the object name, method name and optional message: ["functionName", "methodName", "optional message"]
    • +
    • an object in the following format: {"name": ["objectName", "methodName"], "message": "optional message"} +
        +
      • you can also ban deeply nested methods: {"name": ["foo", "bar", "baz"]} bans foo.bar.baz()
      • +
      • the first element can contain a wildcard (*) that matches everything. {"name": ["*", "forEach"]} bans [].forEach(...), $(...).forEach(...), arr.forEach(...), etc.
      • +
      +
    • +
    +
  • +
+ + +
Config examples
+ +
+"ban": [
+  true,
+  "eval",
+  {"name": "$", "message": "please don't"},
+  ["describe", "only"],
+  {"name": ["it", "only"], "message": "don't focus tests"},
+  {
+    "name": ["chai", "assert", "equal"],
+    "message": "Use 'strictEqual' instead."
+  },
+  {"name": ["*", "forEach"], "message": "Use a regular for loop instead."}
+]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "anyOf": [
+      {
+        "type": "string"
+      },
+      {
+        "type": "array",
+        "items": {
+          "type": "string"
+        },
+        "minLength": 1,
+        "maxLength": 3
+      },
+      {
+        "type": "object",
+        "properties": {
+          "name": {
+            "anyOf": [
+              {
+                "type": "string"
+              },
+              {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                },
+                "minLength": 1
+              }
+            ]
+          },
+          "message": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "name"
+        ]
+      }
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/binary-expression-operand-order/index.html b/docs/_site/rules/binary-expression-operand-order/index.html new file mode 100644 index 00000000000..c47cfd681c5 --- /dev/null +++ b/docs/_site/rules/binary-expression-operand-order/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: binary-expression-operand-order + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: binary-expression-operand-order

+

+
+ + + +

In a binary expression, a literal should always be on the right-hand side if possible. +For example, prefer ‘x + 1’ over ‘1 + x’.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"binary-expression-operand-order": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/callable-types/index.html b/docs/_site/rules/callable-types/index.html new file mode 100644 index 00000000000..939ef40dffe --- /dev/null +++ b/docs/_site/rules/callable-types/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: callable-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: callable-types

+

+
+ + +

An interface or literal type with just a call signature can be written as a function type.

+ + + + +
Rationale
+

style

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/class-name/index.html b/docs/_site/rules/class-name/index.html new file mode 100644 index 00000000000..a7b3db2ee23 --- /dev/null +++ b/docs/_site/rules/class-name/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: class-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: class-name

+

+
+ + +

Enforces PascalCased class and interface names.

+ + + + +
Rationale
+

Makes it easy to differentiate classes from regular variables at a glance.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"class-name": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/comment-format/index.html b/docs/_site/rules/comment-format/index.html new file mode 100644 index 00000000000..4b8e4d9bea6 --- /dev/null +++ b/docs/_site/rules/comment-format/index.html @@ -0,0 +1,201 @@ + + + + + + + + + Rule: comment-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: comment-format

+

+
+ + +

Enforces formatting rules for single-line comments.

+ + + + +
Rationale
+

Helps maintain a consistent, readable style in your codebase.

+ + + + + +

Config

+ +

Three arguments may be optionally provided:

+ +
    +
  • "check-space" requires that all single-line comments must begin with a space, as in // comment +
      +
    • note that for comments starting with multiple slashes, e.g. ///, leading slashes are ignored
    • +
    • TypeScript reference comments are ignored completely
    • +
    +
  • +
  • "check-lowercase" requires that the first non-whitespace character of a comment must be lowercase, if applicable.
  • +
  • "check-uppercase" requires that the first non-whitespace character of a comment must be uppercase, if applicable.
  • +
+ +

Exceptions to "check-lowercase" or "check-uppercase" can be managed with object that may be passed as last argument.

+ +

One of two options can be provided in this object:

+ +
* `"ignore-words"`  - array of strings - words that will be ignored at the beginning of the comment.
+* `"ignore-pattern"` - string - RegExp pattern that will be ignored at the beginning of the comment.
+
+ + +
Config examples
+ +
+"comment-format": [true, "check-space", "check-uppercase"]
+
+ +
+"comment-format": [true, "check-lowercase", {"ignore-words": ["TODO", "HACK"]}]
+
+ +
+"comment-format": [true, "check-lowercase", {"ignore-pattern": "STD\\w{2,3}\\b"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "anyOf": [
+      {
+        "type": "string",
+        "enum": [
+          "check-space",
+          "check-lowercase",
+          "check-uppercase"
+        ]
+      },
+      {
+        "type": "object",
+        "properties": {
+          "ignore-words": {
+            "type": "array",
+            "items": {
+              "type": "string"
+            }
+          },
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "minProperties": 1,
+        "maxProperties": 1
+      }
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 4
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/completed-docs/index.html b/docs/_site/rules/completed-docs/index.html new file mode 100644 index 00000000000..f2482b31f7b --- /dev/null +++ b/docs/_site/rules/completed-docs/index.html @@ -0,0 +1,553 @@ + + + + + + + + + Rule: completed-docs + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: completed-docs

+

+
+ + +

Enforces documentation for important items be filled out.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ +

true to enable for [classes, functions, methods, properties]], +or an array with each item in one of two formats:

+ +
    +
  • string to enable for that type
  • +
  • object keying types to when their documentation is required: +
      +
    • "methods" and "properties" may specify: +
        +
      • "privacies": +
          +
        • "all"
        • +
        • "private"
        • +
        • "protected"
        • +
        • "public"
        • +
        +
      • +
      • "locations": +
          +
        • "all"
        • +
        • "instance"
        • +
        • "static"
        • +
        +
      • +
      +
    • +
    • Other types may specify "visibilities": +
        +
      • "all"
      • +
      • "exported"
      • +
      • "internal"
      • +
      +
    • +
    • All types may also provide "tags" +with members specifying tags that allow the docs to not have a body. +
        +
      • "content": Object mapping tags to RegExp bodies content allowed to count as complete docs.
      • +
      • "existence": Array of tags that must only exist to count as complete docs.
      • +
      +
    • +
    +
  • +
+ +

Types that may be enabled are:

+ +
    +
  • "classes"
  • +
  • "enums"
  • +
  • "enum-members"
  • +
  • "functions"
  • +
  • "interfaces"
  • +
  • "methods"
  • +
  • "namespaces"
  • +
  • "properties"
  • +
  • "types"
  • +
  • "variables"
  • +
+ + +
Config examples
+ +
+"completed-docs": true
+
+ +
+"completed-docs": [true, "enums", "functions", "methods"]
+
+ +
+"completed-docs": [
+  true,
+  {
+    "enums": true,
+    "functions": {"visibilities": ["exported"]},
+    "methods": {"locations": "instance", "privacies": ["public", "protected"]},
+    "tags": {"content": {"see": ["#.*"]}, "existence": ["inheritdoc"]}
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "anyOf": [
+      {
+        "options": [
+          "classes",
+          "enums",
+          "functions",
+          "interfaces",
+          "methods",
+          "namespaces",
+          "properties",
+          "types",
+          "variables"
+        ],
+        "type": "string"
+      },
+      {
+        "type": "object",
+        "properties": {
+          "classes": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "enums": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "enum-members": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "functions": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "interfaces": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "methods": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "locations": {
+                "enum": [
+                  "all",
+                  "instance",
+                  "static"
+                ],
+                "type": "string"
+              },
+              "privacies": {
+                "enum": [
+                  "all",
+                  "private",
+                  "protected",
+                  "public"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "namespaces": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "properties": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "locations": {
+                "enum": [
+                  "all",
+                  "instance",
+                  "static"
+                ],
+                "type": "string"
+              },
+              "privacies": {
+                "enum": [
+                  "all",
+                  "private",
+                  "protected",
+                  "public"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "types": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
+          "variables": {
+            "properties": {
+              "tags": {
+                "properties": {
+                  "content": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "object"
+                  },
+                  "existence": {
+                    "items": {
+                      "type": "string"
+                    },
+                    "type": "array"
+                  }
+                }
+              },
+              "visibilities": {
+                "enum": [
+                  "all",
+                  "exported",
+                  "internal"
+                ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          }
+        }
+      }
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/curly/index.html b/docs/_site/rules/curly/index.html new file mode 100644 index 00000000000..67d2db2083f --- /dev/null +++ b/docs/_site/rules/curly/index.html @@ -0,0 +1,263 @@ + + + + + + + + + Rule: curly + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: curly

+

+
+ + +

Enforces braces for if/for/do/while statements.

+ + + + +
Rationale
+ +
if (foo === bar)
+    foo++;
+    bar++;
+
+ +

In the code above, the author almost certainly meant for both foo++ and bar++ +to be executed only if foo === bar. However, they forgot braces and bar++ will be executed +no matter what. This rule could prevent such a mistake.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following options may be provided:

+ +
    +
  • "as-needed" forbids any unnecessary curly braces.
  • +
  • "ignore-same-line" skips checking braces for control-flow statements +that are on one line and start on the same line as their control-flow keyword
  • +
+ + + +
Config examples
+ +
+"curly": true
+
+ +
+"curly": [true, "ignore-same-line"]
+
+ +
+"curly": [true, "as-needed"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "as-needed",
+      "ignore-same-line"
+    ]
+  }
+}
+
+ + +

Code examples:

+ +
+
Require curly braces whenever possible (default)
+
"rules": { "curly": true }
+
+ +
Passes
+
+
if (x > 0) {
+    doStuff();
+}
+
+ +
+ +
Fails
+
+
if (x > 0)
+    doStuff();
+
+if (x > 0) doStuff();
+
+ +
+ +
+ +
+
Make an exception for single-line instances
+
"rules": { "curly": [true, "ignore-same-line"] }
+
+ +
Passes
+
+
if (x > 0) doStuff();
+
+ +
+ +
Fails
+
+
if (x > 0)
+    doStuff()
+
+ +
+ +
+ +
+
Error on unnecessary curly braces
+
"rules": { "curly": [true, "as-needed"] }
+
+ +
Passes
+
+
if (x > 0)
+    doStuff();
+
+if (x > 0) {
+    customerUpdates.push(getInfo(customerId));
+    return customerUpdates;
+}
+
+ +
+ +
Fails
+
+
if (x > 0) {
+    doStuff();
+}
+
+ +
+ +
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/cyclomatic-complexity/index.html b/docs/_site/rules/cyclomatic-complexity/index.html new file mode 100644 index 00000000000..1d6423fdb9e --- /dev/null +++ b/docs/_site/rules/cyclomatic-complexity/index.html @@ -0,0 +1,168 @@ + + + + + + + + + Rule: cyclomatic-complexity + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: cyclomatic-complexity

+

+
+ + +

Enforces a threshold of cyclomatic complexity.

+ + + +

Cyclomatic complexity is assessed for each function of any type. A starting value of 0 +is assigned and this value is then incremented for every statement which can branch the +control flow within the function. The following statements and expressions contribute +to cyclomatic complexity:

+
    +
  • catch
  • +
  • if and ? :
  • +
  • || and && due to short-circuit evaluation
  • +
  • for, for in and for of loops
  • +
  • while and do while loops
  • +
  • case clauses that contain statements
  • +
+ + + + +
Rationale
+ +

Cyclomatic complexity is a code metric which indicates the level of complexity in a +function. High cyclomatic complexity indicates confusing code which may be prone to +errors or difficult to modify.

+ + + + + +

Config

+ +

An optional upper limit for cyclomatic complexity can be specified. If no limit option +is provided a default value of 20 will be used.

+ + +
Config examples
+ +
+"cyclomatic-complexity": true
+
+ +
+"cyclomatic-complexity": [true, 20]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/deprecation/index.html b/docs/_site/rules/deprecation/index.html new file mode 100644 index 00000000000..6b290335b9a --- /dev/null +++ b/docs/_site/rules/deprecation/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: deprecation + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: deprecation

+

+
+ + +

Warns when deprecated APIs are used.

+ + +

Any usage of an identifier + with the @deprecated JSDoc annotation will trigger a warning. + See http://usejsdoc.org/tags-deprecated.html

+ + + + +
Rationale
+

Deprecated APIs should be avoided, and usage updated.

+ + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ + + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/encoding/index.html b/docs/_site/rules/encoding/index.html new file mode 100644 index 00000000000..d0613e55711 --- /dev/null +++ b/docs/_site/rules/encoding/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: encoding + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: encoding

+

+
+ + +

Enforces UTF-8 file encoding.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"encoding": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/eofline/index.html b/docs/_site/rules/eofline/index.html new file mode 100644 index 00000000000..51b2108440c --- /dev/null +++ b/docs/_site/rules/eofline/index.html @@ -0,0 +1,153 @@ + + + + + + + + + Rule: eofline + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: eofline

+

+
+ + +

Ensures the file ends with a newline.

+ + +

Fix for single-line files is not supported.

+ + + + +
Rationale
+

It is a standard convention to end files with a newline.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"eofline": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/file-header/index.html b/docs/_site/rules/file-header/index.html new file mode 100644 index 00000000000..b4710fc3412 --- /dev/null +++ b/docs/_site/rules/file-header/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: file-header + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: file-header

+

+
+ + +

Enforces a certain header comment for all files, matched by a regular expression.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

The first option, which is mandatory, is a regular expression that all headers should match. +The second argument, which is optional, is a string that should be inserted as a header comment +if fixing is enabled and no header that matches the first argument is found.

+ + +
Config examples
+ +
+"file-header": [true, "Copyright \\d{4}", "Copyright 2017"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string"
+    },
+    {
+      "type": "string"
+    }
+  ],
+  "additionalItems": false,
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/forin/index.html b/docs/_site/rules/forin/index.html new file mode 100644 index 00000000000..1f122885be1 --- /dev/null +++ b/docs/_site/rules/forin/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: forin + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: forin

+

+
+ + +

Requires a for ... in statement to be filtered with an if statement.

+ + + + +
Rationale
+ +
for (let key in someObject) {
+    if (someObject.hasOwnProperty(key)) {
+        // code here
+    }
+}
+
+

Prevents accidental iteration over properties inherited from an object’s prototype. +See MDN’s for...in +documentation for more information about for...in loops.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"forin": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/import-blacklist/index.html b/docs/_site/rules/import-blacklist/index.html new file mode 100644 index 00000000000..7d2743b197b --- /dev/null +++ b/docs/_site/rules/import-blacklist/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: import-blacklist + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: import-blacklist

+

+
+ + + +

Disallows importing the specified modules directly via import and require. +Instead only sub modules may be imported from that module.

+ + + + +
Rationale
+ +

Some libraries allow importing their submodules instead of the entire module. +This is good practise as it avoids loading unused modules.

+ + + + + +

Config

+

A list of blacklisted modules.

+ + +
Config examples
+ +
+"import-blacklist": true
+
+ +
+"import-blacklist": [true, "rxjs", "lodash"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "minLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/import-spacing/index.html b/docs/_site/rules/import-spacing/index.html new file mode 100644 index 00000000000..8d712d11753 --- /dev/null +++ b/docs/_site/rules/import-spacing/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: import-spacing + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: import-spacing

+

+
+ + +

Ensures proper spacing between import statement keywords

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"import-spacing": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/indent/index.html b/docs/_site/rules/indent/index.html new file mode 100644 index 00000000000..b65104e5a91 --- /dev/null +++ b/docs/_site/rules/indent/index.html @@ -0,0 +1,197 @@ + + + + + + + + + Rule: indent + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: indent

+

+
+ + +

Enforces indentation with tabs or spaces.

+ + + + +
Rationale
+ +

Using only one of tabs or spaces for indentation leads to more consistent editor behavior, +cleaner diffs in version control, and easier programmatic manipulation.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • spaces enforces consistent spaces.
  • +
  • tabs enforces consistent tabs.
  • +
+ +

A second optional argument specifies indentation size:

+ +
    +
  • 2 enforces 2 space indentation.
  • +
  • 4 enforces 4 space indentation.
  • +
+ +

Indentation size is required for auto-fixing, but not for rule checking.

+ +

NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

+ + +
Config examples
+ +
+"indent": [true, "spaces"]
+
+ +
+"indent": [true, "spaces", 4]
+
+ +
+"indent": [true, "tabs", 2]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string",
+      "enum": [
+        "tabs",
+        "spaces"
+      ]
+    },
+    {
+      "type": "number",
+      "enum": [
+        2,
+        4
+      ]
+    }
+  ],
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/index.html b/docs/_site/rules/index.html new file mode 100644 index 00000000000..1404635d114 --- /dev/null +++ b/docs/_site/rules/index.html @@ -0,0 +1,2129 @@ + + + + + + + + + TSLint core rules + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint core rules

+

+
+ + +

Lint rules encode logic for syntactic & semantic checks of TypeScript source code.

+ +

TypeScript-specific

+ +

These rules find errors related to TypeScript features:

+ + + +

Functionality

+ +

These rules catch common errors in JS programming or otherwise confusing constructs that are prone to producing bugs:

+ + + +

Maintainability

+ +

These rules make code maintenance easier:

+ + + +

Style

+ +

These rules enforce consistent style across your codebase:

+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/interface-name/index.html b/docs/_site/rules/interface-name/index.html new file mode 100644 index 00000000000..924f15b4961 --- /dev/null +++ b/docs/_site/rules/interface-name/index.html @@ -0,0 +1,166 @@ + + + + + + + + + Rule: interface-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: interface-name

+

+
+ + +

Requires interface names to begin with a capital ‘I’

+ + + + +
Rationale
+

Makes it easy to differentiate interfaces from regular classes at a glance.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

One of the following two options must be provided:

+ +
    +
  • "always-prefix" requires interface names to start with an “I”
  • +
  • "never-prefix" requires interface names to not have an “I” prefix
  • +
+ + +
Config examples
+ +
+"interface-name": [true, "always-prefix"]
+
+ +
+"interface-name": [true, "never-prefix"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always-prefix",
+    "never-prefix"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/interface-over-type-literal/index.html b/docs/_site/rules/interface-over-type-literal/index.html new file mode 100644 index 00000000000..68ef94ccc0e --- /dev/null +++ b/docs/_site/rules/interface-over-type-literal/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: interface-over-type-literal + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: interface-over-type-literal

+

+
+ + +

Prefer an interface declaration over a type literal (type T = { ... })

+ + + + +
Rationale
+

Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"interface-over-type-literal": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/jsdoc-format/index.html b/docs/_site/rules/jsdoc-format/index.html new file mode 100644 index 00000000000..efbb195d859 --- /dev/null +++ b/docs/_site/rules/jsdoc-format/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: jsdoc-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: jsdoc-format

+

+
+ + +

Enforces basic format rules for JSDoc comments.

+ + + +

The following rules are enforced for JSDoc comments (comments starting with /**):

+ +
    +
  • each line contains an asterisk and asterisks must be aligned
  • +
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • +
  • the only characters before the asterisk on each line must be whitespace characters
  • +
  • one line comments must start with /** and end with */
  • +
  • multiline comments don’t allow text after /** in the first line (with option "check-multiline-start")
  • +
+ + + + + +
Rationale
+

Helps maintain a consistent, readable style for JSDoc comments.

+ + + + + +

Config

+ +

You can optionally specify the option "check-multiline-start" to enforce the first line of a +multiline JSDoc comment to be empty.

+ + + +
Config examples
+ +
+"jsdoc-format": true
+
+ +
+"jsdoc-format": [true, "check-multiline-start"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "minItems": 0,
+  "maxItems": 1,
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-multiline-start"
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/label-position/index.html b/docs/_site/rules/label-position/index.html new file mode 100644 index 00000000000..e46696204ce --- /dev/null +++ b/docs/_site/rules/label-position/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: label-position + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: label-position

+

+
+ + +

Only allows labels in sensible locations.

+ + +

This rule only allows labels to be on do/for/while/switch statements.

+ + + + +
Rationale
+ +

Labels in JavaScript only can be used in conjunction with break or continue, +constructs meant to be used for loop flow control. While you can theoretically use +labels on any block statement in JS, it is considered poor code structure to do so.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"label-position": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/linebreak-style/index.html b/docs/_site/rules/linebreak-style/index.html new file mode 100644 index 00000000000..f597372c0a1 --- /dev/null +++ b/docs/_site/rules/linebreak-style/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: linebreak-style + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: linebreak-style

+

+
+ + +

Enforces a consistent linebreak style.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following options must be provided:

+ +
    +
  • "LF" requires LF (\n) linebreaks
  • +
  • "CRLF" requires CRLF (\r\n) linebreaks
  • +
+ + +
Config examples
+ +
+"linebreak-style": [true, "LF"]
+
+ +
+"linebreak-style": [true, "CRLF"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "LF",
+    "CRLF"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/match-default-export-name/index.html b/docs/_site/rules/match-default-export-name/index.html new file mode 100644 index 00000000000..4c91ce493c2 --- /dev/null +++ b/docs/_site/rules/match-default-export-name/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: match-default-export-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: match-default-export-name

+

+
+ + + +

Requires that a default import have the same name as the declaration it imports. +Does nothing for anonymous default exports.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"match-default-export-name": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-classes-per-file/index.html b/docs/_site/rules/max-classes-per-file/index.html new file mode 100644 index 00000000000..69ab82fb2e0 --- /dev/null +++ b/docs/_site/rules/max-classes-per-file/index.html @@ -0,0 +1,167 @@ + + + + + + + + + Rule: max-classes-per-file + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-classes-per-file

+

+
+ + + +

A file may not contain more than the specified number of classes

+ + + + +
Rationale
+ +

Ensures that files have a single responsibility so that that classes each exist in their own files

+ + + + + +

Config

+ +

The one required argument is an integer indicating the maximum number of classes that can appear in a +file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions +from the overall class count.

+ + +
Config examples
+ +
+"max-classes-per-file": [true, 1]
+
+ +
+"max-classes-per-file": [true, 5, "exclude-class-expressions"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "number",
+      "minimum": 1
+    },
+    {
+      "type": "string",
+      "enum": [
+        "exclude-class-expressions"
+      ]
+    }
+  ],
+  "additionalItems": false,
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-file-line-count/index.html b/docs/_site/rules/max-file-line-count/index.html new file mode 100644 index 00000000000..562c9284102 --- /dev/null +++ b/docs/_site/rules/max-file-line-count/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: max-file-line-count + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-file-line-count

+

+
+ + +

Requires files to remain under a certain number of lines

+ + + + +
Rationale
+ +

Limiting the number of lines allowed in a file allows files to remain small, +single purpose, and maintainable.

+ + + + + +

Config

+

An integer indicating the maximum number of lines.

+ + +
Config examples
+ +
+"max-file-line-count": [true, 300]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": "1"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/max-line-length/index.html b/docs/_site/rules/max-line-length/index.html new file mode 100644 index 00000000000..2f3b787f5df --- /dev/null +++ b/docs/_site/rules/max-line-length/index.html @@ -0,0 +1,191 @@ + + + + + + + + + Rule: max-line-length + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: max-line-length

+

+
+ + +

Requires lines to be under a certain max length.

+ + + + +
Rationale
+ +

Limiting the length of a line of code improves code readability. +It also makes comparing code side-by-side easier and improves compatibility with +various editors, IDEs, and diff viewers.

+ + + + + +

Config

+ +

It can take one argument, which can be any of the following:

+
    +
  • integer indicating maximum length of lines.
  • +
  • object with keys: +
      +
    • limit - number < 0 defining max line length
    • +
    • ignore-pattern - string defining ignore pattern for this rule, being parsed by new RegExp(). +For example: +
        +
      • // pattern will ignore all in-line comments.
      • +
      • ^import pattern will ignore all import statements.
      • +
      • ^export {(.*?)} pattern will ignore all multiple export statements.
      • +
      • class [a-zA-Z] implements pattern will ignore all class declarations implementing interfaces.
      • +
      • ^import |^export {(.*?)}|class [a-zA-Z] implements |// pattern will ignore all the cases listed above.
      • +
      +
    • +
    +
  • +
+ + + +
Config examples
+ +
+"max-line-length": [true, 120]
+
+ +
+"max-line-length": [true, {"limit": 120, "ignore-pattern": "^import |^export {(.*?)}"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "oneOf": [
+      {
+        "type": "number"
+      },
+      {
+        "type": "object",
+        "properties": {
+          "limit": {
+            "type": "number"
+          },
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false
+      }
+    ]
+  },
+  "minLength": 1,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/member-access/index.html b/docs/_site/rules/member-access/index.html new file mode 100644 index 00000000000..d6a99a3913d --- /dev/null +++ b/docs/_site/rules/member-access/index.html @@ -0,0 +1,181 @@ + + + + + + + + + Rule: member-access + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: member-access

+

+
+ + +

Requires explicit visibility declarations for class members.

+ + + + +
Rationale
+

Explicit visibility declarations can make code more readable and accessible for those new to TS.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

These arguments may be optionally provided:

+ +
    +
  • "no-public" forbids public accessibility to be specified, because this is the default.
  • +
  • "check-accessor" enforces explicit visibility on get/set accessors
  • +
  • "check-constructor" enforces explicit visibility on constructors
  • +
  • "check-parameter-property" enforces explicit visibility on parameter properties
  • +
+ + +
Config examples
+ +
+"member-access": true
+
+ +
+"member-access": [true, "no-public"]
+
+ +
+"member-access": [true, "check-accessor"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "no-public",
+      "check-accessor",
+      "check-constructor",
+      "check-parameter-property"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 4
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/member-ordering/index.html b/docs/_site/rules/member-ordering/index.html new file mode 100644 index 00000000000..1ecb56d9037 --- /dev/null +++ b/docs/_site/rules/member-ordering/index.html @@ -0,0 +1,266 @@ + + + + + + + + + Rule: member-ordering + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: member-ordering

+

+
+ + +

Enforces member ordering.

+ + + + +
Rationale
+

A consistent ordering for class members can make classes easier to read, navigate, and edit.

+ + + + + +

Config

+ +

One argument, which is an object, must be provided. It should contain an order property. +The order property should have a value of one of the following strings:

+ +
    +
  • fields-first
  • +
  • instance-sandwich
  • +
  • statics-first
  • +
+ +

Alternatively, the value for order maybe be an array consisting of the following strings:

+ +
    +
  • public-static-field
  • +
  • public-static-method
  • +
  • protected-static-field
  • +
  • protected-static-method
  • +
  • private-static-field
  • +
  • private-static-method
  • +
  • public-instance-field
  • +
  • protected-instance-field
  • +
  • private-instance-field
  • +
  • public-constructor
  • +
  • protected-constructor
  • +
  • private-constructor
  • +
  • public-instance-method
  • +
  • protected-instance-method
  • +
  • private-instance-method
  • +
+ +

You can also omit the access modifier to refer to “public-“, “protected-“, and “private-“ all at once; for example, “static-field”.

+ +

You can also make your own categories by using an object instead of a string:

+ +
{
+    "name": "static non-private",
+    "kinds": [
+        "public-static-field",
+        "protected-static-field",
+        "public-static-method",
+        "protected-static-method"
+    ]
+}
+
+ +

The ‘alphabetize’ option will enforce that members within the same category should be alphabetically sorted by name.

+ + +
Config examples
+ +
+"member-ordering": [true, {"order": "fields-first"}]
+
+ +
+"member-ordering": [
+  true,
+  {
+    "order": [
+      "public-static-field",
+      "public-instance-field",
+      "public-constructor",
+      "private-static-field",
+      "private-instance-field",
+      "private-constructor",
+      "public-instance-method",
+      "protected-instance-method",
+      "private-instance-method"
+    ]
+  }
+]
+
+ +
+"member-ordering": [
+  true,
+  {
+    "order": [
+      {
+        "name": "static non-private",
+        "kinds": [
+          "public-static-field",
+          "protected-static-field",
+          "public-static-method",
+          "protected-static-method"
+        ]
+      },
+      "constructor"
+    ]
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "order": {
+      "oneOf": [
+        {
+          "type": "string",
+          "enum": [
+            "fields-first",
+            "instance-sandwich",
+            "statics-first"
+          ]
+        },
+        {
+          "type": "array",
+          "items": {
+            "type": "string",
+            "enum": [
+              "public-static-field",
+              "public-static-method",
+              "protected-static-field",
+              "protected-static-method",
+              "private-static-field",
+              "private-static-method",
+              "public-instance-field",
+              "protected-instance-field",
+              "private-instance-field",
+              "public-constructor",
+              "protected-constructor",
+              "private-constructor",
+              "public-instance-method",
+              "protected-instance-method",
+              "private-instance-method"
+            ]
+          },
+          "maxLength": 13
+        }
+      ]
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/new-parens/index.html b/docs/_site/rules/new-parens/index.html new file mode 100644 index 00000000000..d35725f0c0e --- /dev/null +++ b/docs/_site/rules/new-parens/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: new-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: new-parens

+

+
+ + +

Requires parentheses when invoking a constructor via the new keyword.

+ + + + +
Rationale
+

Maintains stylistic consistency with other function calls.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"new-parens": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/newline-before-return/index.html b/docs/_site/rules/newline-before-return/index.html new file mode 100644 index 00000000000..32cda592847 --- /dev/null +++ b/docs/_site/rules/newline-before-return/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: newline-before-return + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: newline-before-return

+

+
+ + +

Enforces blank line before return when not the only line in the block.

+ + + + +
Rationale
+

Helps maintain a readable style in your codebase.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"newline-before-return": true
+
+ + +
Schema
+
+{}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/newline-per-chained-call/index.html b/docs/_site/rules/newline-per-chained-call/index.html new file mode 100644 index 00000000000..d01b1ed0ebd --- /dev/null +++ b/docs/_site/rules/newline-per-chained-call/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: newline-per-chained-call + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: newline-per-chained-call

+

+
+ + + +

Requires that chained method calls be broken apart onto separate lines.

+ + + + +
Rationale
+ +

This style helps to keep code ‘vertical’, avoiding the need for side-scrolling in IDEs or text editors.

+ + + + + +

Config

+

Not configurable

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-angle-bracket-type-assertion/index.html b/docs/_site/rules/no-angle-bracket-type-assertion/index.html new file mode 100644 index 00000000000..9d51974a0ce --- /dev/null +++ b/docs/_site/rules/no-angle-bracket-type-assertion/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-angle-bracket-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-angle-bracket-type-assertion

+

+
+ + +

Requires the use of as Type for type assertions instead of <Type>.

+ + + + +
Rationale
+ +

Both formats of type assertions have the same effect, but only as type assertions +work in .tsx files. This rule ensures that you have a consistent type assertion style +across your codebase.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-angle-bracket-type-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-any/index.html b/docs/_site/rules/no-any/index.html new file mode 100644 index 00000000000..83d82049eba --- /dev/null +++ b/docs/_site/rules/no-any/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-any + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-any

+

+
+ + +

Disallows usages of any as a type declaration.

+ + + + +
Rationale
+

Using any as a type declaration nullifies the compile-time benefits of the type system.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-any": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-arg/index.html b/docs/_site/rules/no-arg/index.html new file mode 100644 index 00000000000..6243eaa30c3 --- /dev/null +++ b/docs/_site/rules/no-arg/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-arg + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-arg

+

+
+ + +

Disallows use of arguments.callee.

+ + + + +
Rationale
+ +

Using arguments.callee makes various performance optimizations impossible. +See MDN +for more details on why to avoid arguments.callee.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-arg": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-bitwise/index.html b/docs/_site/rules/no-bitwise/index.html new file mode 100644 index 00000000000..27022219ed5 --- /dev/null +++ b/docs/_site/rules/no-bitwise/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: no-bitwise + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-bitwise

+

+
+ + +

Disallows bitwise operators.

+ + + +

Specifically, the following bitwise operators are banned: +&, &=, |, |=, +^, ^=, <<, <<=, +>>, >>=, >>>, >>>=, and ~. +This rule does not ban the use of & and | for intersection and union types.

+ + + + +
Rationale
+ +

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. +They also can be an indicator of overly clever code which decreases maintainability.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-bitwise": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-boolean-literal-compare/index.html b/docs/_site/rules/no-boolean-literal-compare/index.html new file mode 100644 index 00000000000..2e6c26a7fd0 --- /dev/null +++ b/docs/_site/rules/no-boolean-literal-compare/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-boolean-literal-compare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-boolean-literal-compare

+

+
+ + +

Warns on comparison to a boolean literal, as in x === true.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-boolean-literal-compare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-conditional-assignment/index.html b/docs/_site/rules/no-conditional-assignment/index.html new file mode 100644 index 00000000000..4e53b57141e --- /dev/null +++ b/docs/_site/rules/no-conditional-assignment/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-conditional-assignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-conditional-assignment

+

+
+ + +

Disallows any type of assignment in conditionals.

+ + +

This applies to do-while, for, if, and while statements and conditional (ternary) expressions.

+ + + + +
Rationale
+ +

Assignments in conditionals are often typos: +for example if (var1 = var2) instead of if (var1 == var2). +They also can be an indicator of overly clever code which decreases maintainability.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-conditional-assignment": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-consecutive-blank-lines/index.html b/docs/_site/rules/no-consecutive-blank-lines/index.html new file mode 100644 index 00000000000..2c1a526b122 --- /dev/null +++ b/docs/_site/rules/no-consecutive-blank-lines/index.html @@ -0,0 +1,159 @@ + + + + + + + + + Rule: no-consecutive-blank-lines + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-consecutive-blank-lines

+

+
+ + +

Disallows one or more blank lines in a row.

+ + + + +
Rationale
+

Helps maintain a readable style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

An optional number of maximum allowed sequential blanks can be specified. If no value +is provided, a default of 1 will be used.

+ + +
Config examples
+ +
+"no-consecutive-blank-lines": true
+
+ +
+"no-consecutive-blank-lines": [true, 2]
+
+ + +
Schema
+
+{
+  "type": "number",
+  "minimum": "1"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-console/index.html b/docs/_site/rules/no-console/index.html new file mode 100644 index 00000000000..d492a144d4f --- /dev/null +++ b/docs/_site/rules/no-console/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-console + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-console

+

+
+ + +

Bans the use of specified console methods.

+ + + + +
Rationale
+

In general, console methods aren’t appropriate for production code.

+ + + + + +

Config

+

A list of method names to ban. If no method names are provided, all console methods are banned.

+ + +
Config examples
+ +
+"no-console": [true, "log", "error"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-construct/index.html b/docs/_site/rules/no-construct/index.html new file mode 100644 index 00000000000..0a3bffd6d41 --- /dev/null +++ b/docs/_site/rules/no-construct/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-construct + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-construct

+

+
+ + +

Disallows access to the constructors of String, Number, and Boolean.

+ + +

Disallows constructor use such as new Number(foo) but does not disallow Number(foo).

+ + + + +
Rationale
+ +

There is little reason to use String, Number, or Boolean as constructors. +In almost all cases, the regular function-call version is more appropriate. +More details are available on StackOverflow.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-construct": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-debugger/index.html b/docs/_site/rules/no-debugger/index.html new file mode 100644 index 00000000000..d91a7c8195b --- /dev/null +++ b/docs/_site/rules/no-debugger/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-debugger + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-debugger

+

+
+ + +

Disallows debugger statements.

+ + + + +
Rationale
+

In general, debugger statements aren’t appropriate for production code.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-debugger": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-default-export/index.html b/docs/_site/rules/no-default-export/index.html new file mode 100644 index 00000000000..bd289c5e62e --- /dev/null +++ b/docs/_site/rules/no-default-export/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: no-default-export + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-default-export

+

+
+ + +

Disallows default exports in ES6-style modules.

+ + +

Use named exports instead.

+ + + + +
Rationale
+ +

Named imports/exports promote clarity. +In addition, current tooling differs on the correct way to handle default imports/exports. +Avoiding them all together can help avoid tooling bugs and conflicts.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-default-export": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-imports/index.html b/docs/_site/rules/no-duplicate-imports/index.html new file mode 100644 index 00000000000..3b843d0d02e --- /dev/null +++ b/docs/_site/rules/no-duplicate-imports/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-duplicate-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-imports

+

+
+ + + +

Disallows multiple import statements from the same module.

+ + + + +
Rationale
+ +

Using a single import statement per module will make the code clearer because you can see everything being imported +from that module on one line.

+ + + + + +

Config

+

Not configurable

+ + +
Config examples
+ +
+"no-duplicate-imports": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-super/index.html b/docs/_site/rules/no-duplicate-super/index.html new file mode 100644 index 00000000000..637a74d625e --- /dev/null +++ b/docs/_site/rules/no-duplicate-super/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-duplicate-super + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-super

+

+
+ + +

Warns if ‘super()’ appears twice in a constructor.

+ + + + +
Rationale
+

The second call to ‘super()’ will fail at runtime.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-duplicate-super": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-switch-case/index.html b/docs/_site/rules/no-duplicate-switch-case/index.html new file mode 100644 index 00000000000..1882ea04451 --- /dev/null +++ b/docs/_site/rules/no-duplicate-switch-case/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-duplicate-switch-case + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-switch-case

+

+
+ + +

Prevents duplicate cases in switch statements.

+ + + + + + + +

Config

+ + + +
Config examples
+ +
+"no-duplicate-switch-case": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-duplicate-variable/index.html b/docs/_site/rules/no-duplicate-variable/index.html new file mode 100644 index 00000000000..9c8c627124a --- /dev/null +++ b/docs/_site/rules/no-duplicate-variable/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-duplicate-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-duplicate-variable

+

+
+ + +

Disallows duplicate variable declarations in the same block scope.

+ + + +

This rule is only useful when using the var keyword - +the compiler will detect redeclarations of let and const variables.

+ + + + +
Rationale
+ +

A variable can be reassigned if necessary - +there’s no good reason to have a duplicate variable declaration.

+ + + + + +

Config

+

You can specify "check-parameters" to check for variables with the same name as a parameter.

+ + +
Config examples
+ +
+"no-duplicate-variable": true
+
+ +
+"no-duplicate-variable": [true, "check-parameters"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "check-parameters"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-dynamic-delete/index.html b/docs/_site/rules/no-dynamic-delete/index.html new file mode 100644 index 00000000000..3e7ac893867 --- /dev/null +++ b/docs/_site/rules/no-dynamic-delete/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: no-dynamic-delete + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-dynamic-delete

+

+
+ + +

Bans usage of the delete operator with computed key expressions.

+ + + + +
Rationale
+ +

Deleting dynamically computed keys is dangerous and not well optimized.

+ +

Also consider using a Map +or Set +if you’re storing collections of objects. +Using Objects can cause occasional edge case bugs, such as if a key is named “hasOwnProperty”.

+ + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-dynamic-delete": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-empty-interface/index.html b/docs/_site/rules/no-empty-interface/index.html new file mode 100644 index 00000000000..283c1caf315 --- /dev/null +++ b/docs/_site/rules/no-empty-interface/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-empty-interface + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-empty-interface

+

+
+ + +

Forbids empty interfaces.

+ + + + +
Rationale
+

An empty interface is equivalent to its supertype (or {}).

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-empty/index.html b/docs/_site/rules/no-empty/index.html new file mode 100644 index 00000000000..f2d4935079e --- /dev/null +++ b/docs/_site/rules/no-empty/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-empty + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-empty

+

+
+ + +

Disallows empty blocks.

+ + +

Blocks with a comment inside are not considered empty.

+ + + + +
Rationale
+

Empty blocks are often indicators of missing code.

+ + + + + +

Config

+ +

If allow-empty-catch is specified, then catch blocks are allowed to be empty.

+ + +
Config examples
+ +
+"no-empty": true
+
+ +
+"no-empty": [true, "allow-empty-catch"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-empty-catch"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-eval/index.html b/docs/_site/rules/no-eval/index.html new file mode 100644 index 00000000000..a061bb8633a --- /dev/null +++ b/docs/_site/rules/no-eval/index.html @@ -0,0 +1,144 @@ + + + + + + + + + Rule: no-eval + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-eval

+

+
+ + +

Disallows eval function invocations.

+ + + + +
Rationale
+ +

eval() is dangerous as it allows arbitrary code execution with full privileges. There are +alternatives +for most of the use cases for eval().

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-eval": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-floating-promises/index.html b/docs/_site/rules/no-floating-promises/index.html new file mode 100644 index 00000000000..a7aa472656d --- /dev/null +++ b/docs/_site/rules/no-floating-promises/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: no-floating-promises + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-floating-promises

+

+
+ + +

Promises returned by functions must be handled appropriately.

+ + +

Use no-unused-expression in addition to this rule to reveal even more floating promises.

+ + + + +
Rationale
+

Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.

+ + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

A list of ‘string’ names of any additional classes that should also be handled as Promises.

+ + + +
Config examples
+ +
+"no-floating-promises": true
+
+ +
+"no-floating-promises": [true, "JQueryPromise"]
+
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-for-in-array/index.html b/docs/_site/rules/no-for-in-array/index.html new file mode 100644 index 00000000000..d330bfea921 --- /dev/null +++ b/docs/_site/rules/no-for-in-array/index.html @@ -0,0 +1,161 @@ + + + + + + + + + Rule: no-for-in-array + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-for-in-array

+

+
+ + +

Disallows iterating over an array with a for-in loop.

+ + + +

A for-in loop (for (var k in o)) iterates over the properties of an Object.

+ +

While it is legal to use for-in loops with array types, it is not common. +for-in will iterate over the indices of the array as strings, omitting any “holes” in +the array.

+ +

More common is to use for-of, which iterates over the values of an array. +If you want to iterate over the indices, alternatives include:

+ +

array.forEach((value, index) => { … }); +for (const [index, value] of array.entries()) { … } +for (let i = 0; i < array.length; i++) { … }

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-for-in-array": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-implicit-dependencies/index.html b/docs/_site/rules/no-implicit-dependencies/index.html new file mode 100644 index 00000000000..3fb7e0d8a63 --- /dev/null +++ b/docs/_site/rules/no-implicit-dependencies/index.html @@ -0,0 +1,165 @@ + + + + + + + + + Rule: no-implicit-dependencies + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-implicit-dependencies

+

+
+ + +

Disallows importing modules that are not listed as dependency in the project’s package.json

+ + + +

Disallows importing transient dependencies and modules installed above your package’s root directory.

+ + + + + + + + +

Config

+ +

By default the rule looks at "dependencies" and "peerDependencies". +By adding the "dev" option the rule looks at "devDependencies" instead of "peerDependencies". +By adding the "optional" option the rule also looks at "optionalDependencies".

+ + + +
Config examples
+ +
+"no-implicit-dependencies": true
+
+ +
+"no-implicit-dependencies": [true, "dev"]
+
+ +
+"no-implicit-dependencies": [true, "optional"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "dev",
+      "optional"
+    ]
+  },
+  "minItems": 0,
+  "maxItems": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-import-side-effect/index.html b/docs/_site/rules/no-import-side-effect/index.html new file mode 100644 index 00000000000..9ccd1ea5bec --- /dev/null +++ b/docs/_site/rules/no-import-side-effect/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: no-import-side-effect + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-import-side-effect

+

+
+ + +

Avoid import statements with side-effect.

+ + + + +
Rationale
+

Imports with side effects may have behavior which is hard for static verification.

+ + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • ignore-module allows to specify a regex and ignore modules which it matches.
  • +
+ + +
Config examples
+ +
+"no-import-side-effect": true
+
+ +
+"no-import-side-effect": [true, {"ignore-module": "(\\.html|\\.css)$"}]
+
+ + +
Schema
+
+{
+  "items": {
+    "properties": {
+      "ignore-module": {
+        "type": "string"
+      }
+    },
+    "type": "object"
+  },
+  "maxLength": 1,
+  "minLength": 0,
+  "type": "array"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-inferrable-types/index.html b/docs/_site/rules/no-inferrable-types/index.html new file mode 100644 index 00000000000..31729be771b --- /dev/null +++ b/docs/_site/rules/no-inferrable-types/index.html @@ -0,0 +1,178 @@ + + + + + + + + + Rule: no-inferrable-types + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-inferrable-types

+

+
+ + +

Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.

+ + + + +
Rationale
+

Explicit types where they can be easily inferred by the compiler make code more verbose.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • ignore-params allows specifying an inferrable type annotation for function params. +This can be useful when combining with the typedef rule.
  • +
  • ignore-properties allows specifying an inferrable type annotation for class properties.
  • +
+ + +
Config examples
+ +
+"no-inferrable-types": true
+
+ +
+"no-inferrable-types": [true, "ignore-params"]
+
+ +
+"no-inferrable-types": [true, "ignore-params", "ignore-properties"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-params",
+      "ignore-properties"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-inferred-empty-object-type/index.html b/docs/_site/rules/no-inferred-empty-object-type/index.html new file mode 100644 index 00000000000..3d5fe55a4d8 --- /dev/null +++ b/docs/_site/rules/no-inferred-empty-object-type/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: no-inferred-empty-object-type + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-inferred-empty-object-type

+

+
+ + +

Disallow type inference of {} (empty object type) at function and constructor call sites

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-inferred-empty-object-type": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-internal-module/index.html b/docs/_site/rules/no-internal-module/index.html new file mode 100644 index 00000000000..d4ba5ba4467 --- /dev/null +++ b/docs/_site/rules/no-internal-module/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-internal-module + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-internal-module

+

+
+ + +

Disallows internal module

+ + + + +
Rationale
+

Using module leads to a confusion of concepts with external modules. Use the newer namespace keyword instead.

+ + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-internal-module": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-invalid-template-strings/index.html b/docs/_site/rules/no-invalid-template-strings/index.html new file mode 100644 index 00000000000..df9e1905b3f --- /dev/null +++ b/docs/_site/rules/no-invalid-template-strings/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-invalid-template-strings + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-invalid-template-strings

+

+
+ + +

Warns on use of ${ in non-template strings.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-invalid-template-strings": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-invalid-this/index.html b/docs/_site/rules/no-invalid-this/index.html new file mode 100644 index 00000000000..dec83b55801 --- /dev/null +++ b/docs/_site/rules/no-invalid-this/index.html @@ -0,0 +1,160 @@ + + + + + + + + + Rule: no-invalid-this + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-invalid-this

+

+
+ + +

Disallows using the this keyword outside of classes.

+ + + + +
Rationale
+

See the rule’s author’s rationale here.

+ + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • check-function-in-method disallows using the this keyword in functions within class methods.
  • +
+ + +
Config examples
+ +
+"no-invalid-this": true
+
+ +
+"no-invalid-this": [true, "check-function-in-method"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-function-in-method"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-irregular-whitespace/index.html b/docs/_site/rules/no-irregular-whitespace/index.html new file mode 100644 index 00000000000..148af75f96d --- /dev/null +++ b/docs/_site/rules/no-irregular-whitespace/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-irregular-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-irregular-whitespace

+

+
+ + +

Disallow irregular whitespace outside of strings and comments

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-irregular-whitespace": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-magic-numbers/index.html b/docs/_site/rules/no-magic-numbers/index.html new file mode 100644 index 00000000000..6320e02a021 --- /dev/null +++ b/docs/_site/rules/no-magic-numbers/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-magic-numbers + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-magic-numbers

+

+
+ + + +

Disallows the use constant number values outside of variable assignments. +When no list of allowed values is specified, -1, 0 and 1 are allowed by default.

+ + + + +
Rationale
+ +

Magic numbers should be avoided as they often lack documentation, forcing +them to be stored in variables gives them implicit documentation.

+ + + + + +

Config

+

A list of allowed numbers.

+ + +
Config examples
+ +
+"no-magic-numbers": true
+
+ +
+"no-magic-numbers": [true, 1, 2, 3]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "number"
+  },
+  "minLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-mergeable-namespace/index.html b/docs/_site/rules/no-mergeable-namespace/index.html new file mode 100644 index 00000000000..7261ea23cb3 --- /dev/null +++ b/docs/_site/rules/no-mergeable-namespace/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-mergeable-namespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-mergeable-namespace

+

+
+ + +

Disallows mergeable namespaces in the same file.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-mergeable-namespace": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-misused-new/index.html b/docs/_site/rules/no-misused-new/index.html new file mode 100644 index 00000000000..66b1dd18dcf --- /dev/null +++ b/docs/_site/rules/no-misused-new/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-misused-new + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-misused-new

+

+
+ + +

Warns on apparent attempts to define constructors for interfaces or new for classes.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-misused-new": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-namespace/index.html b/docs/_site/rules/no-namespace/index.html new file mode 100644 index 00000000000..a31424cc42a --- /dev/null +++ b/docs/_site/rules/no-namespace/index.html @@ -0,0 +1,174 @@ + + + + + + + + + Rule: no-namespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-namespace

+

+
+ + +

Disallows use of internal modules and namespaces.

+ + +

This rule still allows the use of declare module ... {}

+ + + + +
Rationale
+ +

ES6-style external modules are the standard way to modularize code. +Using module {} and namespace {} are outdated ways to organize TypeScript code.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • allow-declarations allows declare namespace ... {} to describe external APIs.
  • +
+ + +
Config examples
+ +
+"no-namespace": true
+
+ +
+"no-namespace": [true, "allow-declarations"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-declarations"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-non-null-assertion/index.html b/docs/_site/rules/no-non-null-assertion/index.html new file mode 100644 index 00000000000..38965c1b2d4 --- /dev/null +++ b/docs/_site/rules/no-non-null-assertion/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-non-null-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-non-null-assertion

+

+
+ + +

Disallows non-null assertions using the ! postfix operator.

+ + + + +
Rationale
+

Using non-null assertion cancels the benefits of the strict null checking mode.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-non-null-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-null-keyword/index.html b/docs/_site/rules/no-null-keyword/index.html new file mode 100644 index 00000000000..0f2bb6581f2 --- /dev/null +++ b/docs/_site/rules/no-null-keyword/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-null-keyword + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-null-keyword

+

+
+ + +

Disallows use of the null keyword literal.

+ + + + +
Rationale
+ +

Instead of having the dual concepts of null andundefined in a codebase, +this rule ensures that only undefined is used.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-null-keyword": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-object-literal-type-assertion/index.html b/docs/_site/rules/no-object-literal-type-assertion/index.html new file mode 100644 index 00000000000..47ebbb0f87d --- /dev/null +++ b/docs/_site/rules/no-object-literal-type-assertion/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-object-literal-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-object-literal-type-assertion

+

+
+ + + +

Forbids an object literal to appear in a type assertion expression. +Casting to any is still allowed.

+ + + + +
Rationale
+ +

Always prefer const x: T = { ... }; to const x = { ... } as T;. +The type assertion in the latter case is either unnecessary or hides an error. +The compiler will warn for excess properties with this syntax, but not missing required fields. +For example: const x: { foo: number } = {} will fail to compile, but +const x = {} as { foo: number } will succeed.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-object-literal-type-assertion": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-parameter-properties/index.html b/docs/_site/rules/no-parameter-properties/index.html new file mode 100644 index 00000000000..1e63a106a7c --- /dev/null +++ b/docs/_site/rules/no-parameter-properties/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-parameter-properties + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-parameter-properties

+

+
+ + +

Disallows parameter properties in class constructors.

+ + + + +
Rationale
+ +

Parameter properties can be confusing to those new to TS as they are less explicit +than other ways of declaring and initializing class members.

+ + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-parameter-properties": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-parameter-reassignment/index.html b/docs/_site/rules/no-parameter-reassignment/index.html new file mode 100644 index 00000000000..a5b844547ad --- /dev/null +++ b/docs/_site/rules/no-parameter-reassignment/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: no-parameter-reassignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-parameter-reassignment

+

+
+ + +

Disallows reassigning parameters.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-parameter-reassignment": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-redundant-jsdoc/index.html b/docs/_site/rules/no-redundant-jsdoc/index.html new file mode 100644 index 00000000000..a4988e8ba0e --- /dev/null +++ b/docs/_site/rules/no-redundant-jsdoc/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-redundant-jsdoc + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-redundant-jsdoc

+

+
+ + +

Forbids JSDoc which duplicates TypeScript functionality.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-redundant-jsdoc": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-reference-import/index.html b/docs/_site/rules/no-reference-import/index.html new file mode 100644 index 00000000000..0ac920697b5 --- /dev/null +++ b/docs/_site/rules/no-reference-import/index.html @@ -0,0 +1,142 @@ + + + + + + + + + Rule: no-reference-import + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-reference-import

+

+
+ + +

Don’t <reference types="foo" /> if you import foo anyway.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-reference/index.html b/docs/_site/rules/no-reference/index.html new file mode 100644 index 00000000000..6dadb22541b --- /dev/null +++ b/docs/_site/rules/no-reference/index.html @@ -0,0 +1,143 @@ + + + + + + + + + Rule: no-reference + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-reference

+

+
+ + +

Disallows /// <reference path=> imports (use ES6-style imports instead).

+ + + + +
Rationale
+ +

Using /// <reference path=> comments to load other files is outdated. +Use ES6-style imports to reference other files.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-reference": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-require-imports/index.html b/docs/_site/rules/no-require-imports/index.html new file mode 100644 index 00000000000..353eae206d2 --- /dev/null +++ b/docs/_site/rules/no-require-imports/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-require-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-require-imports

+

+
+ + +

Disallows invocation of require().

+ + + + +
Rationale
+

Prefer the newer ES6-style imports over require().

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-require-imports": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-return-await/index.html b/docs/_site/rules/no-return-await/index.html new file mode 100644 index 00000000000..07484172174 --- /dev/null +++ b/docs/_site/rules/no-return-await/index.html @@ -0,0 +1,153 @@ + + + + + + + + + Rule: no-return-await + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-return-await

+

+
+ + +

Disallows unnecessary return await.

+ + + + +
Rationale
+ +

An async function always wraps the return value in a Promise. +Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.

+ + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-return-await": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-shadowed-variable/index.html b/docs/_site/rules/no-shadowed-variable/index.html new file mode 100644 index 00000000000..b9b771ba95b --- /dev/null +++ b/docs/_site/rules/no-shadowed-variable/index.html @@ -0,0 +1,213 @@ + + + + + + + + + Rule: no-shadowed-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-shadowed-variable

+

+
+ + +

Disallows shadowing variable declarations.

+ + + + +
Rationale
+

Shadowing a variable masks access to it and obscures to what value an identifier actually refers.

+ + + + + +

Config

+ +

You can optionally pass an object to disable checking for certain kinds of declarations. +Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" +and "typeParameter". Just set the value to false for the check you want to disable. +All checks default to true, i.e. are enabled by default. +Note that you cannot disable variables and parameters.

+ +

The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their +temporal dead zone. When set to false parameters, classes, enums and variables declared +with let or const are not considered shadowed if the shadowing occurs within their +temporal dead zone.

+ +

The following example shows how the "temporalDeadZone" option changes the linting result:

+ +
function fn(value) {
+    if (value) {
+        const tmp = value; // no error on this line if "temporalDeadZone" is false
+        return tmp;
+    }
+    let tmp = undefined;
+    if (!value) {
+        const tmp = value; // this line always contains an error
+        return tmp;
+    }
+}
+
+ + + +
Config examples
+ +
+"no-shadowed-variable": true
+
+ +
+"no-shadowed-variable": [
+  true,
+  {
+    "class": true,
+    "enum": true,
+    "function": true,
+    "interface": false,
+    "namespace": true,
+    "typeAlias": false,
+    "typeParameter": false
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "class": {
+      "type": "boolean"
+    },
+    "enum": {
+      "type": "boolean"
+    },
+    "function": {
+      "type": "boolean"
+    },
+    "import": {
+      "type": "boolean"
+    },
+    "interface": {
+      "type": "boolean"
+    },
+    "namespace": {
+      "type": "boolean"
+    },
+    "typeAlias": {
+      "type": "boolean"
+    },
+    "typeParameter": {
+      "type": "boolean"
+    },
+    "temporalDeadZone": {
+      "type": "boolean"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-sparse-arrays/index.html b/docs/_site/rules/no-sparse-arrays/index.html new file mode 100644 index 00000000000..dee04a79850 --- /dev/null +++ b/docs/_site/rules/no-sparse-arrays/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: no-sparse-arrays + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-sparse-arrays

+

+
+ + +

Forbids array literals to contain missing elements.

+ + + + +
Rationale
+

Missing elements are probably an accidentally duplicated comma.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-sparse-arrays": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-string-literal/index.html b/docs/_site/rules/no-string-literal/index.html new file mode 100644 index 00000000000..44babe9fca7 --- /dev/null +++ b/docs/_site/rules/no-string-literal/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: no-string-literal + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-string-literal

+

+
+ + + +

Forbids unnecessary string literal property access. +Allows obj["prop-erty"] (can’t be a regular property access). +Disallows obj["property"] (should be obj.property).

+ + + + +
Rationale
+ +

If --noImplicitAny is turned off, +property access via a string literal will be ‘any’ if the property does not exist.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-string-literal": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-string-throw/index.html b/docs/_site/rules/no-string-throw/index.html new file mode 100644 index 00000000000..f01098bb394 --- /dev/null +++ b/docs/_site/rules/no-string-throw/index.html @@ -0,0 +1,142 @@ + + + + + + + + + Rule: no-string-throw + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-string-throw

+

+
+ + +

Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-submodule-imports/index.html b/docs/_site/rules/no-submodule-imports/index.html new file mode 100644 index 00000000000..be3f5182f1f --- /dev/null +++ b/docs/_site/rules/no-submodule-imports/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-submodule-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-submodule-imports

+

+
+ + + +

Disallows importing any submodule.

+ + + + +
Rationale
+ +

Submodules of some packages are treated as private APIs and the import +paths may change without deprecation periods. It’s best to stick with +top-level package exports.

+ + + + + +

Config

+

A list of whitelisted package or submodule names.

+ + +
Config examples
+ +
+"no-submodule-imports": true
+
+ +
+"no-submodule-imports": [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-switch-case-fall-through/index.html b/docs/_site/rules/no-switch-case-fall-through/index.html new file mode 100644 index 00000000000..cd6c370339a --- /dev/null +++ b/docs/_site/rules/no-switch-case-fall-through/index.html @@ -0,0 +1,166 @@ + + + + + + + + + Rule: no-switch-case-fall-through + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-switch-case-fall-through

+

+
+ + +

Disallows falling through case statements.

+ + + +

For example, the following is not allowed:

+ +
switch(foo) {
+    case 1:
+        someFunc(foo);
+    case 2:
+        someOtherFunc(foo);
+}
+
+ +

However, fall through is allowed when case statements are consecutive or +a magic /* falls through */ comment is present. The following is valid:

+ +
switch(foo) {
+    case 1:
+        someFunc(foo);
+        /* falls through */
+    case 2:
+    case 3:
+        someOtherFunc(foo);
+}
+
+ + + + +
Rationale
+

Fall though in switch statements is often unintentional and a bug.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-switch-case-fall-through": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-this-assignment/index.html b/docs/_site/rules/no-this-assignment/index.html new file mode 100644 index 00000000000..ab7ec59beca --- /dev/null +++ b/docs/_site/rules/no-this-assignment/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: no-this-assignment + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-this-assignment

+

+
+ + +

Disallows unnecessary references to this.

+ + + + +
Rationale
+

Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not manging scope well.

+ + + + + +

Config

+ +

Two options may be provided on an object:

+ +
    +
  • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
  • +
  • allowed-names may be specified as a list of regular expressions to match allowed variable names.
  • +
+ + +
Config examples
+ +
+"no-this-assignment": true
+
+ +
+"no-this-assignment": [true, {"allowed-names": ["^self$"], "allow-destructuring": true}]
+
+ + +
Schema
+
+{
+  "additionalProperties": false,
+  "properties": {
+    "allow-destructuring": {
+      "type": "boolean"
+    },
+    "allowed-names": {
+      "listType": "string",
+      "type": "list"
+    }
+  },
+  "type": "object"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-trailing-whitespace/index.html b/docs/_site/rules/no-trailing-whitespace/index.html new file mode 100644 index 00000000000..c99e817afa9 --- /dev/null +++ b/docs/_site/rules/no-trailing-whitespace/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: no-trailing-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-trailing-whitespace

+

+
+ + +

Disallows trailing whitespace at the end of a line.

+ + + + +
Rationale
+

Keeps version control diffs clean as it prevents accidental whitespace from being committed.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Possible settings are:

+ +
    +
  • "ignore-template-strings": Allows trailing whitespace in template strings.
  • +
  • "ignore-comments": Allows trailing whitespace in comments.
  • +
  • "ignore-jsdoc": Allows trailing whitespace only in JSDoc comments.
  • +
  • "ignore-blank-lines": Allows trailing whitespace on empty lines.
  • +
+ + +
Config examples
+ +
+"no-trailing-whitespace": true
+
+ +
+"no-trailing-whitespace": [true, "ignore-comments"]
+
+ +
+"no-trailing-whitespace": [true, "ignore-jsdoc"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-comments",
+      "ignore-jsdoc",
+      "ignore-template-strings",
+      "ignore-blank-lines"
+    ]
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unbound-method/index.html b/docs/_site/rules/no-unbound-method/index.html new file mode 100644 index 00000000000..679558ef442 --- /dev/null +++ b/docs/_site/rules/no-unbound-method/index.html @@ -0,0 +1,157 @@ + + + + + + + + + Rule: no-unbound-method + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unbound-method

+

+
+ + +

Warns when a method is used as outside of a method call.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

You may optionally pass “ignore-static” to ignore static methods.

+ + +
Config examples
+ +
+"no-unbound-method": true
+
+ +
+"no-unbound-method": [true, "ignore-static"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ignore-static"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html new file mode 100644 index 00000000000..2db62dbb7a7 --- /dev/null +++ b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html @@ -0,0 +1,139 @@ + + + + + + + + + Rule: no-unnecessary-callback-wrapper + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-callback-wrapper

+

+
+ + + +

Replaces x => f(x) with just f. +To catch more cases, enable only-arrow-functions and arrow-return-shorthand too.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-callback-wrapper": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-class/index.html b/docs/_site/rules/no-unnecessary-class/index.html new file mode 100644 index 00000000000..7bed761e88f --- /dev/null +++ b/docs/_site/rules/no-unnecessary-class/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: no-unnecessary-class + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-class

+

+
+ + + +

Disallows classes that are not strictly necessary.

+ + + + +
Rationale
+ +

Users who come from a Java-style OO language may wrap +their utility functions in an extra class, instead of +putting them at the top level.

+ + + + + +

Config

+ +

Three arguments may be optionally provided:

+ +
    +
  • "allow-constructor-only" ignores classes whose members are constructors.
  • +
  • "allow-empty-class" ignores class DemoClass {}.
  • +
  • "allow-static-only" ignores classes whose members are static.
  • +
+ + +
Config examples
+ +
+"no-unnecessary-class": true
+
+ +
+"no-unnecessary-class": ["allow-empty-class", "allow-constructor-only"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-initializer/index.html b/docs/_site/rules/no-unnecessary-initializer/index.html new file mode 100644 index 00000000000..dbd6e26171d --- /dev/null +++ b/docs/_site/rules/no-unnecessary-initializer/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: no-unnecessary-initializer + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-initializer

+

+
+ + +

Forbids a ‘var’/’let’ statement or destructuring initializer to be initialized to ‘undefined’.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-initializer": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-qualifier/index.html b/docs/_site/rules/no-unnecessary-qualifier/index.html new file mode 100644 index 00000000000..ca3aabac10f --- /dev/null +++ b/docs/_site/rules/no-unnecessary-qualifier/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-unnecessary-qualifier + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-qualifier

+

+
+ + +

Warns when a namespace qualifier (A.x) is unnecessary.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unnecessary-qualifier": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unnecessary-type-assertion/index.html b/docs/_site/rules/no-unnecessary-type-assertion/index.html new file mode 100644 index 00000000000..5a2a395a3d1 --- /dev/null +++ b/docs/_site/rules/no-unnecessary-type-assertion/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-unnecessary-type-assertion + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unnecessary-type-assertion

+

+
+ + +

Warns if a type assertion does not change the type of an expression.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+

A list of whitelisted assertion types to ignore

+ + +
Config examples
+ + +
Schema
+
+{
+  "type": "list",
+  "listType": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unsafe-any/index.html b/docs/_site/rules/no-unsafe-any/index.html new file mode 100644 index 00000000000..c134d81b2fa --- /dev/null +++ b/docs/_site/rules/no-unsafe-any/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: no-unsafe-any + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unsafe-any

+

+
+ + + +

Warns when using an expression of type ‘any’ in a dynamic way. +Uses are only allowed if they would work for {} | null | undefined. +Type casts and tests are allowed. +Expressions that work on all values (such as "" + x) are allowed.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unsafe-any": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unsafe-finally/index.html b/docs/_site/rules/no-unsafe-finally/index.html new file mode 100644 index 00000000000..239dd8b4d8d --- /dev/null +++ b/docs/_site/rules/no-unsafe-finally/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: no-unsafe-finally + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unsafe-finally

+

+
+ + + +

Disallows control flow statements, such as return, continue, +break and throws in finally blocks.

+ + + + + + + +
Rationale
+ +

When used inside finally blocks, control flow statements, +such as return, continue, break and throws +override any other control flow statements in the same try/catch scope. +This is confusing and unexpected behavior.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-unsafe-finally": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unused-expression/index.html b/docs/_site/rules/no-unused-expression/index.html new file mode 100644 index 00000000000..1fe05f0da72 --- /dev/null +++ b/docs/_site/rules/no-unused-expression/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: no-unused-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unused-expression

+

+
+ + +

Disallows unused expression statements.

+ + + +

Unused expressions are expression statements which are not assignments or function calls +(and thus usually no-ops).

+ + + + +
Rationale
+ +

Detects potential errors where an assignment or function call was intended.

+ + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform +method or function calls for side effects (e.g. e && e.preventDefault()).
  • +
  • allow-new allows ‘new’ expressions for side effects (e.g. new ModifyGlobalState();.
  • +
  • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
  • +
+ + +
Config examples
+ +
+"no-unused-expression": true
+
+ +
+"no-unused-expression": [true, "allow-fast-null-checks"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-fast-null-checks",
+      "allow-new",
+      "allow-tagged-template"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-unused-variable/index.html b/docs/_site/rules/no-unused-variable/index.html new file mode 100644 index 00000000000..eb2977a14a3 --- /dev/null +++ b/docs/_site/rules/no-unused-variable/index.html @@ -0,0 +1,197 @@ + + + + + + + + + Rule: no-unused-variable + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-unused-variable

+

+
+ + +

Disallows unused imports, variables, functions and + private class members. Similar to tsc’s –noUnusedParameters and –noUnusedLocals + options, but does not interrupt code compilation.

+ + + +

In addition to avoiding compilation errors, this rule may still be useful if you +wish to have tslint automatically remove unused imports, variables, functions, +and private class members, when using TSLint’s --fix option.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + + Requires Type Info + +
+ + +

Config

+ +

Three optional arguments may be optionally provided:

+ +
    +
  • "check-parameters" disallows unused function and constructor parameters. +
      +
    • NOTE: this option is experimental and does not work with classes + that use abstract method declarations, among other things.
    • +
    +
  • +
  • {"ignore-pattern": "pattern"} where pattern is a case-sensitive regexp. +Variable names and imports that match the pattern will be ignored.
  • +
+ + +
Config examples
+ +
+"no-unused-variable": true
+
+ +
+"no-unused-variable": [true, {"ignore-pattern": "^_"}]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "oneOf": [
+      {
+        "type": "string",
+        "enum": [
+          "check-parameters"
+        ]
+      },
+      {
+        "type": "object",
+        "properties": {
+          "ignore-pattern": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false
+      }
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 3
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-use-before-declare/index.html b/docs/_site/rules/no-use-before-declare/index.html new file mode 100644 index 00000000000..1513735112a --- /dev/null +++ b/docs/_site/rules/no-use-before-declare/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: no-use-before-declare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-use-before-declare

+

+
+ + +

Disallows usage of variables before their declaration.

+ + + +

This rule is primarily useful when using the var keyword since the compiler will +automatically detect if a block-scoped let and const variable is used before +declaration. Since most modern TypeScript doesn’t use var, this rule is generally +discouraged and is kept around for legacy purposes. It is slow to compute, is not +enabled in the built-in configuration presets, and should not be used to inform TSLint +design decisions.

+ + + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-use-before-declare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-var-keyword/index.html b/docs/_site/rules/no-var-keyword/index.html new file mode 100644 index 00000000000..554d8876240 --- /dev/null +++ b/docs/_site/rules/no-var-keyword/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: no-var-keyword + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-var-keyword

+

+
+ + +

Disallows usage of the var keyword.

+ + +

Use let or const instead.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-var-keyword": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-var-requires/index.html b/docs/_site/rules/no-var-requires/index.html new file mode 100644 index 00000000000..768c7655fe8 --- /dev/null +++ b/docs/_site/rules/no-var-requires/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: no-var-requires + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-var-requires

+

+
+ + +

Disallows the use of require statements except in import statements.

+ + + +

In other words, the use of forms such as var module = require("module") are banned. +Instead use ES6 style imports or import foo = require('foo') imports.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"no-var-requires": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/no-void-expression/index.html b/docs/_site/rules/no-void-expression/index.html new file mode 100644 index 00000000000..72eb363ba52 --- /dev/null +++ b/docs/_site/rules/no-void-expression/index.html @@ -0,0 +1,154 @@ + + + + + + + + + Rule: no-void-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: no-void-expression

+

+
+ + +

Requires expressions of type void to appear in statement position.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+ +

If ignore-arrow-function-shorthand is provided, () => returnsVoid() will be allowed. +Otherwise, it must be written as () => { returnsVoid(); }.

+ + +
Config examples
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-arrow-function-shorthand"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/number-literal-format/index.html b/docs/_site/rules/number-literal-format/index.html new file mode 100644 index 00000000000..451dc8d70cd --- /dev/null +++ b/docs/_site/rules/number-literal-format/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: number-literal-format + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: number-literal-format

+

+
+ + +

Checks that decimal literals should begin with ‘0.’ instead of just ‘.’, and should not end with a trailing ‘0’.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"number-literal-format": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-key-quotes/index.html b/docs/_site/rules/object-literal-key-quotes/index.html new file mode 100644 index 00000000000..114438125a4 --- /dev/null +++ b/docs/_site/rules/object-literal-key-quotes/index.html @@ -0,0 +1,189 @@ + + + + + + + + + Rule: object-literal-key-quotes + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-key-quotes

+

+
+ + +

Enforces consistent object literal property quote style.

+ + + +

Object literal property names can be defined in two ways: using literals or using strings. +For example, these two objects are equivalent:

+ +

var object1 = { + property: true +};

+ +

var object2 = { + “property”: true +};

+ +

In many cases, it doesn’t matter if you choose to use an identifier instead of a string +or vice-versa. Even so, you might decide to enforce a consistent style in your code.

+ +

This rules lets you enforce consistent quoting of property names. Either they should always +be quoted (default behavior) or quoted only as needed (“as-needed”).

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Possible settings are:

+ +
    +
  • "always": Property names should always be quoted. (This is the default.)
  • +
  • "as-needed": Only property names which require quotes may be quoted (e.g. those with spaces in them).
  • +
  • "consistent": Property names should either all be quoted or unquoted.
  • +
  • "consistent-as-needed": If any property name requires quotes, then all properties must be quoted. Otherwise, no +property names may be quoted.
  • +
+ +

For ES6, computed property names ({[name]: value}) and methods ({foo() {}}) never need +to be quoted.

+ + +
Config examples
+ +
+"object-literal-key-quotes": [true, "as-needed"]
+
+ +
+"object-literal-key-quotes": [true, "always"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always",
+    "as-needed",
+    "consistent",
+    "consistent-as-needed"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-shorthand/index.html b/docs/_site/rules/object-literal-shorthand/index.html new file mode 100644 index 00000000000..ba176698197 --- /dev/null +++ b/docs/_site/rules/object-literal-shorthand/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: object-literal-shorthand + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-shorthand

+

+
+ + +

Enforces/disallows use of ES6 object literal shorthand.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

If the ‘never’ option is provided, any shorthand object literal syntax will cause a failure.

+ + +
Config examples
+ +
+"object-literal-shorthand": true
+
+ +
+"object-literal-shorthand": [true, "never"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "never"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/object-literal-sort-keys/index.html b/docs/_site/rules/object-literal-sort-keys/index.html new file mode 100644 index 00000000000..dffa767b71e --- /dev/null +++ b/docs/_site/rules/object-literal-sort-keys/index.html @@ -0,0 +1,170 @@ + + + + + + + + + Rule: object-literal-sort-keys + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: object-literal-sort-keys

+

+
+ + + +

Checks ordering of keys in object literals.

+ +

When using the default alphabetical ordering, additional blank lines may be used to group +object properties together while keeping the elements within each group in alphabetical order.

+ + + + + +
Rationale
+

Useful in preventing merge conflicts

+ + + + + +

Config

+ +

By default, this rule checks that keys are in alphabetical order. +The following may optionally be passed:

+ +
    +
  • “ignore-case” will to compare keys in a case insensitive way.
  • +
  • +

    “match-declaration-order” will prefer to use the key ordering of the contextual type of the object literal, as in:

    + +

    interface I { foo: number; bar: number; } + const obj: I = { foo: 1, bar: 2 };

    +
  • +
+ +

If a contextual type is not found, alphabetical ordering will be used instead.

+ + +
Config examples
+ +
+"object-literal-sort-keys": true
+
+ +
+"object-literal-sort-keys": [true, "ignore-case", "match-declaration-order"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "ignore-case",
+    "match-declaration-order"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/one-line/index.html b/docs/_site/rules/one-line/index.html new file mode 100644 index 00000000000..24ef7fb4108 --- /dev/null +++ b/docs/_site/rules/one-line/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: one-line + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: one-line

+

+
+ + +

Requires the specified tokens to be on the same line as the expression preceding them.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • +
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • +
  • "check-else" checks that else is on the same line as the closing brace for if.
  • +
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • +
  • "check-whitespace" checks preceding whitespace for the specified tokens.
  • +
+ + +
Config examples
+ +
+"one-line": [true, "check-catch", "check-finally", "check-else"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-catch",
+      "check-finally",
+      "check-else",
+      "check-open-brace",
+      "check-whitespace"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/one-variable-per-declaration/index.html b/docs/_site/rules/one-variable-per-declaration/index.html new file mode 100644 index 00000000000..244bc7da596 --- /dev/null +++ b/docs/_site/rules/one-variable-per-declaration/index.html @@ -0,0 +1,156 @@ + + + + + + + + + Rule: one-variable-per-declaration + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: one-variable-per-declaration

+

+
+ + +

Disallows multiple variable definitions in the same declaration statement.

+ + + + + + + +

Config

+ +

One argument may be optionally provided:

+ +
    +
  • ignore-for-loop allows multiple variable definitions in a for loop declaration.
  • +
+ + +
Config examples
+ +
+"one-variable-per-declaration": true
+
+ +
+"one-variable-per-declaration": [true, "ignore-for-loop"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "ignore-for-loop"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/only-arrow-functions/index.html b/docs/_site/rules/only-arrow-functions/index.html new file mode 100644 index 00000000000..34f30022312 --- /dev/null +++ b/docs/_site/rules/only-arrow-functions/index.html @@ -0,0 +1,163 @@ + + + + + + + + + Rule: only-arrow-functions + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: only-arrow-functions

+

+
+ + +

Disallows traditional (non-arrow) function expressions.

+ + + + +
Rationale
+

Traditional functions don’t bind lexical scope, which can lead to unexpected behavior when accessing ‘this’.

+ + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • "allow-declarations" allows standalone function declarations.
  • +
  • "allow-named-functions" allows the expression function foo() {} but not function() {}.
  • +
+ + + +
Config examples
+ +
+"only-arrow-functions": true
+
+ +
+"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-declarations",
+      "allow-named-functions"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 1
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/ordered-imports/index.html b/docs/_site/rules/ordered-imports/index.html new file mode 100644 index 00000000000..2b0af21cb5e --- /dev/null +++ b/docs/_site/rules/ordered-imports/index.html @@ -0,0 +1,251 @@ + + + + + + + + + Rule: ordered-imports + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: ordered-imports

+

+
+ + +

Requires that import statements be alphabetized and grouped.

+ + + +

Enforce a consistent ordering for ES6 imports:

+
    +
  • Named imports must be alphabetized (i.e. “import {A, B, C} from “foo”;”) +
      +
    • The exact ordering can be controlled by the named-imports-order option.
    • +
    • “longName as name” imports are ordered by “longName”.
    • +
    +
  • +
  • Import sources must be alphabetized within groups, i.e.: + import * as foo from “a”; + import * as bar from “b”;
  • +
  • Groups of imports are delineated by blank lines. You can use these to group imports + however you like, e.g. by first- vs. third-party or thematically or can you can + enforce a grouping of third-party, parent directories and the current directory.
  • +
+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

You may set the "import-sources-order" option to control the ordering of source +imports (the "foo" in import {A, B, C} from "foo").

+ +

Possible values for "import-sources-order" are:

+ +
    +
  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • +
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • +
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • +
  • "any": Allow any order.
  • +
+ +

You may set the "grouped-imports" option to control the grouping of source +imports (the "foo" in import {A, B, C} from "foo").

+ +

Possible values for "grouped-imports" are:

+ +
    +
  • false: Do not enforce grouping. (This is the default.)
  • +
  • true: Group source imports by "bar", "../baz", "./foo".
  • +
+ +

You may set the "named-imports-order" option to control the ordering of named +imports (the {A, B, C} in import {A, B, C} from "foo").

+ +

Possible values for "named-imports-order" are:

+ +
    +
  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • +
  • "lowercase-first": Correct order is {b, A, C}.
  • +
  • "lowercase-last": Correct order is {A, C, b}.
  • +
  • "any": Allow any order.
  • +
+ +

You may set the "module-source-path" option to control the ordering of imports based full path +or just the module name

+ +

Possible values for "module-source-path" are:

+ +
    +
  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • +
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
  • +
+ + + +
Config examples
+ +
+"ordered-imports": true
+
+ +
+"ordered-imports": [
+  true,
+  {
+    "import-sources-order": "lowercase-last",
+    "named-imports-order": "lowercase-first"
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "grouped-imports": {
+      "type": "boolean"
+    },
+    "import-sources-order": {
+      "type": "string",
+      "enum": [
+        "case-insensitive",
+        "lowercase-first",
+        "lowercase-last",
+        "any"
+      ]
+    },
+    "named-imports-order": {
+      "type": "string",
+      "enum": [
+        "case-insensitive",
+        "lowercase-first",
+        "lowercase-last",
+        "any"
+      ]
+    },
+    "module-source-path": {
+      "type": "string",
+      "enum": [
+        "full",
+        "basename"
+      ]
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-conditional-expression/index.html b/docs/_site/rules/prefer-conditional-expression/index.html new file mode 100644 index 00000000000..0ceb1ab03d3 --- /dev/null +++ b/docs/_site/rules/prefer-conditional-expression/index.html @@ -0,0 +1,152 @@ + + + + + + + + + Rule: prefer-conditional-expression + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-conditional-expression

+

+
+ + + +

Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

+ + + + +
Rationale
+ +

This reduces duplication and can eliminate an unnecessary variable declaration.

+ + + + + +

Config

+

If check-else-if is specified, the rule also checks nested if-else-if statements.

+ + +
Config examples
+ +
+"prefer-conditional-expression": true
+
+ +
+"prefer-conditional-expression": [true, "check-else-if"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "check-else-if"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-const/index.html b/docs/_site/rules/prefer-const/index.html new file mode 100644 index 00000000000..a8bd2397065 --- /dev/null +++ b/docs/_site/rules/prefer-const/index.html @@ -0,0 +1,171 @@ + + + + + + + + + Rule: prefer-const + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-const

+

+
+ + +

Requires that variable declarations use const instead of let and var if possible.

+ + + +

If a variable is only assigned to once when it is declared, it should be declared using ‘const’

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

An optional object containing the property “destructuring” with two possible values:

+ +
    +
  • “any” (default) - If any variable in destructuring can be const, this rule warns for those variables.
  • +
  • “all” - Only warns if all variables in destructuring can be const.
  • +
+ + +
Config examples
+ +
+"prefer-const": true
+
+ +
+"prefer-const": [true, {"destructuring": "all"}]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "destructuring": {
+      "type": "string",
+      "enum": [
+        "all",
+        "any"
+      ]
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-for-of/index.html b/docs/_site/rules/prefer-for-of/index.html new file mode 100644 index 00000000000..50b0ab9dcad --- /dev/null +++ b/docs/_site/rules/prefer-for-of/index.html @@ -0,0 +1,141 @@ + + + + + + + + + Rule: prefer-for-of + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-for-of

+

+
+ + +

Recommends a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated.

+ + + + +
Rationale
+

A for(… of …) loop is easier to implement and read when the index is not needed.

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-for-of": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-function-over-method/index.html b/docs/_site/rules/prefer-function-over-method/index.html new file mode 100644 index 00000000000..5a7f2260e15 --- /dev/null +++ b/docs/_site/rules/prefer-function-over-method/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: prefer-function-over-method + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-function-over-method

+

+
+ + +

Warns for class methods that do not use ‘this’.

+ + + + + + + +

Config

+ +

“allow-public” excludes checking of public methods. +“allow-protected” excludes checking of protected methods.

+ + +
Config examples
+ +
+"prefer-function-over-method": true
+
+ +
+"prefer-function-over-method": [true, "allow-public", "allow-protected"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-public",
+    "allow-protected"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-method-signature/index.html b/docs/_site/rules/prefer-method-signature/index.html new file mode 100644 index 00000000000..5e19bbedb0c --- /dev/null +++ b/docs/_site/rules/prefer-method-signature/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: prefer-method-signature + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-method-signature

+

+
+ + +

Prefer foo(): void over foo: () => void in interfaces and types.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-method-signature": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-object-spread/index.html b/docs/_site/rules/prefer-object-spread/index.html new file mode 100644 index 00000000000..508b297c200 --- /dev/null +++ b/docs/_site/rules/prefer-object-spread/index.html @@ -0,0 +1,150 @@ + + + + + + + + + Rule: prefer-object-spread + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-object-spread

+

+
+ + +

Enforces the use of the ES2015 object spread operator over Object.assign() where appropriate.

+ + + + +
Rationale
+

Object spread allows for better type checking and inference.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"prefer-object-spread": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-readonly/index.html b/docs/_site/rules/prefer-readonly/index.html new file mode 100644 index 00000000000..b457aa3e537 --- /dev/null +++ b/docs/_site/rules/prefer-readonly/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: prefer-readonly + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-readonly

+

+
+ + +

Requires that private variables are marked as readonly if they’re never modified outside of the constructor.

+ + + +

If a private variable is only assigned to in the constructor, it should be declared as readonly.

+ + + + + +
Rationale
+ +

Marking never-modified variables as readonly helps enforce the code’s intent of keeping them as never-modified. +It can also help prevent accidental changes of members not meant to be changed.

+ + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

If only-inline-lambdas is specified, only immediately-declared arrow functions are checked.

+ + +
Config examples
+ +
+"prefer-readonly": true
+
+ +
+"prefer-readonly": [true, "only-inline-lambdas"]
+
+ + +
Schema
+
+{
+  "enum": [
+    "only-inline-lambdas"
+  ],
+  "type": "string"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-switch/index.html b/docs/_site/rules/prefer-switch/index.html new file mode 100644 index 00000000000..01260987a4b --- /dev/null +++ b/docs/_site/rules/prefer-switch/index.html @@ -0,0 +1,151 @@ + + + + + + + + + Rule: prefer-switch + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-switch

+

+
+ + +

Prefer a switch statement to an if statement with simple === comparisons.

+ + + + + + + +

Config

+ +

An optional object with the property ‘min-cases’. +This is the number cases needed before a switch statement is recommended. +Defaults to 3.

+ + +
Config examples
+ +
+"prefer-switch": true
+
+ +
+"prefer-switch": [true, {"min-cases": 2}]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "min-cases": {
+      "type": "number"
+    }
+  }
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/prefer-template/index.html b/docs/_site/rules/prefer-template/index.html new file mode 100644 index 00000000000..0b217edf748 --- /dev/null +++ b/docs/_site/rules/prefer-template/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: prefer-template + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: prefer-template

+

+
+ + +

Prefer a template expression over string literal concatenation.

+ + + + + + + +

Config

+ +

If allow-single-concat is specified, then a single concatenation (x + y) is allowed, but not more (x + y + z).

+ + +
Config examples
+ +
+"prefer-template": true
+
+ +
+"prefer-template": [true, "allow-single-concat"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "allow-single-concat"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/promise-function-async/index.html b/docs/_site/rules/promise-function-async/index.html new file mode 100644 index 00000000000..17910e28437 --- /dev/null +++ b/docs/_site/rules/promise-function-async/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: promise-function-async + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: promise-function-async

+

+
+ + +

Requires any function or method that returns a promise to be marked async.

+ + + + +
Rationale
+ +

Ensures that each function is only capable of 1) returning a rejected promise, or 2) +throwing an Error object. In contrast, non-async Promise-returning functions +are technically capable of either. This practice removes a requirement for consuming +code to handle both cases.

+ + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"promise-function-async": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/quotemark/index.html b/docs/_site/rules/quotemark/index.html new file mode 100644 index 00000000000..9eecc3cb306 --- /dev/null +++ b/docs/_site/rules/quotemark/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: quotemark + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: quotemark

+

+
+ + +

Requires single or double quotes for string literals.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "single" enforces single quotes.
  • +
  • "double" enforces double quotes.
  • +
  • "jsx-single" enforces single quotes for JSX attributes.
  • +
  • "jsx-double" enforces double quotes for JSX attributes.
  • +
  • "avoid-template" forbids single-line untagged template strings that do not contain string interpolations.
  • +
  • "avoid-escape" allows you to use the “other” quotemark in cases where escaping would normally be required. +For example, [true, "double", "avoid-escape"] would not report a failure on the string literal +'Hello "World"'.
  • +
+ + +
Config examples
+ +
+"quotemark": [true, "single", "avoid-escape", "avoid-template"]
+
+ +
+"quotemark": [true, "single", "jsx-double"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "single",
+      "double",
+      "jsx-single",
+      "jsx-double",
+      "avoid-escape",
+      "avoid-template"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/radix/index.html b/docs/_site/rules/radix/index.html new file mode 100644 index 00000000000..9a8ceca4e16 --- /dev/null +++ b/docs/_site/rules/radix/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: radix + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: radix

+

+
+ + +

Requires the radix parameter to be specified when calling parseInt.

+ + + + +
Rationale
+ +

From MDN:

+
+

Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. +Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

+
+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"radix": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/restrict-plus-operands/index.html b/docs/_site/rules/restrict-plus-operands/index.html new file mode 100644 index 00000000000..1275aa0163f --- /dev/null +++ b/docs/_site/rules/restrict-plus-operands/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: restrict-plus-operands + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: restrict-plus-operands

+

+
+ + +

When adding two variables, operands must both be of type number or of type string.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"restrict-plus-operands": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/return-undefined/index.html b/docs/_site/rules/return-undefined/index.html new file mode 100644 index 00000000000..283dff0140b --- /dev/null +++ b/docs/_site/rules/return-undefined/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: return-undefined + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: return-undefined

+

+
+ + +

Prefer return; in void functions and return undefined; in value-returning functions.

+ + + + + + +
Notes:
+
+ + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"return-undefined": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/semicolon/index.html b/docs/_site/rules/semicolon/index.html new file mode 100644 index 00000000000..5ee5bc6c5ce --- /dev/null +++ b/docs/_site/rules/semicolon/index.html @@ -0,0 +1,192 @@ + + + + + + + + + Rule: semicolon + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: semicolon

+

+
+ + +

Enforces consistent semicolon usage at the end of every statement.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One of the following arguments must be provided:

+ +
    +
  • "always" enforces semicolons at the end of every statement.
  • +
  • "never" disallows semicolons at the end of every statement except for when they are necessary.
  • +
+ +

The following arguments may be optionally provided:

+ +
    +
  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • +
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • +
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any +other assignment. This option overrides "ignore-bound-class-methods".
  • +
+ + + +
Config examples
+ +
+"semicolon": [true, "always"]
+
+ +
+"semicolon": [true, "never"]
+
+ +
+"semicolon": [true, "always", "ignore-interfaces"]
+
+ +
+"semicolon": [true, "always", "ignore-bound-class-methods"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "string",
+      "enum": [
+        "always",
+        "never"
+      ]
+    },
+    {
+      "type": "string",
+      "enum": [
+        "ignore-interfaces"
+      ]
+    }
+  ],
+  "additionalItems": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/space-before-function-paren/index.html b/docs/_site/rules/space-before-function-paren/index.html new file mode 100644 index 00000000000..1b86f637dd2 --- /dev/null +++ b/docs/_site/rules/space-before-function-paren/index.html @@ -0,0 +1,208 @@ + + + + + + + + + Rule: space-before-function-paren + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: space-before-function-paren

+

+
+ + +

Require or disallow a space before function parenthesis

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One argument which is an object which may contain the keys anonymous, named, and asyncArrow +These should be set to either "always" or "never".

+ +
    +
  • "anonymous" checks before the opening paren in anonymous functions
  • +
  • "named" checks before the opening paren in named functions
  • +
  • "asyncArrow" checks before the opening paren in async arrow functions
  • +
  • "method" checks before the opening paren in class methods
  • +
  • "constructor" checks before the opening paren in class constructors
  • +
+ + + +
Config examples
+ +
+"space-before-function-paren": true
+
+ +
+"space-before-function-paren": [true, "always"]
+
+ +
+"space-before-function-paren": [true, "never"]
+
+ +
+"space-before-function-paren": [true, {"anonymous": "always", "named": "never", "asyncArrow": "always"}]
+
+ + +
Schema
+
+{
+  "properties": {
+    "anonymous": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "asyncArrow": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "constructor": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "method": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    },
+    "named": {
+      "enum": [
+        "always",
+        "never"
+      ],
+      "type": "string"
+    }
+  },
+  "type": "object"
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/space-within-parens/index.html b/docs/_site/rules/space-within-parens/index.html new file mode 100644 index 00000000000..164b8dd93b5 --- /dev/null +++ b/docs/_site/rules/space-within-parens/index.html @@ -0,0 +1,147 @@ + + + + + + + + + Rule: space-within-parens + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: space-within-parens

+

+
+ + +

Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

You may enforce the amount of whitespace within parentheses.

+ + + +
Config examples
+ + +
Schema
+
+{
+  "type": "number",
+  "min": 0
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/strict-boolean-expressions/index.html b/docs/_site/rules/strict-boolean-expressions/index.html new file mode 100644 index 00000000000..b17f9c49c8e --- /dev/null +++ b/docs/_site/rules/strict-boolean-expressions/index.html @@ -0,0 +1,227 @@ + + + + + + + + + Rule: strict-boolean-expressions + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: strict-boolean-expressions

+

+
+ + + +

Restricts the types allowed in boolean expressions. By default only booleans are allowed.

+ +

The following nodes are checked:

+ +
    +
  • Arguments to the !, &&, and || operators
  • +
  • The condition in a conditional expression (cond ? x : y)
  • +
  • Conditions for if, for, while, and do-while statements.
  • +
+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+ +

These options may be provided:

+ +
    +
  • allow-null-union allows union types containing null. +
      +
    • It does not allow null itself.
    • +
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • +
    +
  • +
  • allow-undefined-union allows union types containing undefined. +
      +
    • It does not allow undefined itself.
    • +
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • +
    +
  • +
  • allow-string allows strings. +
      +
    • It does not allow unions containing string.
    • +
    • It does not allow string literal types.
    • +
    +
  • +
  • allow-number allows numbers. +
      +
    • It does not allow unions containing number.
    • +
    • It does not allow enums or number literal types.
    • +
    +
  • +
  • allow-mix allows multiple of the above to appear together. +
      +
    • For example, string | number or RegExp | null | undefined would normally not be allowed.
    • +
    • A type like "foo" | "bar" | undefined is always allowed, because it has only one way to be false.
    • +
    +
  • +
  • allow-boolean-or-undefined allows boolean | undefined. +
      +
    • Also allows true | false | undefined.
    • +
    • Does not allow false | undefined.
    • +
    • This option is a subset of allow-undefined-union, so you don’t need to enable both options at the same time.
    • +
    +
  • +
+ + + +
Config examples
+ +
+"strict-boolean-expressions": true
+
+ +
+"strict-boolean-expressions": [
+  true,
+  "allow-null-union",
+  "allow-undefined-union",
+  "allow-string",
+  "allow-number"
+]
+
+ +
+"strict-boolean-expressions": [true, "allow-boolean-or-undefined"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-null-union",
+      "allow-undefined-union",
+      "allow-string",
+      "allow-number",
+      "allow-boolean-or-undefined"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/strict-type-predicates/index.html b/docs/_site/rules/strict-type-predicates/index.html new file mode 100644 index 00000000000..90551c4f0ac --- /dev/null +++ b/docs/_site/rules/strict-type-predicates/index.html @@ -0,0 +1,155 @@ + + + + + + + + + Rule: strict-type-predicates + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: strict-type-predicates

+

+
+ + + +

Warns for type predicates that are always true or always false. +Works for ‘typeof’ comparisons to constants (e.g. ‘typeof foo === “string”’), and equality comparison to ‘null’/’undefined’. +(TypeScript won’t let you compare ‘1 === 2’, but it has an exception for ‘1 === undefined’.) +Does not yet work for ‘instanceof’. +Does not warn for ‘if (x.y)’ where ‘x.y’ is always truthy. For that, see strict-boolean-expressions.

+ +

This rule requires strictNullChecks to work properly.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"strict-type-predicates": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/switch-default/index.html b/docs/_site/rules/switch-default/index.html new file mode 100644 index 00000000000..9a259fcd44a --- /dev/null +++ b/docs/_site/rules/switch-default/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: switch-default + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: switch-default

+

+
+ + +

Require a default case in all switch statements.

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"switch-default": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/switch-final-break/index.html b/docs/_site/rules/switch-final-break/index.html new file mode 100644 index 00000000000..a3c7ec04bea --- /dev/null +++ b/docs/_site/rules/switch-final-break/index.html @@ -0,0 +1,149 @@ + + + + + + + + + Rule: switch-final-break + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: switch-final-break

+

+
+ + +

Checks whether the final clause of a switch statement ends in break;.

+ + + + + + + +

Config

+ +

If no options are passed, a final ‘break;’ is forbidden. +If the “always” option is passed this will require a ‘break;’ to always be present +unless control flow is escaped in some other way.

+ + +
Config examples
+ +
+"switch-final-break": true
+
+ +
+"switch-final-break": [true, "always"]
+
+ + +
Schema
+
+{
+  "type": "string",
+  "enum": [
+    "always"
+  ]
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/trailing-comma/index.html b/docs/_site/rules/trailing-comma/index.html new file mode 100644 index 00000000000..91ca73fee0e --- /dev/null +++ b/docs/_site/rules/trailing-comma/index.html @@ -0,0 +1,320 @@ + + + + + + + + + Rule: trailing-comma + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: trailing-comma

+

+
+ + + +

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, +named imports and exports and function parameters.

+ + + + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

One argument which is an object with the keys multiline and singleline. +Both can be set to a string ("always" or "never") or an object.

+ +

The object can contain any of the following keys: "arrays", "objects", "functions", +"imports", "exports", and "typeLiterals"; each key can have one of the following +values: "always", "never", and "ignore". Any missing keys will default to "ignore".

+ +
    +
  • "multiline" checks multi-line object literals.
  • +
  • "singleline" checks single-line object literals.
  • +
+ +

An array is considered “multiline” if its closing bracket is on a line +after the last array element. The same general logic is followed for +object literals, function typings, named import statements +and function parameters.

+ +

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, +there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on +object and array rest and rest parameters.

+ + + +
Config examples
+ +
+"trailing-comma": [true, {"multiline": "always", "singleline": "never"}]
+
+ +
+"trailing-comma": [
+  true,
+  {
+    "multiline": {
+      "objects": "always",
+      "arrays": "always",
+      "functions": "never",
+      "typeLiterals": "ignore"
+    },
+    "esSpecCompliant": true
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "object",
+  "properties": {
+    "multiline": {
+      "anyOf": [
+        {
+          "type": "string",
+          "enum": [
+            "always",
+            "never"
+          ]
+        },
+        {
+          "type": "object",
+          "properties": {
+            "arrays": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "exports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "functions": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "imports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "objects": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "typeLiterals": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            }
+          }
+        }
+      ]
+    },
+    "singleline": {
+      "anyOf": [
+        {
+          "type": "string",
+          "enum": [
+            "always",
+            "never"
+          ]
+        },
+        {
+          "type": "object",
+          "properties": {
+            "arrays": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "exports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "functions": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "imports": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "objects": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            },
+            "typeLiterals": {
+              "type": "string",
+              "enum": [
+                "always",
+                "never",
+                "ignore"
+              ]
+            }
+          }
+        }
+      ]
+    },
+    "esSpecCompliant": {
+      "type": "boolean"
+    }
+  },
+  "additionalProperties": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/triple-equals/index.html b/docs/_site/rules/triple-equals/index.html new file mode 100644 index 00000000000..e1a52692712 --- /dev/null +++ b/docs/_site/rules/triple-equals/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Rule: triple-equals + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: triple-equals

+

+
+ + +

Requires === and !== in place of == and !=.

+ + + + + + + +

Config

+ +

Two arguments may be optionally provided:

+ +
    +
  • "allow-null-check" allows == and != when comparing to null.
  • +
  • "allow-undefined-check" allows == and != when comparing to undefined.
  • +
+ + +
Config examples
+ +
+"triple-equals": true
+
+ +
+"triple-equals": [true, "allow-null-check"]
+
+ +
+"triple-equals": [true, "allow-undefined-check"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "allow-null-check",
+      "allow-undefined-check"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 2
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/type-literal-delimiter/index.html b/docs/_site/rules/type-literal-delimiter/index.html new file mode 100644 index 00000000000..cc11e78c589 --- /dev/null +++ b/docs/_site/rules/type-literal-delimiter/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: type-literal-delimiter + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: type-literal-delimiter

+

+
+ + + +

Checks that type literal members are separated by semicolons. +Enforces a trailing semicolon for multiline type literals.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"type-literal-delimiter": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typedef-whitespace/index.html b/docs/_site/rules/typedef-whitespace/index.html new file mode 100644 index 00000000000..9577ca446ee --- /dev/null +++ b/docs/_site/rules/typedef-whitespace/index.html @@ -0,0 +1,277 @@ + + + + + + + + + Rule: typedef-whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typedef-whitespace

+

+
+ + +

Requires or disallows whitespace for type definitions.

+ + +

Determines if a space is required or not before the colon in a type specifier.

+ + + + + + +
Notes:
+
+ + TS Only + + + Has Fixer + + +
+ + +

Config

+ +

Two arguments which are both objects. +The first argument specifies how much space should be to the left of a typedef colon. +The second argument specifies how much space should be to the right of a typedef colon. +Each key should have a value of "onespace", "space" or "nospace". +Possible keys are:

+ +
    +
  • "call-signature" checks return type of functions.
  • +
  • "index-signature" checks index type specifier of indexers.
  • +
  • "parameter" checks function parameters.
  • +
  • "property-declaration" checks object property declarations.
  • +
  • "variable-declaration" checks variable declaration.
  • +
+ + +
Config examples
+ +
+"typedef-whitespace": [
+  true,
+  {
+    "call-signature": "nospace",
+    "index-signature": "nospace",
+    "parameter": "nospace",
+    "property-declaration": "nospace",
+    "variable-declaration": "nospace"
+  },
+  {
+    "call-signature": "onespace",
+    "index-signature": "onespace",
+    "parameter": "onespace",
+    "property-declaration": "onespace",
+    "variable-declaration": "onespace"
+  }
+]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": [
+    {
+      "type": "object",
+      "properties": {
+        "call-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "index-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "parameter": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "property-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "variable-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        }
+      },
+      "additionalProperties": false
+    },
+    {
+      "type": "object",
+      "properties": {
+        "call-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "index-signature": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "parameter": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "property-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        },
+        "variable-declaration": {
+          "type": "string",
+          "enum": [
+            "nospace",
+            "onespace",
+            "space"
+          ]
+        }
+      },
+      "additionalProperties": false
+    }
+  ],
+  "additionalItems": false
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typedef/index.html b/docs/_site/rules/typedef/index.html new file mode 100644 index 00000000000..db818114025 --- /dev/null +++ b/docs/_site/rules/typedef/index.html @@ -0,0 +1,177 @@ + + + + + + + + + Rule: typedef + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typedef

+

+
+ + +

Requires type definitions to exist.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+ +

Several arguments may be optionally provided:

+ +
    +
  • "call-signature" checks return type of functions.
  • +
  • "arrow-call-signature" checks return type of arrow functions.
  • +
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • +
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • +
  • "property-declaration" checks return types of interface properties.
  • +
  • "variable-declaration" checks non-binding variable declarations.
  • +
  • "member-variable-declaration" checks member variable declarations.
  • +
  • "object-destructuring" checks object destructuring declarations.
  • +
  • "array-destructuring" checks array destructuring declarations.
  • +
+ + +
Config examples
+ +
+"typedef": [true, "call-signature", "parameter", "member-variable-declaration"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "call-signature",
+      "arrow-call-signature",
+      "parameter",
+      "arrow-parameter",
+      "property-declaration",
+      "variable-declaration",
+      "member-variable-declaration",
+      "object-destructuring",
+      "array-destructuring"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 7
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/typeof-compare/index.html b/docs/_site/rules/typeof-compare/index.html new file mode 100644 index 00000000000..8bf29aeea38 --- /dev/null +++ b/docs/_site/rules/typeof-compare/index.html @@ -0,0 +1,137 @@ + + + + + + + + + Rule: typeof-compare + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: typeof-compare

+

+
+ + +

Makes sure result of typeof is compared to correct string values

+ + + + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"typeof-compare": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/unified-signatures/index.html b/docs/_site/rules/unified-signatures/index.html new file mode 100644 index 00000000000..35d5c431165 --- /dev/null +++ b/docs/_site/rules/unified-signatures/index.html @@ -0,0 +1,146 @@ + + + + + + + + + Rule: unified-signatures + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: unified-signatures

+

+
+ + +

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

+ + + + + + +
Notes:
+
+ + TS Only + + + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"unified-signatures": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/use-default-type-parameter/index.html b/docs/_site/rules/use-default-type-parameter/index.html new file mode 100644 index 00000000000..00af31cac99 --- /dev/null +++ b/docs/_site/rules/use-default-type-parameter/index.html @@ -0,0 +1,148 @@ + + + + + + + + + Rule: use-default-type-parameter + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: use-default-type-parameter

+

+
+ + +

Warns if an explicitly specified type argument is the default for that type parameter.

+ + + + + + +
Notes:
+
+ + TS Only + + + + Requires Type Info + +
+ + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"use-default-type-parameter": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/use-isnan/index.html b/docs/_site/rules/use-isnan/index.html new file mode 100644 index 00000000000..a857b2254da --- /dev/null +++ b/docs/_site/rules/use-isnan/index.html @@ -0,0 +1,143 @@ + + + + + + + + + Rule: use-isnan + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: use-isnan

+

+
+ + +

Enforces use of the isNaN() function to check for NaN references instead of a comparison to the NaN constant.

+ + + + +
Rationale
+ +

Since NaN !== NaN, comparisons with regular operators will produce unexpected results. +So, instead of if (myVar === NaN), do if (isNaN(myVar)).

+ + + + + +

Config

+

Not configurable.

+ + +
Config examples
+ +
+"use-isnan": true
+
+ + +
Schema
+
+null
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/variable-name/index.html b/docs/_site/rules/variable-name/index.html new file mode 100644 index 00000000000..591b3432fce --- /dev/null +++ b/docs/_site/rules/variable-name/index.html @@ -0,0 +1,169 @@ + + + + + + + + + Rule: variable-name + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: variable-name

+

+
+ + +

Checks variable names for various errors.

+ + + + + + + +

Config

+ +

Five arguments may be optionally provided:

+ +
    +
  • "check-format": allows only lowerCamelCased or UPPER_CASED variable names +
      +
    • "allow-leading-underscore" allows underscores at the beginning (only has an effect if “check-format” specified)
    • +
    • "allow-trailing-underscore" allows underscores at the end. (only has an effect if “check-format” specified)
    • +
    • "allow-pascal-case" allows PascalCase in addition to lowerCamelCase.
    • +
    • "allow-snake-case" allows snake_case in addition to lowerCamelCase.
    • +
    +
  • +
  • "ban-keywords": disallows the use of certain TypeScript keywords as variable or parameter names. +
      +
    • These are: any, Number, number, String, string, Boolean, boolean, Undefined, undefined
    • +
    +
  • +
+ + +
Config examples
+ +
+"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-format",
+      "allow-leading-underscore",
+      "allow-trailing-underscore",
+      "allow-pascal-case",
+      "allow-snake-case",
+      "ban-keywords"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 5
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/rules/whitespace/index.html b/docs/_site/rules/whitespace/index.html new file mode 100644 index 00000000000..39b41928e7e --- /dev/null +++ b/docs/_site/rules/whitespace/index.html @@ -0,0 +1,183 @@ + + + + + + + + + Rule: whitespace + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Rule: whitespace

+

+
+ + +

Enforces whitespace style conventions.

+ + + + +
Rationale
+

Helps maintain a readable, consistent style in your codebase.

+ + + + +
Notes:
+
+ + + Has Fixer + + +
+ + +

Config

+ +

Ten arguments may be optionally provided:

+ +
    +
  • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
  • +
  • "check-decl"checks that variable declarations have whitespace around the equals token.
  • +
  • "check-operator" checks for whitespace around operator tokens.
  • +
  • "check-module" checks for whitespace in import & export statements.
  • +
  • "check-separator" checks for whitespace after separator tokens (,/;).
  • +
  • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
  • +
  • "check-type" checks for whitespace before a variable type specification.
  • +
  • "check-typecast" checks for whitespace between a typecast and its target.
  • +
  • "check-type-operator" checks for whitespace between type operators | and &.
  • +
  • "check-preblock" checks for whitespace before the opening brace of a block
  • +
+ + +
Config examples
+ +
+"whitespace": [true, "check-branch", "check-operator", "check-typecast"]
+
+ + +
Schema
+
+{
+  "type": "array",
+  "items": {
+    "type": "string",
+    "enum": [
+      "check-branch",
+      "check-decl",
+      "check-operator",
+      "check-module",
+      "check-separator",
+      "check-rest-spread",
+      "check-type",
+      "check-typecast",
+      "check-type-operator",
+      "check-preblock"
+    ]
+  },
+  "minLength": 0,
+  "maxLength": 10
+}
+
+ + + +
+
+ + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/cli/index.html b/docs/_site/usage/cli/index.html new file mode 100644 index 00000000000..770702a244e --- /dev/null +++ b/docs/_site/usage/cli/index.html @@ -0,0 +1,290 @@ + + + + + + + + + TSLint command-line interface + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint command-line interface

+

+
+ + +

Installation

+ +

Local (in your project’s working directory):

+ +
npm install tslint typescript --save-dev
+# or
+yarn add tslint typescript --dev
+
+ +

Global:

+ +
npm install tslint typescript -g
+# or
+yarn global add tslint typescript
+
+ +
Peer dependencies
+ +

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. +This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

+ +

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

+ +

CLI Usage

+ +

Please ensure that the TypeScript source files compile correctly before running the linter.

+ +

Usage: tslint [options] [file ...]

+ +

Options:

+ +
-v, --version                          output the version number
+-c, --config [config]                  configuration file
+-e, --exclude <exclude>                exclude globs from path expansion
+--fix                                  fixes linting errors for select rules (this may overwrite linted files)
+--force                                return status code 0 even if there are lint errors
+-i, --init                             generate a tslint.json config file in the current working directory
+-o, --out [out]                        output file
+--outputAbsolutePaths                  whether or not outputted file paths are absolute
+-r, --rules-dir [rules-dir]            rules directory
+-s, --formatters-dir [formatters-dir]  formatters directory
+-t, --format [format]                  output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)
+--test                                 test that tslint produces the correct output for the specified directory
+-p, --project [project]                tsconfig.json file
+--type-check                           (deprecated) check for type errors before linting the project
+-h, --help                             output usage information
+
+ +

By default, TSLint looks for a configuration file named tslint.json in the directory +of the file being linted and, if not found, searches ancestor directories. Check out the rules section for more details on what rules are available.

+ +

tslint accepts the following command-line options:

+ +
-c, --config:
+    The location of the configuration file that tslint will use to
+    determine which rules are activated and what options to provide
+    to the rules. If no option is specified, the config file named
+    tslint.json is used, so long as it exists in the path.
+    The format of the file is { rules: { /* rules list */ } },
+    where /* rules list */ is a key: value comma-separated list of
+    rulename: rule-options pairs. Rule-options can be either a
+    boolean true/false value denoting whether the rule is used or not,
+    or a list [boolean, ...] where the boolean provides the same role
+    as in the non-list case, and the rest of the list are options passed
+    to the rule that will determine what it checks for (such as number
+    of characters for the max-line-length rule, or what functions to ban
+    for the ban rule).
+
+-e, --exclude:
+    A filename or glob which indicates files to exclude from linting.
+    This option can be supplied multiple times if you need multiple
+    globs to indicate which files to exclude.
+
+--fix:
+    Fixes linting errors for select rules. This may overwrite linted files.
+
+--force:
+    Return status code 0 even if there are any lint errors.
+    Useful while running as npm script.
+
+-i, --init:
+    Generates a tslint.json config file in the current working directory.
+
+-o, --out:
+    A filename to output the results to. By default, tslint outputs to
+    stdout, which is usually the console where you're running it from.
+
+--outputAbsolutePaths:
+    If true, all paths in the output will be absolute.
+
+-r, --rules-dir:
+    An additional rules directory, for user-created rules.
+    tslint will always check its default rules directory, in
+    node_modules/tslint/lib/rules, before checking the user-provided
+    rules directory, so rules in the user-provided rules directory
+    with the same name as the base rules will not be loaded.
+
+-s, --formatters-dir:
+    An additional formatters directory, for user-created formatters.
+    Formatters are files that will format the tslint output, before
+    writing it to stdout or the file passed in --out. The default
+    directory, node_modules/tslint/build/formatters, will always be
+    checked first, so user-created formatters with the same names
+    as the base formatters will not be loaded.
+
+-t, --format:
+    The formatter to use to format the results of the linter before
+    outputting it to stdout or the file passed in --out. The core
+    formatters are prose (human readable), json (machine readable)
+    and verbose. prose is the default if this option is not used.
+    Other built-in options include pmd, msbuild, checkstyle, and vso.
+    Additional formatters can be added and used if the --formatters-dir
+    option is set.
+
+--test:
+    Runs tslint on matched directories and checks if tslint outputs
+    match the expected output in .lint files. Automatically loads the
+    tslint.json files in the directories as the configuration file for
+    the tests. See the full tslint documentation for more details on how
+    this can be used to test custom rules.
+
+-p, --project:
+    The path or directory containing a tsconfig.json file that will be
+    used to determine which files will be linted. This flag also enables
+    rules that require the type checker.
+
+--type-check:
+    (deprecated) Checks for type errors before linting a project.
+    --project must be specified in order to enable type checking.
+
+-v, --version:
+    The current version of tslint.
+
+-h, --help:
+    Prints this help message.
+
+ +

Exit Codes

+ +

The CLI process may exit with the following codes:

+ +
    +
  • 0: Linting succeeded without errors (warnings may have occurred)
  • +
  • 1: An invalid command line argument or combination thereof was used
  • +
  • 2: Linting failed with one or more rule violations with severity error
  • +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/configuration/index.html b/docs/_site/usage/configuration/index.html new file mode 100644 index 00000000000..8396f37921a --- /dev/null +++ b/docs/_site/usage/configuration/index.html @@ -0,0 +1,273 @@ + + + + + + + + + Configuring TSLint + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Configuring TSLint

+

+
+ + +

TSLint Configuration

+ +

When using the CLI or many third-party tools, a file named tslint.json or tslint.yaml is used to +configure which rules get run and each of their options.

+ +

tslint.json or tslint.yaml files can have the following fields specified:

+ +
    +
  • extends?: string | string[]: +The name of a built-in configuration preset (see built-in presets below), or a path or +array of paths to other configuration files which are extended by this configuration. +This value is handled using node module resolution semantics. +For example, a value of "tslint-config" would tell TSLint to try and load the main file of a module +named “tslint-config” as a configuration file. Specific files inside node modules can also be +specified, eg. "tslint-config/path/to/submodule". Relative paths to JSON files or JS modules +are also supported, e.g. "./tslint-config".
  • +
  • rulesDirectory?: string | string[]: +A path to a directory or an array of paths to directories of custom rules. These values are handled using node module resolution semantics, if an index.js is placed in your rules directory. We fallback to use relative or absolute paths, if the module can’t be resolved. If you want to avoid module resolution you can directly use a relative or absolute path (e.g. with ./).
  • +
  • rules?: { [name: string]: RuleSetting }: A map of rule names to their configuration settings. +
      +
    • These rules are applied to .ts and .tsx files.
    • +
    • Each rule is associated with an object containing: +
        +
      • options?: any: An array of values that are specific to a rule.
      • +
      • severity?: "default" | "error" | "warning" | "off": Severity level. Level “error” will cause exit code 2.
      • +
      +
    • +
    • A boolean value may be specified instead of the above object, and is equivalent to setting no options with default severity.
    • +
    • Any rules specified in this block will override those configured in any base configuration being extended.
    • +
    • Check out the full rules list here.
    • +
    +
  • +
  • jsRules?: any: Same format as rules. These rules are applied to .js and .jsx files.
  • +
  • defaultSeverity?: "error" | "warning" | "off": The severity level used when a rule specifies a default warning level. If undefined, “error” is used. This value is not inherited and is only applied to rules in this file.
  • +
  • linterOptions?: { exclude?: string[] }: +
      +
    • exclude: string[]: An array of globs. Any file matching these globs will not be linted. All exclude patterns are relative to the configuration file they were specified in.
    • +
    +
  • +
+ +

tslint.json configuration files may have JavaScript-style // single-line and /* multi-line */ comments in them (even though this is technically invalid JSON). If this confuses your syntax highlighter, you may want to switch it to JavaScript format.

+ +

An example tslint.json file might look like this:

+ +
{
+    "extends": "tslint:recommended",
+    "rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"],
+    "rules": {
+        "max-line-length": {
+            "options": [120]
+        },
+        "new-parens": true,
+        "no-arg": true,
+        "no-bitwise": true,
+        "no-conditional-assignment": true,
+        "no-consecutive-blank-lines": false,
+        "no-console": {
+            "severity": "warning",
+            "options": [
+                "debug",
+                "info",
+                "log",
+                "time",
+                "timeEnd",
+                "trace",
+            ]
+        }
+    },
+    "jsRules": {
+        "max-line-length": {
+            "options": [120]
+        }
+    }
+}
+
+ +

The corresponding YAML file looks like this:

+ +
---
+extends: "tslint:recommended"
+rulesDirectory:
+    - path/to/custom/rules/directory/
+    - another/path/
+rules:
+    max-line-length:
+        options: [120]
+    new-parens: true
+    no-arg: true
+    no-bitwise: true
+    no-conditional-assignment: true
+    no-consecutive-blank-lines: false
+    no-console:
+        severity: warning
+        options:
+            - debug
+            - info
+            - log
+            - time
+            - timeEnd
+            - trace
+jsRules:
+    max-line-length:
+        options: [120]
+...
+
+ +

Rule severity

+ +

The severity level of each rule can can be configured to default, error, warning/warn, or off/none. If no severity level is specified, default is used. The defaultSeverity top-level option replaces the severity level for each rule that uses severity level default in the current file. Valid values for defaultSeverity include error, warning/warn, and off/none.

+ +

Configuration presets

+ +

TSLint ships with a handful of built-in configurations presets. You may inspect their source here.

+ +

tslint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will not have breaking changes across minor or patch releases.

+ +

tslint:latest extends tslint:recommended and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, tslint:recommended will be updated to be identical to tslint:latest.

+ +

tslint:all turns on all rules to their strictest settings. This will use type checking, so it must be combined with the --project option. +(Exceptions include rules such as "ban", "import-blacklist", and "file-header", which have no sensible defaults, and deprecated rules.)

+ +

Custom rules

+ +

If TSLint’s core rules don’t have all the lint checks you’re looking for, +you may write your own custom rules or use custom rules that others have developed.

+ +

Some commonly used custom rule packages in the TSLint community are listed in the +README.

+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/library/index.html b/docs/_site/usage/library/index.html new file mode 100644 index 00000000000..b34cb6228f6 --- /dev/null +++ b/docs/_site/usage/library/index.html @@ -0,0 +1,205 @@ + + + + + + + + + Using TSLint as a Node.js library + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Using TSLint as a Node.js library

+

+
+ + +

Installation

+ +
npm install tslint typescript
+# or
+yarn add tslint typescript
+
+ +
Peer dependencies
+ +

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. +This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

+ +

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

+ +

Library usage

+ +

Please ensure that the TypeScript source files compile correctly before running the linter.

+ +

TypeScript

+ +

This code will need to be transpiled to JavaScript to run under Node.js.

+ +
import { Linter, Configuration } from "tslint";
+import * as fs from "fs";
+
+const fileName = "Specify input file name";
+const configurationFilename = "Specify configuration file name";
+const options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+
+const fileContents = fs.readFileSync(fileName, "utf8");
+const linter = new Linter(options);
+const configuration = Configuration.findConfiguration(configurationFilename, fileName).results;
+linter.lint(fileName, fileContents, configuration);
+const result = linter.getResult();
+
+ +

JavaScript (ES5)

+ +

This code will run directly under Node.js, including if it’s called from the command line.

+ +
"use strict";
+var tslint = require("tslint");
+var fs = require("fs");
+var fileName = "Specify input file name";
+var configurationFilename = "Specify configuration file name";
+var options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+var fileContents = fs.readFileSync(fileName, "utf8");
+var linter = new tslint.Linter(options);
+var configuration = tslint.Configuration.findConfiguration(configurationFilename, fileName).results;
+linter.lint(fileName, fileContents, configuration);
+var result = linter.getResult();
+
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/rule-flags/index.html b/docs/_site/usage/rule-flags/index.html new file mode 100644 index 00000000000..68c2da9dd46 --- /dev/null +++ b/docs/_site/usage/rule-flags/index.html @@ -0,0 +1,185 @@ + + + + + + + + + TSLint rule flags + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

TSLint rule flags

+

+
+ + +

Comment flags in source code

+ +

In addition to global configuration, you may also enable/disable linting or a subset of lint rules within a file with the following comment rule flags:

+ +
    +
  • /* tslint:disable */ - Disable all rules for the rest of the file
  • +
  • /* tslint:enable */ - Enable all rules for the rest of the file
  • +
  • /* tslint:disable:rule1 rule2 rule3... */ - Disable the listed rules for the rest of the file
  • +
  • /* tslint:enable:rule1 rule2 rule3... */ - Enable the listed rules for the rest of the file
  • +
  • // tslint:disable-next-line - Disables all rules for the following line
  • +
  • someCode(); // tslint:disable-line - Disables all rules for the current line
  • +
  • // tslint:disable-next-line:rule1 rule2 rule3... - Disables the listed rules for the next line
  • +
  • etc.
  • +
+ +

Rules flags enable or disable rules as they are parsed. Disabling an already disabled rule or enabling an already enabled rule has no effect. Enabling a rule that is not present or disabled in tslint.json has also no effect.

+ +

For example, imagine the directive /* tslint:disable */ on the first line of a file, /* tslint:enable:ban class-name */ on the 10th line and /* tslint:enable */ on the 20th. No rules will be checked between the 1st and 10th lines, only the ban and class-name rules will be checked between the 10th and 20th, and all rules will be checked for the remainder of the file.

+ +

Here’s an example:

+ +
function validRange (range: any) {
+   return range.min <= range.middle && range.middle <= range.max;
+}
+
+/* tslint:disable:object-literal-sort-keys */
+const range = {
+   min: 5,
+   middle: 10,    // TSLint will *not* warn about unsorted keys here
+   max: 20
+};
+/* tslint:enable:object-literal-sort-keys */
+
+const point = {
+   x: 3,
+   z: 5,          // TSLint will warn about unsorted keys here
+   y: 4,
+}
+
+console.log(validRange(range));
+
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/third-party-tools/index.html b/docs/_site/usage/third-party-tools/index.html new file mode 100644 index 00000000000..c34ca08b36b --- /dev/null +++ b/docs/_site/usage/third-party-tools/index.html @@ -0,0 +1,162 @@ + + + + + + + + + Third-Party Tools + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Third-Party Tools

+

+
+ + +

A variety of tools and libraries are available to help you integrate TSLint automatically into your build process or IDE. Please see their respective sites for usage.

+ +

Note: Most of these tools are not maintained by TSLint.

+ + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/docs/_site/usage/type-checking/index.html b/docs/_site/usage/type-checking/index.html new file mode 100644 index 00000000000..19fbe5be788 --- /dev/null +++ b/docs/_site/usage/type-checking/index.html @@ -0,0 +1,183 @@ + + + + + + + + + Type Checking + + + + + + + + + + + +
+ + +
+ + +
+
+
+ +
+

Type Checking

+

+
+ + +

Semantic lint rules

+ +

Some TSLint rules go further than linting code syntax. Semantic rules use the compiler’s program APIs to inspect static types and validate code patterns.

+ +
CLI
+ +

When using the CLI, use the --project flag and specify your tsconfig.json to enable rules that work with the type checker. TSLint will lint all files included in your project as specified in tsconfig.json.

+ +
tslint --project tsconfig.json --config tslint.json # lints every file in your project
+tslint -p . -c tslint.json # shorthand of the command above
+tslint -p tsconfig.json --exclude '**/*.d.ts' # lint all files in the project excluding declaration files
+tslint -p tsconfig.json **/*.ts # ignores files in tsconfig.json and uses the provided glob instead
+
+ +
Library
+ +

To enable rules that work with the type checker, a TypeScript program object must be passed to the linter when using the programmatic API. Helper functions are provided to create a program from a tsconfig.json file. A project directory can be specified if project files do not lie in the same directory as the tsconfig.json file.

+ +
import { Linter, Configuration } from "tslint";
+
+const configurationFilename = "Specify configuration file name";
+const options = {
+    fix: false,
+    formatter: "json",
+    rulesDirectory: "customRules/",
+    formattersDirectory: "customFormatters/"
+};
+
+const program = Linter.createProgram("tsconfig.json", "projectDir/");
+const linter = new Linter(options, program);
+
+const files = Linter.getFileNames(program);
+files.forEach(file => {
+    const fileContents = program.getSourceFile(file).getFullText();
+    const configuration = Configuration.findConfiguration(configurationFilename, file).results;
+    linter.lint(file, fileContents, configuration);
+});
+
+const results = linter.getResult();
+
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + diff --git a/src/rules/code-examples/curly.examples.ts b/src/rules/code-examples/curly.examples.ts new file mode 100644 index 00000000000..795bf3c38bc --- /dev/null +++ b/src/rules/code-examples/curly.examples.ts @@ -0,0 +1,72 @@ +/** + * @license + * Copyright 2013 Palantir Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as Lint from "../../index"; + +// tslint:disable: object-literal-sort-keys +export const codeExamples = [ + { + description: "Require curly braces whenever possible (default)", + config: Lint.Utils.dedent` + "rules": { "curly": true } + `, + pass: Lint.Utils.dedent` + if (x > 0) { + doStuff(); + } + `, + fail: Lint.Utils.dedent` + if (x > 0) + doStuff(); + + if (x > 0) doStuff(); + `, + }, + { + description: "Make an exception for single-line instances", + config: Lint.Utils.dedent` + "rules": { "curly": [true, "ignore-same-line"] } + `, + pass: Lint.Utils.dedent` + if (x > 0) doStuff(); + `, + fail: Lint.Utils.dedent` + if (x > 0) + doStuff() + `, + }, + { + description: "Error on unnecessary curly braces", + config: Lint.Utils.dedent` + "rules": { "curly": [true, "as-needed"] } + `, + pass: Lint.Utils.dedent` + if (x > 0) + doStuff(); + + if (x > 0) { + customerUpdates.push(getInfo(customerId)); + return customerUpdates; + } + `, + fail: Lint.Utils.dedent` + if (x > 0) { + doStuff(); + } + `, + }, +]; diff --git a/src/rules/curlyRule.ts b/src/rules/curlyRule.ts index 63de62cdfc3..97eaac21e39 100644 --- a/src/rules/curlyRule.ts +++ b/src/rules/curlyRule.ts @@ -22,8 +22,8 @@ import { isSameLine, } from "tsutils"; import * as ts from "typescript"; - import * as Lint from "../index"; +import { codeExamples } from "./code-examples/curly.examples"; const OPTION_AS_NEEDED = "as-needed"; const OPTION_IGNORE_SAME_LINE = "ignore-same-line"; @@ -72,58 +72,7 @@ export class Rule extends Lint.Rules.AbstractRule { type: "functionality", typescriptOnly: false, hasFix: true, - codeExamples: [ - { - description: "Require curly braces whenever possible (default)", - config: Lint.Utils.dedent` - "rules": { "curly": true } - `, - pass: Lint.Utils.dedent` - if (x > 0) { - doStuff(); - } - `, - fail: Lint.Utils.dedent` - if (x > 0) - doStuff(); - - if (x > 0) doStuff(); - `, - }, - { - description: "Make an exception for single-line instances", - config: Lint.Utils.dedent` - "rules": { "curly": [true, "ignore-same-line"] } - `, - pass: Lint.Utils.dedent` - if (x > 0) doStuff(); - `, - fail: Lint.Utils.dedent` - if (x > 0) - doStuff() - `, - }, - { - description: "Error on unnecessary curly braces", - config: Lint.Utils.dedent` - "rules": { "curly": [true, "as-needed"] } - `, - pass: Lint.Utils.dedent` - if (x > 0) - doStuff(); - - if (x > 0) { - customerUpdates.push(getInfo(customerId)); - return customerUpdates; - } - `, - fail: Lint.Utils.dedent` - if (x > 0) { - doStuff(); - } - `, - }, - ], + codeExamples, }; /* tslint:enable:object-literal-sort-keys */ From b6fa66165701bcc8eca1cf95de7a5c39b53fd3d2 Mon Sep 17 00:00:00 2001 From: Aaron Ervin Date: Fri, 13 Apr 2018 07:59:47 -0400 Subject: [PATCH 12/12] removing _site dir --- .../2015/12/10/a-new-tslint-website.html | 122 - .../03/31/sharable-configurations-rules.html | 203 -- docs/_site/2016/11/17/new-for-4.0.html | 163 -- docs/_site/Gemfile | 2 - docs/_site/Gemfile.lock | 238 -- docs/_site/circle.yml | 7 - docs/_site/css/main.css | 989 -------- docs/_site/develop/contributing/index.html | 178 -- .../develop/custom-formatters/index.html | 162 -- docs/_site/develop/custom-rules/index.html | 224 -- .../custom-rules/performance-tips.html | 295 --- .../develop/custom-rules/walker-design.html | 320 --- docs/_site/develop/docs/index.html | 163 -- docs/_site/develop/testing-rules/index.html | 322 --- docs/_site/feed.xml | 232 -- docs/_site/formatters/checkstyle/index.html | 130 - docs/_site/formatters/codeFrame/index.html | 134 -- docs/_site/formatters/filesList/index.html | 120 - docs/_site/formatters/index.html | 155 -- docs/_site/formatters/json/index.html | 142 -- docs/_site/formatters/junit/index.html | 132 - docs/_site/formatters/msbuild/index.html | 123 - docs/_site/formatters/pmd/index.html | 128 - docs/_site/formatters/prose/index.html | 120 - docs/_site/formatters/stylish/index.html | 127 - docs/_site/formatters/tap/index.html | 137 -- docs/_site/formatters/verbose/index.html | 123 - docs/_site/formatters/vso/index.html | 125 - docs/_site/index.html | 117 - docs/_site/news/index.html | 202 -- .../adjacent-overload-signatures/index.html | 150 -- docs/_site/rules/align/index.html | 174 -- docs/_site/rules/array-type/index.html | 170 -- docs/_site/rules/arrow-parens/index.html | 161 -- .../rules/arrow-return-shorthand/index.html | 156 -- docs/_site/rules/await-promise/index.html | 173 -- .../_site/rules/ban-comma-operator/index.html | 170 -- docs/_site/rules/ban-types/index.html | 160 -- docs/_site/rules/ban/index.html | 212 -- .../index.html | 139 -- docs/_site/rules/callable-types/index.html | 148 -- docs/_site/rules/class-name/index.html | 141 -- docs/_site/rules/comment-format/index.html | 201 -- docs/_site/rules/completed-docs/index.html | 553 ----- docs/_site/rules/curly/index.html | 263 -- .../rules/cyclomatic-complexity/index.html | 168 -- docs/_site/rules/deprecation/index.html | 151 -- docs/_site/rules/encoding/index.html | 137 -- docs/_site/rules/eofline/index.html | 153 -- docs/_site/rules/file-header/index.html | 162 -- docs/_site/rules/forin/index.html | 150 -- docs/_site/rules/import-blacklist/index.html | 155 -- docs/_site/rules/import-spacing/index.html | 137 -- docs/_site/rules/indent/index.html | 197 -- docs/_site/rules/index.html | 2129 ----------------- docs/_site/rules/interface-name/index.html | 166 -- .../interface-over-type-literal/index.html | 152 -- docs/_site/rules/jsdoc-format/index.html | 171 -- docs/_site/rules/label-position/index.html | 147 -- docs/_site/rules/linebreak-style/index.html | 162 -- .../match-default-export-name/index.html | 150 -- .../rules/max-classes-per-file/index.html | 167 -- .../rules/max-file-line-count/index.html | 146 -- docs/_site/rules/max-line-length/index.html | 191 -- docs/_site/rules/member-access/index.html | 181 -- docs/_site/rules/member-ordering/index.html | 266 -- docs/_site/rules/new-parens/index.html | 141 -- .../rules/newline-before-return/index.html | 141 -- .../rules/newline-per-chained-call/index.html | 139 -- .../index.html | 155 -- docs/_site/rules/no-any/index.html | 150 -- docs/_site/rules/no-arg/index.html | 144 -- docs/_site/rules/no-bitwise/index.html | 151 -- .../no-boolean-literal-compare/index.html | 150 -- .../no-conditional-assignment/index.html | 147 -- .../no-consecutive-blank-lines/index.html | 159 -- docs/_site/rules/no-console/index.html | 146 -- docs/_site/rules/no-construct/index.html | 147 -- docs/_site/rules/no-debugger/index.html | 141 -- docs/_site/rules/no-default-export/index.html | 147 -- .../rules/no-duplicate-imports/index.html | 144 -- .../_site/rules/no-duplicate-super/index.html | 141 -- .../rules/no-duplicate-switch-case/index.html | 137 -- .../rules/no-duplicate-variable/index.html | 157 -- docs/_site/rules/no-dynamic-delete/index.html | 148 -- .../_site/rules/no-empty-interface/index.html | 146 -- docs/_site/rules/no-empty/index.html | 154 -- docs/_site/rules/no-eval/index.html | 144 -- .../rules/no-floating-promises/index.html | 169 -- docs/_site/rules/no-for-in-array/index.html | 161 -- .../rules/no-implicit-dependencies/index.html | 165 -- .../rules/no-import-side-effect/index.html | 162 -- .../rules/no-inferrable-types/index.html | 178 -- .../no-inferred-empty-object-type/index.html | 148 -- .../_site/rules/no-internal-module/index.html | 152 -- .../no-invalid-template-strings/index.html | 137 -- docs/_site/rules/no-invalid-this/index.html | 160 -- .../rules/no-irregular-whitespace/index.html | 146 -- docs/_site/rules/no-magic-numbers/index.html | 155 -- .../rules/no-mergeable-namespace/index.html | 146 -- docs/_site/rules/no-misused-new/index.html | 146 -- docs/_site/rules/no-namespace/index.html | 174 -- .../rules/no-non-null-assertion/index.html | 150 -- docs/_site/rules/no-null-keyword/index.html | 152 -- .../index.html | 157 -- .../rules/no-parameter-properties/index.html | 152 -- .../no-parameter-reassignment/index.html | 137 -- .../_site/rules/no-redundant-jsdoc/index.html | 146 -- .../rules/no-reference-import/index.html | 142 -- docs/_site/rules/no-reference/index.html | 143 -- .../_site/rules/no-require-imports/index.html | 141 -- docs/_site/rules/no-return-await/index.html | 153 -- .../rules/no-shadowed-variable/index.html | 213 -- docs/_site/rules/no-sparse-arrays/index.html | 141 -- docs/_site/rules/no-string-literal/index.html | 155 -- docs/_site/rules/no-string-throw/index.html | 142 -- .../rules/no-submodule-imports/index.html | 154 -- .../no-switch-case-fall-through/index.html | 166 -- .../_site/rules/no-this-assignment/index.html | 163 -- .../rules/no-trailing-whitespace/index.html | 177 -- docs/_site/rules/no-unbound-method/index.html | 157 -- .../index.html | 139 -- .../rules/no-unnecessary-class/index.html | 163 -- .../no-unnecessary-initializer/index.html | 146 -- .../rules/no-unnecessary-qualifier/index.html | 150 -- .../no-unnecessary-type-assertion/index.html | 154 -- docs/_site/rules/no-unsafe-any/index.html | 152 -- docs/_site/rules/no-unsafe-finally/index.html | 150 -- .../rules/no-unused-expression/index.html | 171 -- .../_site/rules/no-unused-variable/index.html | 197 -- .../rules/no-use-before-declare/index.html | 156 -- docs/_site/rules/no-var-keyword/index.html | 149 -- docs/_site/rules/no-var-requires/index.html | 151 -- .../_site/rules/no-void-expression/index.html | 154 -- .../rules/number-literal-format/index.html | 137 -- .../object-literal-key-quotes/index.html | 189 -- .../rules/object-literal-shorthand/index.html | 156 -- .../rules/object-literal-sort-keys/index.html | 170 -- docs/_site/rules/one-line/index.html | 169 -- .../one-variable-per-declaration/index.html | 156 -- .../rules/only-arrow-functions/index.html | 163 -- docs/_site/rules/ordered-imports/index.html | 251 -- .../prefer-conditional-expression/index.html | 152 -- docs/_site/rules/prefer-const/index.html | 171 -- docs/_site/rules/prefer-for-of/index.html | 141 -- .../prefer-function-over-method/index.html | 149 -- .../rules/prefer-method-signature/index.html | 146 -- .../rules/prefer-object-spread/index.html | 150 -- docs/_site/rules/prefer-readonly/index.html | 169 -- docs/_site/rules/prefer-switch/index.html | 151 -- docs/_site/rules/prefer-template/index.html | 147 -- .../rules/promise-function-async/index.html | 155 -- docs/_site/rules/quotemark/index.html | 177 -- docs/_site/rules/radix/index.html | 146 -- .../rules/restrict-plus-operands/index.html | 146 -- docs/_site/rules/return-undefined/index.html | 146 -- docs/_site/rules/semicolon/index.html | 192 -- .../space-before-function-paren/index.html | 208 -- .../rules/space-within-parens/index.html | 147 -- .../strict-boolean-expressions/index.html | 227 -- .../rules/strict-type-predicates/index.html | 155 -- docs/_site/rules/switch-default/index.html | 137 -- .../_site/rules/switch-final-break/index.html | 149 -- docs/_site/rules/trailing-comma/index.html | 320 --- docs/_site/rules/triple-equals/index.html | 162 -- .../rules/type-literal-delimiter/index.html | 148 -- .../_site/rules/typedef-whitespace/index.html | 277 --- docs/_site/rules/typedef/index.html | 177 -- docs/_site/rules/typeof-compare/index.html | 137 -- .../_site/rules/unified-signatures/index.html | 146 -- .../use-default-type-parameter/index.html | 148 -- docs/_site/rules/use-isnan/index.html | 143 -- docs/_site/rules/variable-name/index.html | 169 -- docs/_site/rules/whitespace/index.html | 183 -- docs/_site/usage/cli/index.html | 290 --- docs/_site/usage/configuration/index.html | 273 --- docs/_site/usage/library/index.html | 205 -- docs/_site/usage/rule-flags/index.html | 185 -- docs/_site/usage/third-party-tools/index.html | 162 -- docs/_site/usage/type-checking/index.html | 183 -- 180 files changed, 32505 deletions(-) delete mode 100644 docs/_site/2015/12/10/a-new-tslint-website.html delete mode 100644 docs/_site/2016/03/31/sharable-configurations-rules.html delete mode 100644 docs/_site/2016/11/17/new-for-4.0.html delete mode 100644 docs/_site/Gemfile delete mode 100644 docs/_site/Gemfile.lock delete mode 100644 docs/_site/circle.yml delete mode 100644 docs/_site/css/main.css delete mode 100644 docs/_site/develop/contributing/index.html delete mode 100644 docs/_site/develop/custom-formatters/index.html delete mode 100644 docs/_site/develop/custom-rules/index.html delete mode 100644 docs/_site/develop/custom-rules/performance-tips.html delete mode 100644 docs/_site/develop/custom-rules/walker-design.html delete mode 100644 docs/_site/develop/docs/index.html delete mode 100644 docs/_site/develop/testing-rules/index.html delete mode 100644 docs/_site/feed.xml delete mode 100644 docs/_site/formatters/checkstyle/index.html delete mode 100644 docs/_site/formatters/codeFrame/index.html delete mode 100644 docs/_site/formatters/filesList/index.html delete mode 100644 docs/_site/formatters/index.html delete mode 100644 docs/_site/formatters/json/index.html delete mode 100644 docs/_site/formatters/junit/index.html delete mode 100644 docs/_site/formatters/msbuild/index.html delete mode 100644 docs/_site/formatters/pmd/index.html delete mode 100644 docs/_site/formatters/prose/index.html delete mode 100644 docs/_site/formatters/stylish/index.html delete mode 100644 docs/_site/formatters/tap/index.html delete mode 100644 docs/_site/formatters/verbose/index.html delete mode 100644 docs/_site/formatters/vso/index.html delete mode 100644 docs/_site/index.html delete mode 100644 docs/_site/news/index.html delete mode 100644 docs/_site/rules/adjacent-overload-signatures/index.html delete mode 100644 docs/_site/rules/align/index.html delete mode 100644 docs/_site/rules/array-type/index.html delete mode 100644 docs/_site/rules/arrow-parens/index.html delete mode 100644 docs/_site/rules/arrow-return-shorthand/index.html delete mode 100644 docs/_site/rules/await-promise/index.html delete mode 100644 docs/_site/rules/ban-comma-operator/index.html delete mode 100644 docs/_site/rules/ban-types/index.html delete mode 100644 docs/_site/rules/ban/index.html delete mode 100644 docs/_site/rules/binary-expression-operand-order/index.html delete mode 100644 docs/_site/rules/callable-types/index.html delete mode 100644 docs/_site/rules/class-name/index.html delete mode 100644 docs/_site/rules/comment-format/index.html delete mode 100644 docs/_site/rules/completed-docs/index.html delete mode 100644 docs/_site/rules/curly/index.html delete mode 100644 docs/_site/rules/cyclomatic-complexity/index.html delete mode 100644 docs/_site/rules/deprecation/index.html delete mode 100644 docs/_site/rules/encoding/index.html delete mode 100644 docs/_site/rules/eofline/index.html delete mode 100644 docs/_site/rules/file-header/index.html delete mode 100644 docs/_site/rules/forin/index.html delete mode 100644 docs/_site/rules/import-blacklist/index.html delete mode 100644 docs/_site/rules/import-spacing/index.html delete mode 100644 docs/_site/rules/indent/index.html delete mode 100644 docs/_site/rules/index.html delete mode 100644 docs/_site/rules/interface-name/index.html delete mode 100644 docs/_site/rules/interface-over-type-literal/index.html delete mode 100644 docs/_site/rules/jsdoc-format/index.html delete mode 100644 docs/_site/rules/label-position/index.html delete mode 100644 docs/_site/rules/linebreak-style/index.html delete mode 100644 docs/_site/rules/match-default-export-name/index.html delete mode 100644 docs/_site/rules/max-classes-per-file/index.html delete mode 100644 docs/_site/rules/max-file-line-count/index.html delete mode 100644 docs/_site/rules/max-line-length/index.html delete mode 100644 docs/_site/rules/member-access/index.html delete mode 100644 docs/_site/rules/member-ordering/index.html delete mode 100644 docs/_site/rules/new-parens/index.html delete mode 100644 docs/_site/rules/newline-before-return/index.html delete mode 100644 docs/_site/rules/newline-per-chained-call/index.html delete mode 100644 docs/_site/rules/no-angle-bracket-type-assertion/index.html delete mode 100644 docs/_site/rules/no-any/index.html delete mode 100644 docs/_site/rules/no-arg/index.html delete mode 100644 docs/_site/rules/no-bitwise/index.html delete mode 100644 docs/_site/rules/no-boolean-literal-compare/index.html delete mode 100644 docs/_site/rules/no-conditional-assignment/index.html delete mode 100644 docs/_site/rules/no-consecutive-blank-lines/index.html delete mode 100644 docs/_site/rules/no-console/index.html delete mode 100644 docs/_site/rules/no-construct/index.html delete mode 100644 docs/_site/rules/no-debugger/index.html delete mode 100644 docs/_site/rules/no-default-export/index.html delete mode 100644 docs/_site/rules/no-duplicate-imports/index.html delete mode 100644 docs/_site/rules/no-duplicate-super/index.html delete mode 100644 docs/_site/rules/no-duplicate-switch-case/index.html delete mode 100644 docs/_site/rules/no-duplicate-variable/index.html delete mode 100644 docs/_site/rules/no-dynamic-delete/index.html delete mode 100644 docs/_site/rules/no-empty-interface/index.html delete mode 100644 docs/_site/rules/no-empty/index.html delete mode 100644 docs/_site/rules/no-eval/index.html delete mode 100644 docs/_site/rules/no-floating-promises/index.html delete mode 100644 docs/_site/rules/no-for-in-array/index.html delete mode 100644 docs/_site/rules/no-implicit-dependencies/index.html delete mode 100644 docs/_site/rules/no-import-side-effect/index.html delete mode 100644 docs/_site/rules/no-inferrable-types/index.html delete mode 100644 docs/_site/rules/no-inferred-empty-object-type/index.html delete mode 100644 docs/_site/rules/no-internal-module/index.html delete mode 100644 docs/_site/rules/no-invalid-template-strings/index.html delete mode 100644 docs/_site/rules/no-invalid-this/index.html delete mode 100644 docs/_site/rules/no-irregular-whitespace/index.html delete mode 100644 docs/_site/rules/no-magic-numbers/index.html delete mode 100644 docs/_site/rules/no-mergeable-namespace/index.html delete mode 100644 docs/_site/rules/no-misused-new/index.html delete mode 100644 docs/_site/rules/no-namespace/index.html delete mode 100644 docs/_site/rules/no-non-null-assertion/index.html delete mode 100644 docs/_site/rules/no-null-keyword/index.html delete mode 100644 docs/_site/rules/no-object-literal-type-assertion/index.html delete mode 100644 docs/_site/rules/no-parameter-properties/index.html delete mode 100644 docs/_site/rules/no-parameter-reassignment/index.html delete mode 100644 docs/_site/rules/no-redundant-jsdoc/index.html delete mode 100644 docs/_site/rules/no-reference-import/index.html delete mode 100644 docs/_site/rules/no-reference/index.html delete mode 100644 docs/_site/rules/no-require-imports/index.html delete mode 100644 docs/_site/rules/no-return-await/index.html delete mode 100644 docs/_site/rules/no-shadowed-variable/index.html delete mode 100644 docs/_site/rules/no-sparse-arrays/index.html delete mode 100644 docs/_site/rules/no-string-literal/index.html delete mode 100644 docs/_site/rules/no-string-throw/index.html delete mode 100644 docs/_site/rules/no-submodule-imports/index.html delete mode 100644 docs/_site/rules/no-switch-case-fall-through/index.html delete mode 100644 docs/_site/rules/no-this-assignment/index.html delete mode 100644 docs/_site/rules/no-trailing-whitespace/index.html delete mode 100644 docs/_site/rules/no-unbound-method/index.html delete mode 100644 docs/_site/rules/no-unnecessary-callback-wrapper/index.html delete mode 100644 docs/_site/rules/no-unnecessary-class/index.html delete mode 100644 docs/_site/rules/no-unnecessary-initializer/index.html delete mode 100644 docs/_site/rules/no-unnecessary-qualifier/index.html delete mode 100644 docs/_site/rules/no-unnecessary-type-assertion/index.html delete mode 100644 docs/_site/rules/no-unsafe-any/index.html delete mode 100644 docs/_site/rules/no-unsafe-finally/index.html delete mode 100644 docs/_site/rules/no-unused-expression/index.html delete mode 100644 docs/_site/rules/no-unused-variable/index.html delete mode 100644 docs/_site/rules/no-use-before-declare/index.html delete mode 100644 docs/_site/rules/no-var-keyword/index.html delete mode 100644 docs/_site/rules/no-var-requires/index.html delete mode 100644 docs/_site/rules/no-void-expression/index.html delete mode 100644 docs/_site/rules/number-literal-format/index.html delete mode 100644 docs/_site/rules/object-literal-key-quotes/index.html delete mode 100644 docs/_site/rules/object-literal-shorthand/index.html delete mode 100644 docs/_site/rules/object-literal-sort-keys/index.html delete mode 100644 docs/_site/rules/one-line/index.html delete mode 100644 docs/_site/rules/one-variable-per-declaration/index.html delete mode 100644 docs/_site/rules/only-arrow-functions/index.html delete mode 100644 docs/_site/rules/ordered-imports/index.html delete mode 100644 docs/_site/rules/prefer-conditional-expression/index.html delete mode 100644 docs/_site/rules/prefer-const/index.html delete mode 100644 docs/_site/rules/prefer-for-of/index.html delete mode 100644 docs/_site/rules/prefer-function-over-method/index.html delete mode 100644 docs/_site/rules/prefer-method-signature/index.html delete mode 100644 docs/_site/rules/prefer-object-spread/index.html delete mode 100644 docs/_site/rules/prefer-readonly/index.html delete mode 100644 docs/_site/rules/prefer-switch/index.html delete mode 100644 docs/_site/rules/prefer-template/index.html delete mode 100644 docs/_site/rules/promise-function-async/index.html delete mode 100644 docs/_site/rules/quotemark/index.html delete mode 100644 docs/_site/rules/radix/index.html delete mode 100644 docs/_site/rules/restrict-plus-operands/index.html delete mode 100644 docs/_site/rules/return-undefined/index.html delete mode 100644 docs/_site/rules/semicolon/index.html delete mode 100644 docs/_site/rules/space-before-function-paren/index.html delete mode 100644 docs/_site/rules/space-within-parens/index.html delete mode 100644 docs/_site/rules/strict-boolean-expressions/index.html delete mode 100644 docs/_site/rules/strict-type-predicates/index.html delete mode 100644 docs/_site/rules/switch-default/index.html delete mode 100644 docs/_site/rules/switch-final-break/index.html delete mode 100644 docs/_site/rules/trailing-comma/index.html delete mode 100644 docs/_site/rules/triple-equals/index.html delete mode 100644 docs/_site/rules/type-literal-delimiter/index.html delete mode 100644 docs/_site/rules/typedef-whitespace/index.html delete mode 100644 docs/_site/rules/typedef/index.html delete mode 100644 docs/_site/rules/typeof-compare/index.html delete mode 100644 docs/_site/rules/unified-signatures/index.html delete mode 100644 docs/_site/rules/use-default-type-parameter/index.html delete mode 100644 docs/_site/rules/use-isnan/index.html delete mode 100644 docs/_site/rules/variable-name/index.html delete mode 100644 docs/_site/rules/whitespace/index.html delete mode 100644 docs/_site/usage/cli/index.html delete mode 100644 docs/_site/usage/configuration/index.html delete mode 100644 docs/_site/usage/library/index.html delete mode 100644 docs/_site/usage/rule-flags/index.html delete mode 100644 docs/_site/usage/third-party-tools/index.html delete mode 100644 docs/_site/usage/type-checking/index.html diff --git a/docs/_site/2015/12/10/a-new-tslint-website.html b/docs/_site/2015/12/10/a-new-tslint-website.html deleted file mode 100644 index f362acb439e..00000000000 --- a/docs/_site/2015/12/10/a-new-tslint-website.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - A New TSLint Website - - - - - - - - - - - -
- - -
- - -
-
- -
-

A New TSLint Website

- -
- -
-

As TSLint has grown in usage and popularity alongside of TypeScript, it also has -evolved in terms of functionality and complexity. Today, all sorts of projects and products, -from Angular 2 to the TypeScript compiler itself use TSLint -to help keep their code high-quality.

- -

Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. -For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long TSLint README. -Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. -There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.

- -

This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:

- -
    -
  • A documentation overhaul that will provide -more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.
  • -
  • A new --init feature in the TSLint CLI that will make it easier to -generate a sensible initial tslint.json config file.
  • -
  • An improved contributor experience that will make things easier for those who want to contribute code to TSLint.
  • -
- -

Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!

- - -
- -
- - - -
- - - - diff --git a/docs/_site/2016/03/31/sharable-configurations-rules.html b/docs/_site/2016/03/31/sharable-configurations-rules.html deleted file mode 100644 index 065d65b4638..00000000000 --- a/docs/_site/2016/03/31/sharable-configurations-rules.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - Sharable Configurations and Rules - - - - - - - - - - - -
- - -
- - -
-
- -
-

Sharable Configurations and Rules

- -
- -
-

With the release of TSLint v3.7.0 comes a few new features that will make configuration files (aka tslint.json files) -easier to maintain and share. The crux of the changes is a new extends field, which when provided indicates that a configuration -file augments another configuration file.

- -

Example

- -

Let’s imagine you’ve created some custom rules and want to share them with others. -You also have a couple of configurations for them you want to share.

- -

Here’s the layout of our NPM package, which we’ll call shared-tslint-rules. We have a directory with rules, -as well as a few different config files for TSLint.

- -
shared-tslint-rules
-├── package.json
-├── rules
-│   ├── noAdditionRule.js
-│   ├── noErrorsRule.js
-│   └── noExcessiveCommentingRule.js
-├── tslint-base.json
-├── tslint-config.json
-└── tslint-crazy-config.js
-
- -

Our starting-point config file just references the directory the custom rules are in -but doesn’t enable any of them:

- -

tslint-base.json:

- -
{
-    "rulesDirectory": "./rules"
-}
-
- -

We also want to provide a sane default config for our rules. -Notice how it extends our base config, so we don’t have to redeclare rulesDirectory here:

- -

tslint-config.json:

- -
{
-    "extends": "./tslint-base.json",
-    "rules": {
-        "no-errors": true,
-        "no-addition": false
-    }
-}
-
- -

Finally, we can even make a crazy config file for fun that gives you back a different config -each time you run TSLint. Notice how this is a .js file that exports an object:

- -

tslint-crazy-config.js

- -
module.exports = {
-    extends: "./tslint-base.json",
-    rules: {
-        "no-excessive-commenting": [true, {maxComments: Math.random() * 10}]
-    }
-};
-
- -

Finally, we have our package.json file which references our base config file through its main field:

- -

package.json:

- -
{
-  "name": "shared-tslint-rules",
-  "version": "1.0.0",
-  "description": "Some TSLint rules that are great!",
-  "main": "tslint-base.json",
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "author": "",
-  "license": "MIT"
-}
-
- -

We can publish our package on NPM to let the world use it!

- -
- -

Now let’s say we’re a user, and we want to use the custom rules above to lint our code. -First, we’ll make sure we have the necessary npm packages installed:

- -
npm install -g tslint shared-tslint-rules
-
- -

Then, in our tslint.json file for our project, we can reference the package of custom rules with extends:

- -
{
-    "extends": "shared-tslint-rules/tslint-config",
-    "rules": {
-        "no-addition": true
-    }
-}
-
- -

and that’s all we have to do to use the custom rules! -We can now run TSLint as we would normally and see any lint errors produced by the custom rules:

- -
tslint -c path/to/tslint.json my/files/**/to/lint.ts
-
- - -
- -
- - - -
- - - - diff --git a/docs/_site/2016/11/17/new-for-4.0.html b/docs/_site/2016/11/17/new-for-4.0.html deleted file mode 100644 index 55be6d39ddc..00000000000 --- a/docs/_site/2016/11/17/new-for-4.0.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - TSLint 4.0 Released - - - - - - - - - - - -
- - -
- - -
-
- -
-

TSLint 4.0 Released

- -
- -
-

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

- - - -
- -

Create your own fixer

-

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

- -

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-const fix = new Lint.Fix("no-imports", [replacement]);
-
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
- - -
- -
- - - -
- - - - diff --git a/docs/_site/Gemfile b/docs/_site/Gemfile deleted file mode 100644 index 053c27dc351..00000000000 --- a/docs/_site/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'github-pages' diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock deleted file mode 100644 index 3eaa6478c32..00000000000 --- a/docs/_site/Gemfile.lock +++ /dev/null @@ -1,238 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (4.2.9) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.11.1) - colorator (1.1.0) - commonmarker (0.17.7.1) - ruby-enum (~> 0.5) - concurrent-ruby (1.0.5) - ethon (0.11.0) - ffi (>= 1.3.0) - execjs (2.7.0) - faraday (0.13.1) - multipart-post (>= 1.2, < 3) - ffi (1.9.18) - forwardable-extended (2.6.0) - gemoji (3.0.0) - github-pages (172) - activesupport (= 4.2.9) - github-pages-health-check (= 1.3.5) - jekyll (= 3.6.2) - jekyll-avatar (= 0.5.0) - jekyll-coffeescript (= 1.0.2) - jekyll-commonmark-ghpages (= 0.1.3) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.9.2) - jekyll-gist (= 1.4.1) - jekyll-github-metadata (= 2.9.3) - jekyll-mentions (= 1.2.0) - jekyll-optional-front-matter (= 0.3.0) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.12.1) - jekyll-relative-links (= 0.5.2) - jekyll-remote-theme (= 0.2.3) - jekyll-sass-converter (= 1.5.0) - jekyll-seo-tag (= 2.3.0) - jekyll-sitemap (= 1.1.1) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.0) - jekyll-theme-cayman (= 0.1.0) - jekyll-theme-dinky (= 0.1.0) - jekyll-theme-hacker (= 0.1.0) - jekyll-theme-leap-day (= 0.1.0) - jekyll-theme-merlot (= 0.1.0) - jekyll-theme-midnight (= 0.1.0) - jekyll-theme-minimal (= 0.1.0) - jekyll-theme-modernist (= 0.1.0) - jekyll-theme-primer (= 0.5.2) - jekyll-theme-slate (= 0.1.0) - jekyll-theme-tactile (= 0.1.0) - jekyll-theme-time-machine (= 0.1.0) - jekyll-titles-from-headings (= 0.5.0) - jemoji (= 0.8.1) - kramdown (= 1.14.0) - liquid (= 4.0.0) - listen (= 3.0.6) - mercenary (~> 0.3) - minima (= 2.1.1) - rouge (= 2.2.1) - terminal-table (~> 1.4) - github-pages-health-check (1.3.5) - addressable (~> 2.3) - net-dns (~> 0.8) - octokit (~> 4.0) - public_suffix (~> 2.0) - typhoeus (~> 0.7) - html-pipeline (2.7.1) - activesupport (>= 2) - nokogiri (>= 1.4) - i18n (0.9.1) - concurrent-ruby (~> 1.0) - jekyll (3.6.2) - addressable (~> 2.4) - colorator (~> 1.0) - jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 1.1) - kramdown (~> 1.14) - liquid (~> 4.0) - mercenary (~> 0.3.3) - pathutil (~> 0.9) - rouge (>= 1.7, < 3) - safe_yaml (~> 1.0) - jekyll-avatar (0.5.0) - jekyll (~> 3.0) - jekyll-coffeescript (1.0.2) - coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.1.0) - commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) - jekyll-commonmark-ghpages (0.1.3) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.9.2) - jekyll (~> 3.3) - jekyll-gist (1.4.1) - octokit (~> 4.2) - jekyll-github-metadata (2.9.3) - jekyll (~> 3.1) - octokit (~> 4.0, != 4.4.0) - jekyll-mentions (1.2.0) - activesupport (~> 4.0) - html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.12.1) - jekyll (~> 3.3) - jekyll-relative-links (0.5.2) - jekyll (~> 3.3) - jekyll-remote-theme (0.2.3) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) - typhoeus (>= 0.7, < 2.0) - jekyll-sass-converter (1.5.0) - sass (~> 3.4) - jekyll-seo-tag (2.3.0) - jekyll (~> 3.3) - jekyll-sitemap (1.1.1) - jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.2) - jekyll (~> 3.5) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.2) - jekyll-theme-slate (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.0) - jekyll (~> 3.3) - jekyll-watch (1.5.1) - listen (~> 3.0) - jemoji (0.8.1) - activesupport (~> 4.0, >= 4.2.9) - gemoji (~> 3.0) - html-pipeline (~> 2.2) - jekyll (>= 3.0) - kramdown (1.14.0) - liquid (4.0.0) - listen (3.0.6) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9.7) - mercenary (0.3.6) - mini_portile2 (2.3.0) - minima (2.1.1) - jekyll (~> 3.3) - minitest (5.10.3) - multipart-post (2.0.0) - net-dns (0.8.0) - nokogiri (1.8.1) - mini_portile2 (~> 2.3.0) - octokit (4.8.0) - sawyer (~> 0.8.0, >= 0.5.3) - pathutil (0.16.1) - forwardable-extended (~> 2.6) - public_suffix (2.0.5) - rb-fsevent (0.10.2) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rouge (2.2.1) - ruby-enum (0.7.1) - i18n - rubyzip (1.2.1) - safe_yaml (1.0.4) - sass (3.5.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - typhoeus (0.8.0) - ethon (>= 0.8.0) - tzinfo (1.2.4) - thread_safe (~> 0.1) - unicode-display_width (1.3.0) - -PLATFORMS - ruby - -DEPENDENCIES - github-pages - -BUNDLED WITH - 1.16.1 diff --git a/docs/_site/circle.yml b/docs/_site/circle.yml deleted file mode 100644 index 1e8b5a738ae..00000000000 --- a/docs/_site/circle.yml +++ /dev/null @@ -1,7 +0,0 @@ -machine: - ruby: - # see available versions here: https://circleci.com/docs/build-image-precise/#ruby - version: 2.2.3 -test: - override: - - bundle exec jekyll build diff --git a/docs/_site/css/main.css b/docs/_site/css/main.css deleted file mode 100644 index f8b2fda7512..00000000000 --- a/docs/_site/css/main.css +++ /dev/null @@ -1,989 +0,0 @@ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ -html { - font-family: sans-serif; - /* 1 */ - -ms-text-size-adjust: 100%; - /* 2 */ - -webkit-text-size-adjust: 100%; - /* 2 */ } - -/** - * Remove default margin. - */ -body { - margin: 0; } - -/* HTML5 display definitions - ========================================================================== */ -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; } - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ -audio, -canvas, -progress, -video { - display: inline-block; - /* 1 */ - vertical-align: baseline; - /* 2 */ } - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ -audio:not([controls]) { - display: none; - height: 0; } - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. - */ -[hidden], -template { - display: none; } - -/* Links - ========================================================================== */ -/** - * Remove the gray background color from active links in IE 10. - */ -a { - background-color: transparent; } - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ -a:active, -a:hover { - outline: 0; } - -/* Text-level semantics - ========================================================================== */ -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ -abbr[title] { - border-bottom: 1px dotted; } - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ -b, -strong { - font-weight: bold; } - -/** - * Address styling not present in Safari and Chrome. - */ -dfn { - font-style: italic; } - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ -h1 { - font-size: 2em; - margin: 0.67em 0; } - -/** - * Address styling not present in IE 8/9. - */ -mark { - background: #ff0; - color: #000; } - -/** - * Address inconsistent and variable font size in all browsers. - */ -small { - font-size: 80%; } - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; } - -sup { - top: -0.5em; } - -sub { - bottom: -0.25em; } - -/* Embedded content - ========================================================================== */ -/** - * Remove border when inside `a` element in IE 8/9/10. - */ -img { - border: 0; } - -/** - * Correct overflow not hidden in IE 9/10/11. - */ -svg:not(:root) { - overflow: hidden; } - -/* Grouping content - ========================================================================== */ -/** - * Address margin not present in IE 8/9 and Safari. - */ -figure { - margin: 1em 40px; } - -/** - * Address differences between Firefox and other browsers. - */ -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; } - -/** - * Contain overflow in all browsers. - */ -pre { - overflow: auto; } - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; } - -/* Forms - ========================================================================== */ -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - */ -button, -input, -optgroup, -select, -textarea { - color: inherit; - /* 1 */ - font: inherit; - /* 2 */ - margin: 0; - /* 3 */ } - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ -button { - overflow: visible; } - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ -button, -select { - text-transform: none; } - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ -button, -html input[type="button"], -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; - /* 2 */ - cursor: pointer; - /* 3 */ } - -/** - * Re-set default cursor for disabled elements. - */ -button[disabled], -html input[disabled] { - cursor: default; } - -/** - * Remove inner padding and border in Firefox 4+. - */ -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; } - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ -input { - line-height: normal; } - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; - /* 1 */ - padding: 0; - /* 2 */ } - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; } - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome - * (include `-moz` to future-proof). - */ -input[type="search"] { - -webkit-appearance: textfield; - /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - /* 2 */ - box-sizing: content-box; } - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; } - -/** - * Define consistent border, margin, and padding. - */ -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; } - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ -legend { - border: 0; - /* 1 */ - padding: 0; - /* 2 */ } - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ -textarea { - overflow: auto; } - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ -optgroup { - font-weight: bold; } - -/* Tables - ========================================================================== */ -/** - * Remove most spacing between table cells. - */ -table { - border-collapse: collapse; - border-spacing: 0; } - -td, -th { - padding: 0; } - -/** - * Reset some basic elements - */ -body, h1, h2, h3, h4, h5, h6, -p, blockquote, pre, hr, -dl, dd, ol, ul, figure { - margin: 0; - padding: 0; } - -/** - * Set `margin-bottom` to maintain vertical rhythm - */ -h1, h2, h3, h4, h5, h6, -p, blockquote, pre, -ul, ol, dl, figure, -.highlight { - margin-bottom: 1rem; } - -/** - * Images - */ -img { - max-width: 100%; - vertical-align: middle; } - -/** - * Figures - */ -figure > img { - display: block; } - -figcaption { - font-size: 14px; } - -/** - * Clearfix - */ -.site-header:after, .page:after, .footer-col-wrapper:after { - content: ""; - display: table; - clear: both; } - -/** - * Icons - */ -.icon > svg { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: middle; } - .icon > svg path { - fill: #606c71; } - -/** - * Rules & Feature Badges - */ -.rules-list { - list-style: none; - margin: 0 !important; } - .rules-list > li:nth-child(odd) a { - background-color: rgba(0, 0, 0, 0.03); } - .rules-list > li a { - display: block; - border-left: 3px solid transparent; - text-decoration: none; - padding: .75rem; } - .rules-list > li a:hover { - background-color: rgba(0, 0, 0, 0.075); - border-left-color: #159957; } - -.rule-features { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; } - -.feature { - display: inline-block; - margin-right: 2px; - padding: 2px 4px; - font-weight: 700; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border: 1px solid transparent; - border-radius: .25rem; - cursor: help; } - .feature:before { - display: inline-block; - margin-right: 2px; } - .feature.feature-sm { - padding: 1px 3px; - font-size: 75%; } - .feature.feature-ts-only { - background-color: #FCF8E3; - border-color: #FAF2CC; - color: #8A6D3B; } - .feature.feature-ts-only:before { - content: "\1F4C4"; } - .feature.feature-fixer { - background-color: #DFF0D8; - border-color: #D0E9C6; - color: #3C763D; } - .feature.feature-fixer:before { - content: "\1f527"; } - .feature.feature-requires-type-info { - background-color: #F2DEDE; - border-color: #EBCCCC; - color: #A94442; } - .feature.feature-requires-type-info:before { - content: "\2139"; - border-radius: 50%; - background: #0078D7; - color: #FFF; - width: 1em; } - -.wrapper__code-example { - margin-bottom: 64px; } - .wrapper__code-example:last-of-type { - margin-bottom: 24px; } - .wrapper__code-example h6.heading-fail { - color: #d14; } - .wrapper__code-example .code-example { - background-color: #f1fff1; } - .wrapper__code-example .code-example.code-example-fail { - background-color: #fff5f5; } - .wrapper__code-example .code-example pre, .wrapper__code-example .code-example .highlight { - background: transparent; } - -* { - box-sizing: border-box; } - -body { - padding: 0; - margin: 0; - font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; - color: #606c71; } - -a { - color: #1e6bb8; - text-decoration: none; } - a:hover { - text-decoration: underline; } - a:visited { - color: #7d0ce8; } - -h1 { - font-size: 2.5rem; } - -h2 { - font-size: 2rem; } - -h3 { - font-size: 1.6rem; } - -h4 { - font-size: 1.4rem; } - -h5 { - font-size: 1.2rem; } - -h6 { - font-size: 1rem; } - -/** - * Site header - */ -.site-header { - border-bottom: 1px solid rgba(255, 255, 255, 0.2); - padding: 0 20px; - min-height: 56px; } - -.site-title { - font-size: 26px; - line-height: 56px; - margin-bottom: 0; - float: left; } - .site-title, .site-title:visited { - color: rgba(255, 255, 255, 0.7); } - .site-title:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; } - @media screen and (max-width: 36em) { - .site-title { - display: block; - text-align: left; } } - -.site-nav { - float: right; - line-height: 56px; } - .site-nav .page-link { - line-height: 1.5; } - .site-nav .page-link, .site-nav .page-link:visited { - color: rgba(255, 255, 255, 0.7); } - .site-nav .page-link:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; } - .site-nav .page-link:not(:first-child) { - margin-left: 20px; } - @media screen and (max-width: 36em) { - .site-nav .page-link { - display: block; - text-align: left; } - .site-nav .page-link:not(:first-child) { - margin-left: 0; } } - -.btn { - display: inline-block; - margin-bottom: 1rem; - background-color: rgba(255, 255, 255, 0.08); - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px; - border-radius: 0.3rem; - transition: color 0.2s, background-color 0.2s, border-color 0.2s; } - .btn, .btn:visited { - color: rgba(255, 255, 255, 0.7); } - .btn:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; - background-color: rgba(255, 255, 255, 0.2); - border-color: rgba(255, 255, 255, 0.3); } - .btn + .btn { - margin-left: 1rem; } - @media screen and (min-width: 64em) { - .btn { - padding: 0.75rem 1rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .btn { - padding: 0.6rem 0.9rem; - font-size: 0.9rem; } } - @media screen and (max-width: 36em) { - .btn { - display: block; - width: 100%; - padding: 0.75rem; - font-size: 0.9rem; } - .btn + .btn { - margin-top: 1rem; - margin-left: 0; } } - -.header { - color: #fff; - text-align: center; - background-color: #159957; - background-image: linear-gradient(120deg, #155799, #159957); } - -@media screen and (min-width: 64em) { - .page-header { - padding: 3rem; } } -@media screen and (min-width: 36em) and (max-width: 64em) { - .page-header { - padding: 2rem; } } -@media screen and (max-width: 36em) { - .page-header { - padding: 1rem; } } - -.project-name { - margin-top: 0; - margin-bottom: 0.1rem; } - @media screen and (min-width: 64em) { - .project-name { - font-size: 3.25rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .project-name { - font-size: 2.25rem; } } - @media screen and (max-width: 36em) { - .project-name { - font-size: 1.75rem; } } - -.project-tagline { - margin-bottom: 2rem; - font-weight: normal; - opacity: 0.7; } - @media screen and (min-width: 64em) { - .project-tagline { - font-size: 1.25rem; } } - @media screen and (min-width: 36em) and (max-width: 64em) { - .project-tagline { - font-size: 1.15rem; } } - @media screen and (max-width: 36em) { - .project-tagline { - font-size: 1rem; } } - -.main-content :first-child { - margin-top: 0; } -@media screen and (min-width: 64em) { - .main-content { - max-width: 68rem; - padding: 2rem 6rem; - margin: 0 auto; - font-size: 1.1rem; } } -@media screen and (min-width: 36em) and (max-width: 64em) { - .main-content { - padding: 2rem 4rem; - font-size: 1.1rem; } } -@media screen and (max-width: 36em) { - .main-content { - padding: 2rem 1rem; - font-size: 1rem; } } -.main-content img { - max-width: 100%; } -.main-content h1, -.main-content h2, -.main-content h3, -.main-content h4, -.main-content h5, -.main-content h6 { - margin-top: 2rem; - margin-bottom: 1rem; - font-weight: normal; - color: #159957; } -.main-content p { - margin-bottom: 1rem; } -.main-content code { - padding: 2px 4px; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - font-size: 0.9rem; - color: #383e41; - background-color: #f3f6fa; - border-radius: 0.3rem; } -.main-content pre { - padding: 0.8rem; - margin-top: 0; - margin-bottom: 1rem; - font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; - color: #567482; - word-wrap: normal; - background-color: #f3f6fa; - border: solid 1px #dce6f0; - border-radius: 0.3rem; } - .main-content pre > code { - padding: 0; - margin: 0; - font-size: 0.9rem; - color: #567482; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; } -.main-content .highlight { - margin-bottom: 1rem; } - .main-content .highlight pre { - margin-bottom: 0; - word-break: normal; } -.main-content .highlight pre, -.main-content pre { - padding: 0.8rem; - overflow: auto; - font-size: 0.9rem; - line-height: 1.45; - border-radius: 0.3rem; - -webkit-overflow-scrolling: touch; } -.main-content pre code, -.main-content pre tt { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; } - .main-content pre code:before, .main-content pre code:after, - .main-content pre tt:before, - .main-content pre tt:after { - content: normal; } -.main-content ul, -.main-content ol { - margin-top: 0; - margin-left: 30px; - margin-bottom: 1rem; } - .main-content ul ul, - .main-content ul ol, - .main-content ol ul, - .main-content ol ol { - margin-bottom: 0; } -.main-content blockquote { - padding: 0 1rem; - margin-left: 0; - color: #819198; - border-left: 0.3rem solid #dce6f0; } - .main-content blockquote > :first-child { - margin-top: 0; } - .main-content blockquote > :last-child { - margin-bottom: 0; } -.main-content table { - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all; - -webkit-overflow-scrolling: touch; } - .main-content table th { - font-weight: bold; } - .main-content table th, - .main-content table td { - padding: 0.5rem 1rem; - border: 1px solid #e9ebec; } -.main-content dl { - padding: 0; } - .main-content dl dt { - padding: 0; - margin-top: 1rem; - font-size: 1rem; - font-weight: bold; } - .main-content dl dd { - padding: 0; - margin-bottom: 1rem; } -.main-content hr { - height: 2px; - padding: 0; - margin: 1rem 0; - background-color: #eff0f1; - border: 0; } - -.page { - width: 100%; } - -.page-content { - width: 80%; - padding: 1rem; - float: left; } - -.page-sidebar { - width: 20%; - padding: 1rem; - float: left; } - .page-sidebar .active { - font-style: italic; } - -.sidebar-title { - border-bottom: 1px solid #159957; } - -ul.sidebar-links { - list-style: none; - margin-left: 0; } - ul.sidebar-links h6 { - margin-bottom: 0.33rem; } - -/** - * Posts - */ -ul.post-list { - margin-left: 0; - list-style: none; } - ul.post-list > li { - margin-bottom: 1rem; } - -.post-meta { - font-size: 14px; - color: #828282; - font-style: italic; } - -.post-link { - display: inline-block; - color: inherit; } - -.post-header { - margin-bottom: 2rem; } - -.post-title { - letter-spacing: -1px; - line-height: 1; } - -/** - * Site footer - */ -.site-footer { - padding-top: 2rem; - margin-top: 2rem; - border-top: solid 1px #eff0f1; - font-size: 0.9rem; } - -ul.contact-list, -ul.social-media-list { - list-style: none; - margin-left: 0; } - -.footer-col { - float: left; } - -.footer-col-2 { - float: right; } - @media screen and (max-width: 36em) { - .footer-col-2 { - float: left; } } - -/** - * Syntax highlighting styles - */ -.highlight { - background: #fff; } - .highlight .c { - color: #998; - font-style: italic; } - .highlight .err { - color: #a61717; - background-color: #e3d2d2; } - .highlight .k { - font-weight: bold; } - .highlight .o { - font-weight: bold; } - .highlight .cm { - color: #998; - font-style: italic; } - .highlight .cp { - color: #999; - font-weight: bold; } - .highlight .c1 { - color: #998; - font-style: italic; } - .highlight .cs { - color: #999; - font-weight: bold; - font-style: italic; } - .highlight .gd { - color: #000; - background-color: #fdd; } - .highlight .gd .x { - color: #000; - background-color: #faa; } - .highlight .ge { - font-style: italic; } - .highlight .gr { - color: #a00; } - .highlight .gh { - color: #999; } - .highlight .gi { - color: #000; - background-color: #dfd; } - .highlight .gi .x { - color: #000; - background-color: #afa; } - .highlight .go { - color: #888; } - .highlight .gp { - color: #555; } - .highlight .gs { - font-weight: bold; } - .highlight .gu { - color: #aaa; } - .highlight .gt { - color: #a00; } - .highlight .kc { - font-weight: bold; } - .highlight .kd { - font-weight: bold; } - .highlight .kp { - font-weight: bold; } - .highlight .kr { - font-weight: bold; } - .highlight .kt { - color: #458; - font-weight: bold; } - .highlight .m { - color: #099; } - .highlight .s { - color: #d14; } - .highlight .na { - color: #008080; } - .highlight .nb { - color: #0086B3; } - .highlight .nc { - color: #458; - font-weight: bold; } - .highlight .no { - color: #008080; } - .highlight .ni { - color: #800080; } - .highlight .ne { - color: #900; - font-weight: bold; } - .highlight .nf { - color: #900; - font-weight: bold; } - .highlight .nn { - color: #555; } - .highlight .nt { - color: #000080; } - .highlight .nv { - color: #008080; } - .highlight .ow { - font-weight: bold; } - .highlight .w { - color: #bbb; } - .highlight .mf { - color: #099; } - .highlight .mh { - color: #099; } - .highlight .mi { - color: #099; } - .highlight .mo { - color: #099; } - .highlight .sb { - color: #d14; } - .highlight .sc { - color: #d14; } - .highlight .sd { - color: #d14; } - .highlight .s2 { - color: #d14; } - .highlight .se { - color: #d14; } - .highlight .sh { - color: #d14; } - .highlight .si { - color: #d14; } - .highlight .sx { - color: #d14; } - .highlight .sr { - color: #009926; } - .highlight .s1 { - color: #d14; } - .highlight .ss { - color: #990073; } - .highlight .bp { - color: #999; } - .highlight .vc { - color: #008080; } - .highlight .vg { - color: #008080; } - .highlight .vi { - color: #008080; } - .highlight .il { - color: #099; } diff --git a/docs/_site/develop/contributing/index.html b/docs/_site/develop/contributing/index.html deleted file mode 100644 index 407c93a6cd2..00000000000 --- a/docs/_site/develop/contributing/index.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - Contributing to TSLint - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Contributing to TSLint

-

-
- - -

To develop TSLint, clone the repository and install its dependencies:

- -
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf
-yarn
-yarn compile
-yarn test
-
- -

Running a specific test

- -

You can test a specific test by using the --test command line parameter followed by your test directory. For example:

-
// global tslint
-// point to a dir that has tslint.json and .lint files
-tslint --test test/rules/semicolon/always
-
-// locally built tslint
-./bin/tslint --test test/rules/semicolon/always
-
- -

Debugging in Visual Studio Code

- -

Configuration files to work with Visual Studio Code are included when you check out the source code. These files live in the .vscode directory. To run TSLint in the debugger, switch to Debug view and use the dropdown at the top of the Debug pane to select the launch configuration (specified in .vscode/launch.json). Press F5 to debug. You should be able to set breakpoints and debug as usual.

- -

The current debug configurations are:

- -
    -
  • Debug CLI: Used to debug TSLint using command line arguments. Modify the args array in .vscode/launch.json to add arguments.
  • -
  • Debug Mocha Tests: Runs non-rule tests
  • -
  • Debug Rule Tests: Runs rule tests (under test/rules)
  • -
  • Debug Document Generation: Debug the scripts/buildDocs.ts script.
  • -
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-formatters/index.html b/docs/_site/develop/custom-formatters/index.html deleted file mode 100644 index d91b99b9aff..00000000000 --- a/docs/_site/develop/custom-formatters/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Custom Formatters - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Custom Formatters

-

-
- - -

Just like custom rules, additional formatters can also be supplied to TSLint via --formatters-dir on the CLI or formattersDirectory option on the library or grunt-tslint. Writing a new formatter is simpler than writing a new rule, as shown in the JSON formatter’s code.

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Formatter extends Lint.Formatters.AbstractFormatter {
-    public format(failures: Lint.RuleFailure[]): string {
-        var failuresJSON = failures.map((failure: Lint.RuleFailure) => failure.toJson());
-        return JSON.stringify(failuresJSON);
-    }
-}
-
- -

Such custom formatters can also be written in Javascript. Additionally, formatter files are always named with the suffix Formatter, and referenced from TSLint without its suffix.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/index.html b/docs/_site/develop/custom-rules/index.html deleted file mode 100644 index 41b32272a14..00000000000 --- a/docs/_site/develop/custom-rules/index.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - Developing TSLint rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Developing TSLint rules

-

-
- - -

TSLint ships with a set of core rules that can be configured. However, users are also allowed to write their own rules, which allows them to enforce specific behavior not covered by the core of TSLint. TSLint’s internal rules are itself written to be pluggable, so adding a new rule is as simple as creating a new rule file named by convention. New rules can be written in either TypeScript or JavaScript; if written in TypeScript, the code must be compiled to JavaScript before invoking TSLint.

- -

Let us take the example of how to write a new rule to forbid all import statements (you know, for science). Let us name the rule file noImportsRule.ts. Rules are referenced in tslint.json with their kebab-cased identifer, so "no-imports": true would configure the rule.

- -

Important conventions:

- -
    -
  • Rule identifiers are always kebab-cased.
  • -
  • Rule files are always camel-cased (camelCasedRule.ts).
  • -
  • Rule files must contain the suffix Rule.
  • -
  • The exported class must always be named Rule and extend from Lint.Rules.AbstractRule.
  • -
- -

Now, let us first write the rule in TypeScript:

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "import statement forbidden";
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        return this.applyWithWalker(new NoImportsWalker(sourceFile, this.getOptions()));
-    }
-}
-
-// The walker takes care of all the work.
-class NoImportsWalker extends Lint.RuleWalker {
-    public visitImportDeclaration(node: ts.ImportDeclaration) {
-        // create a failure at the current position
-        this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
-
-        // call the base version of this visitor to actually parse this node
-        super.visitImportDeclaration(node);
-    }
-}
-
- -

Given a walker, TypeScript’s parser visits the AST using the visitor pattern. So the rule walkers only need to override the appropriate visitor methods to enforce its checks. For reference, the base walker can be found in syntaxWalker.ts. To see what your Typescript file or snippet looks like as an AST, visit astexplorer.net (note: current version of TypeScript may not be supported, yet).

- -

We still need to hook up this new rule to TSLint. First make sure to compile noImportsRule.ts:

- -
tsc noImportsRule.ts
-
- -

Then, if using the CLI, provide the directory that contains this rule as an option to --rules-dir. If using TSLint as a library or via grunt-tslint, the options hash must contain "rulesDirectory": "...". If you run the linter, you’ll see that we have now successfully banned all import statements via TSLint!

- -

Finally, add a line to your tslint.json config file for each of your custom rules.

- -
- -

Now that you’re written a rule to detect problems, let’s modify it to fix them.

- -

Instantiate a Fix object and pass it in as an argument to addFailure. This snippet replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const fix = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-
-// create a failure at the current position
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
-
-

Final notes:

- -
    -
  • Core rules cannot be overwritten with a custom implementation.
  • -
  • Custom rules can also take in options just like core rules (retrieved via this.getOptions()).
  • -
  • As of TSLint v5.7.0 you no longer need to compile your custom rules before using them. You need to tell node.js how to load .ts files for example by using ts-node:
  • -
- -
ts-node node_modules/.bin/tslint <your options>
-# or
-node -r ts-node/register node_modules/.bin/tslint <your options>
-# or
-NODE_OPTIONS="-r ts-node/register" tslint <your options>
-
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/performance-tips.html b/docs/_site/develop/custom-rules/performance-tips.html deleted file mode 100644 index 82660c2df98..00000000000 --- a/docs/_site/develop/custom-rules/performance-tips.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - - TSLint performance tips - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint performance tips

-

-
- - -

As TSLint has matured, we have developed some best practices for making rules run faster. TSLint 5.0 was a particularly -significant release that featured many performance enhancements using the below tips (some codebases experienced lint times -cut in half).

- -

Use the TypeChecker only when needed

- -

The TypeChecker is a really mighty tool, but that comes with a cost. To create a TypeChecker the Program first has to locate, read, parse and bind all SourceFiles referenced. -To avoid that cost, try to avoid the TypeChecker where possible.

- -

If you are interested in the JSDoc of a function for example, you could ask the TypeChecker. -But there’s another way: call .getChildren() on the FunctionDeclaration and search for nodes of kind ts.SyntaxKind.JSDocComment. -Those nodes will precede other nodes in the array.

- -

Avoid walking the AST if possible

- -

Some rules work directly on the content of the source file.

- -

For example, max-file-line-count and linebreak-style don’t need to walk the AST at all.

- -

Other rules define exceptions: no-consecutive-blank-lines ignores template strings. -To optimize for the best case, this rule can first look for failures in the source. -If and only if there are any failures, walk the AST to find the location of all template strings to filter the failures.

- -

Implement your own walking algorithm

- -

Convenience comes with a price. When using SyntaxWalker or any subclass thereof like RuleWalker you pay the price for the -big switch statement in visitNode which then calls the appropriate visitXXX method for every node in the AST, even if you don’t use them.

- -

Use AbstractWalker instead and implement the walk method to fit the needs of your rule. -It’s as simple as this:

- -
class MyWalker extends Lint.AbstractWalker<MyOptionsType> {
-    public walk(sourceFile: ts.SourceFile) {
-        const cb = (node: ts.Node): void => {
-            if (someCondition) {
-                // do stuff
-            }
-            // Wondering why return is used below? Refer to "Make use of tail calls"
-            return ts.forEachChild(node, cb); // recurse deeper
-        };
-        return ts.forEachChild(sourceFile, cb); // start recursion with children of sourceFile
-    }
-
- -

Don’t walk the whole AST if possible

- -

The language specification is your friend: -The language spec defines where each statement can occur. -For example, if you are interested in import statements, you only need to search in sourceFile.statements and nested NamespaceDeclarations.

- -

Don’t visit AST branches you’re not interested in: -For example, no-null-keyword creates no failure if the null keyword is part of another type. -There are two ways to achieve this:

- -
    -
  • Recurse into the AST until you find a token of kind NullKeyword and then walk up its parent chain to find out if it is part of a type node.
  • -
  • Stop recursing deeper into that branch as soon as you hit a type node (preferred).
  • -
- -

Avoid frequently creating one-time closures in the hot path

-
class SomeClass {
-    // this is a simplified version of what SyntaxWalker does under the hood
-    doStuff(node: ts.Node) {
-        // do stuff ...
-
-        ts.forEachChild(node, (n) => this.doStuff(n));
-                           // ~~~~~~~~~~~~~~~~~~~~~~ [a new closure is created for EVERY node in the AST and remains on the call stack
-                           //                         until processing of all children is done]
-    }
-}
-
- -

Instead use the same closure for every call like the example above in Implement your own walking algorithm.

- -

Create small specialized functions / methods

- -

Instead of stuffing the whole logic in a single closure, consider splitting it up into smaller functions or methods. -Each function should handle similar kinds of nodes. Don’t worry too much about the function call, since V8 eventually inlines the function -if possible.

- -

The AST nodes have different properties, therefore they have a different hidden class in V8. A function can only be optimized for a certain -amount of different hidden classes. Above that threshold the function will be deoptimized and is never optimized again.

- -

Supply the optional sourceFile parameter

- -

There are serveral methods that have an optional parameter sourceFile. Don’t omit this parameter if you care for performance. -If ommitted, typescript needs to walk up the node’s parent chain until it reaches the SourceFile. This can be quite costly when done -frequently on deeply nested nodes.

- -

Some examples:

- -
    -
  • node.getStart()
  • -
  • node.getWidth()
  • -
  • node.getText()
  • -
  • node.getChildren()
  • -
  • node.getFirstToken()
  • -
  • node.getLeadingTriviaWidth()
  • -
- -

Avoid excessive calls to node.getStart(), node.getWidth() and node.getText()

- -

node.getStart() scans the source to skip all the leading trivia. Although barely noticeable, this operation is not for free. -If you need the start position of a node more than once per function, consider caching it.

- -

node.getWidth() is most of the time used together with node.getStart() to get the node’s span. Internally it uses node.getEnd() - node.getStart() which effectively doubles the calls to node.getStart(). Consider using node.getEnd() instead and calculate the width yourself if necessary.

- -

node.getText() calculates the start of the node and returns a substring until the end of the token. -Most of the time this not needed, because this substring is already contained in the node.

- -
declare node: ts.Identifier;
-node.getText() === node.text; // prefer node.text where available
-
- -

Bonus points: If you know the width of the node (either from the text property or because it is a keyword of known width), -you can use node.getEnd() - width to calculate the node’s start. -node.getEnd() is effectively for free as it only returns the end property. This way you avoid the cost of skipping leading trivia.

- -

Make use of tail calls

- -

Tail calls are function or method calls at the end of the control flow of a function. It’s only a tail call if the return value of that call -is directly returned unchanged. Browsers can optimize this pattern for performance. -Further optimization is specced in ES2015 as “Proper Tail Calls”. -With proper tail calls the browser reuses the stack frame of the current function. When done right this allows for infinite recursion.

- -
function foo() {
-    if (condition)
-        return bar(); // tail call
-    if (someOtherCondition)
-        return foo() + 1; // no tail call, return value is modified
-    return baz(); // tail call
-}
-
-function bas() {
-    if (cond)
-        return someGlobalVariable = bar(); // no tail call, return value is stored in value before it is returned
-    foo(); // no tail call because there is no return
-}
-
- -

Typeguards

- -

Typeguard functions are very small by default. These functions will be inlined into the containing function. -After inlining you no longer pay the cost of the function call.

- -

But beware of the inlining limit. If a function is big enough or already has many inlined functions, V8 will stop inlining other functions.

- -

Try to use a discriminated union if possible. A typeguard makes sense if you can save up multiple type assertions.

- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/custom-rules/walker-design.html b/docs/_site/develop/custom-rules/walker-design.html deleted file mode 100644 index bb02ca8fb15..00000000000 --- a/docs/_site/develop/custom-rules/walker-design.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - Designing rule walkers - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Designing rule walkers

-

-
- - -

Using WalkContext and applyWithFunction

- -

If you have a rule with a pretty simple implementation, you don’t need to declare a class which extends the Walker class. Instead, you can define a callback function that accepts following argument:

- -
    -
  • ctx: WalkContext<T>: An object containing rule information, an object options: T containing the parsed rule arguments, the ts.sourceFile object, and functions for adding failures
  • -
- -

Use this callback as an argument to applyWithFunction. You can also pass your parsed rule arguments as optional 3rd parameter.

- -

Let’s look at no-null-keyword as an example:

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "Use 'undefined' instead of 'null'";
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        // Call `applyWithFunction` with your callback function, `walk`.
-        // This creates a `WalkContext<T>` and passes it in as an argument.
-        // An optional 3rd parameter allows you to pass in a parsed version of `this.ruleArguments`. If used, it is not recommended to
-        //     simply pass in `this.getOptions()`, but to parse it into a more useful object instead.
-        return this.applyWithFunction(sourceFile, walk);
-    }
-}
-
-// Here, the options object type is `void` because we don't pass any options in this example.
-function walk(ctx: Lint.WalkContext<void>) {
-    // Recursively walk the AST starting with root node, `ctx.sourceFile`.
-    // Call the function `cb` (defined below) for each child.
-    return ts.forEachChild(ctx.sourceFile, cb);
-    
-    function cb(node: ts.Node): void {
-        // Stop recursing further into the AST by returning early. Here, we ignore type nodes.
-        if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) {
-            return;
-        }
-        
-        // Add failures using the `WalkContext<T>` object. Here, we add a failure if we find the null keyword.
-        if (node.kind === ts.SyntaxKind.NullKeyword) {
-            return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
-        }
-        
-        // Continue recursion into the AST by calling function `cb` for every child of the current node.
-        return ts.forEachChild(node, cb);
-    }
-}
-
- -

Using AbstractWalker

- -

If your rule implementation is a bit more involved than the above example, you can also implement it as a class. -Simply extend AbstractWalker<T> and implement the walk method.

- -
import * as ts from "typescript";
-import * as Lint from "tslint";
-
-export class Rule extends Lint.Rules.AbstractRule {
-    public static FAILURE_STRING = "'magic numbers' are not allowed";
-
-    public static ALLOWED_NODES = new Set<ts.SyntaxKind>([
-        ...
-    ]);
-
-    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
-        // We convert the `ruleArguments` into a useful format before passing it to the constructor of AbstractWalker.
-        return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String))));
-    }
-}
-
-// The type parameter of AbstractWalker corresponds to the third constructor parameter.
-class NoMagicNumbersWalker extends Lint.AbstractWalker<Set<string>> {
-    public walk(sourceFile: ts.SourceFile) {
-        const cb = (node: ts.Node): void => {
-            // Finds specific node types and do checking.
-            if (node.kind === ts.SyntaxKind.NumericLiteral) {
-                this.checkNumericLiteral(node, (node as ts.NumericLiteral).text);
-            } else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression &&
-                       (node as ts.PrefixUnaryExpression).operator === ts.SyntaxKind.MinusToken) {
-                this.checkNumericLiteral(node, "-" + ((node as ts.PrefixUnaryExpression).operand as ts.NumericLiteral).text);
-            } else {
-                // Continue rescursion: call function `cb` for all children of the current node.
-                return ts.forEachChild(node, cb);
-            }
-        };
-        
-        // Start recursion for all children of `sourceFile`.
-        return ts.forEachChild(sourceFile, cb);
-    }
-
-    private checkNumericLiteral(node: ts.Node, num: string) {
-        // `this.options` is the third constructor parameter from above (the Set we created in `Rule.apply`)
-        if (!Rule.ALLOWED_NODES.has(node.parent!.kind) && !this.options.has(num)) {
-            // Add failures to the Walker.
-            this.addFailureAtNode(node, Rule.FAILURE_STRING);
-        }
-    }
-}
-
- -

Migrating from RuleWalker to AbstractWalker

- -

The main difference between RuleWalker and AbstractWalker is that you need to implement the AST recursion yourself. But why would you want to do that? -Performance! RuleWalker wants to be “one walker to rule them all” (pun intended). It’s easy to use but that convenience -makes it slow by default. When implementing the walking yourself, you only need to do as much work as needed.

- -

Besides that you should convert the ruleArguments to a useful format before passing it to AbstractWalker as seen above.

- -

This table describes the equivalent methods between the two classes:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RuleWalkerAbstractWalker
this.createFailure() and this.addFailure()this.addFailureAt()
this.addFailureFromStartToEnd()this.addFailure()
this.createReplacement()new Lint.Replacement()
this.deleteText()Lint.Replacement.deleteText()
this.deleteFromTo()Lint.Replacement.deleteFromTo()
this.appendText()Lint.Replacement.appendText()
this.hasOption() and this.getOptions()use this.options directly
this.getLineAndCharacterOfPosition()ts.getLineAndCharacterOfPosition(this.sourceFile, ...)
this.getLimit()this.sourceFile.end
this.getSourceFile()is available to be compatible, but prefer this.sourceFile
this.getFailures()is available to be compatible, but prefer this.failures
this.skip()just don’t use it, it’s a noop
this.getRuleName()this.ruleName
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/docs/index.html b/docs/_site/develop/docs/index.html deleted file mode 100644 index 5d03263cfc0..00000000000 --- a/docs/_site/develop/docs/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Docs Development - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Docs Development

-

-
- - -

This docs site is a Jekyll site hosted on GitHub pages. -It is maintained in the /docs directory of TSLint. -To contribute to the docs, whether it be better styling, functionality, or content, just create a PR as you would for any code contribution.

- -

Updating Rule Documentation

-

The documentation for rules is automatically generated from the metadata supplied by each rule in its corresponding .ts file. -If you’d like to help improve documentation for them, simply file a PR improving a rule’s metadata and a project collaborator will take care of regenerating the docs site once your PR is merged.

- -

Running the npm run docs command will regenerate the rules docs based off of the metadata provided in the code. This is normally done each release so that the public docs site is up to date with the latest release.

- -

Creating New Pages

-

To create a new page, follow the pattern of existing pages. You’ll also need to add appropriate metadata in the _data/*_sidebar.json data file if you want it to show up in a sidebar.

- -

Creating News Posts

-

To create a new news post, simply add a new markdown file to the _posts directory, following the same pattern as existing ones.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/develop/testing-rules/index.html b/docs/_site/develop/testing-rules/index.html deleted file mode 100644 index bece43db06c..00000000000 --- a/docs/_site/develop/testing-rules/index.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - Testing Rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Testing Rules

-

-
- - -

Every TSLint rule has a corresponding directory inside test/rules/ which contains one or more test cases for the rule.

- -

Each test case contains:

- -
    -
  • A tslint.json file which specifies the configuration for TSLint to use
  • -
  • .ts.lint test files which contain TypeScript code and a special markup which indicate where lint failures should be found
  • -
- -

The test system lints the .ts.lint files with the settings specified in tslint.json and makes sure that failures generated by the TSLint match the failures marked in the .ts.lint files.

- -

Example

- -
Testing a New Rule
- -

Say we’re contributing a new rule to TSLint that bans the use of animal variable names and we now need to test it. First we create our configuration file which enables only the rule to be tested:

- -

test/rules/no-animal-variable-names/default/tslint.json:

- -
{
-  "rules": {
-    "no-animal-variable-names": true
-  }
-}
-
- -

In this case, we placed our configuration inside no-animal-variable-names/default to indicate that we’re testing the default configuration for our rule.

- -

Now let’s make the actual test file:

- -

test/rules/no-animal-variable-names/default/test.ts.lint:

- -
const octopus = 5;
-      ~~~~~~~      [Variables named after animals are not allowed!]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [Variables named after animals are not allowed!]
-                     ~~~~~  [Variables named after animals are not allowed!]
-
-const tree = 5;
-const skyscraper = 100;
-
- -

In the above file, ~ characters “underline” where our rule should generate a lint failure -and the message that should be produced appears in brackets afterwards.

- -

If multiple lint failures occur on the same line of TypeScript code, the markup for them is placed on consecutive lines, -as shown in the above example with the line let giraffe: number, tiger: number;

- -

Notice how we also include lines of code that shouldn’t generate lint failures. -This is important to ensure that the rule isn’t creating false-positives.

- -

We can now run yarn compile:test && yarn test:rules to make sure that our rule produces the output we expect.

- -
Testing a New Rule Option
- -

Let’s look at one more example. Say we’ve added an also-no-plants option to our rule above that disallows variable names that are plants. We should add a test for this new option:

- -

test/rules/no-animal-variable-names/also-no-plants/tslint.json:

- -
{
-  "rules": {
-    "no-animal-variable-names": [true, "also-no-plants"]
-  }
-}
-
- -

test/rules/no-animal-variable-names/also-no-plants/test.ts.lint:

- -
const octopus = 5;
-      ~~~~~~~     [no-animal]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal]
-                     ~~~~~  [no-animal]
-
-const tree = 5;
-      ~~~~      [no-plant]
-const skyscraper = 100;
-
-[no-animal]: Variables named after animals are not allowed!
-[no-plant]: Variables named after plants are not allowed!
-
- -

We’ve now used a special message shorthand syntax so we don’t have to type out the same failure message over and over. -Instead of writing out the full lint failure message after each occurance of it, we instead just specify a shortcut name. -(Shortcut names can only consist of letters, numbers, underscores, and hyphens.) -Then, at the bottom of our test file, we specify what full message each shortcut should expand to.

- -

Again, we can run yarn compile:test && yarn test:rules to make sure our rule is producing the output we expect. If it isn’t we’ll see the difference between the output from the rule and the output we marked.

- -

You can also use placeholders to format messages. That’s useful if the error message contains non-static parts, e.g. variable names. But let’s stick to the above example for now.

- -
const octopus = 5;
-      ~~~~~~~     [no-animal]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal]
-                     ~~~~~  [no-animal]
-
-const tree = 5;
-      ~~~~      [error % ("plants")]
-const skyscraper = 100;
-
-[error] Variables named after %s are not allowed!
-[no-animal]: error % ('animals')
-
- -

We created a message template called error which has one placeholder %s. For a complete list of supported placeholders, please refer to the documentation of node’s util.format(). -To use the template for formatting, you need to use a special syntax: template_name % ('substitution1' [, "substitution2" [, ...]]). -Substitutions are passed as comma separated list of javascript string literals. The strings need to be wrapped in single or double quotes. Escaping characters works like you would expect in javascript.

- -

You may have noticed that the template is used for formatting in two different places. Use it in inline errors to pass another substitution every time. -If you use formatting in another message shorthand (like we did for [no-animal]), you need to make sure the template is defined before its use. That means swapping the lines of [error] and [no-animal] will not work. There are no restrictions for the use of [no-animal] in inline errors, though.

- -

Now let’s pretend the rule changed its error message to include the variable name at the end. The following example shows how to substitute multiple placeholders.

- -
const octopus = 5;
-      ~~~~~~~     [no-animal % ('octopus')]
-
-let giraffe: number, tiger: number;
-    ~~~~~~~                 [no-animal % ('giraffe')]
-                     ~~~~~  [no-animal % ('tiger')]
-
-const tree = 5;
-      ~~~~      [error % ("plants", "tree")]
-const skyscraper = 100;
-
-[error] Variables named after %s are not allowed: '%s'
-[no-animal]: error % ('animals')
-
- -
Typescript version requirement
- -

Sometimes a rule requires a minimum version of the typescript compiler or your test contains syntax that older versions of the typescript parser cannot handle. -When testing with multiple versions of typescript - like tslint does in CI - those tests will fail.

- -

To avoid failing tests, each test file can specify a version requirement for typescript in the first line. If you don’t specify one, the test will always be executed.

- -

Example:

-
[typescript]: >= 2.1.0
-
- -

The syntax should look familiar, because it is basically the shorthand syntax from the chapter above. It needs to start with [typescript]:. -The following part can be any version range. The prerelease suffix will be removed before matching to allow testing with nightly builds.

- -

Tips & Tricks

- -
    -
  • -

    You can use this system to test rules outside of the TSLint build! Use the tslint --test path/to/dir command to test your own custom rules. -You can specify one or more paths to tslint.json files or directories containing a tslint.json. Glob patterns are also supported. -Besides the tslint.json each directory you pass should contain *.ts.lint files. You can try this out on the TSLint rule test cases, for example, tslint --test path/to/tslint-code/test/rules/quotemark/single. -If you want to test all of your rules at once, you can use it like this: tslint --test rules/test/**/tslint.json

    -
  • -
  • -

    To test rules that need type information, you can simply add a tsconfig.json with the desired configuration next to tslint.json.

    -
  • -
  • -

    Lint failures sometimes span over multiple lines. To handle this case, don’t specify a message until the end of the error. For example:

    -
  • -
- -
for (let key in obj) {
-~~~~~~~~~~~~~~~~~~~~~~
-  console.log(key);
-~~~~~~~~~~~~~~~~~~~
-}
-~ [for-in loops are not allowed]
-
- -
    -
  • If for some reason your lint rule generates a failure that has zero width, you can use the ~nil mark to indicate this.
  • -
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/feed.xml b/docs/_site/feed.xml deleted file mode 100644 index 4509afb3a2e..00000000000 --- a/docs/_site/feed.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - TSLint - TSLint documentation. A linter for the TypeScript language. - - http://localhost:4000/tslint/ - - Fri, 13 Apr 2018 07:56:05 -0400 - Fri, 13 Apr 2018 07:56:05 -0400 - Jekyll v3.6.2 - - - TSLint 4.0 Released - <p>TSLint 4.0 has been released! With this release comes a few exciting <a href="https://github.com/palantir/tslint/releases">changes</a>. Some of the highlights:</p> - -<ul> - <li><strong>Fixers</strong>. Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we’ll fix them for you. To use this feature, run <code class="highlighter-rouge">tslint</code> with the <code class="highlighter-rouge">--fix</code> option. Rules that support the <code class="highlighter-rouge">--fix</code> feature: - <ul> - <li><a href="/tslint/rules/array-type">array-type</a></li> - <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> - <li><a href="/tslint/rules/no-unused-variable">no-unused-variable</a> (for imports)</li> - <li><a href="/tslint/rules/no-var-keyword">no-var-keyword</a></li> - <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> - <li><a href="/tslint/rules/semicolon">semicolon</a></li> - <li><a href="/tslint/rules/trailing-comma">trailing-comma</a></li> - </ul> - </li> - <li> - <p><strong>Linting <code class="highlighter-rouge">.js</code> files</strong>. <em>A much-requested feature from our community</em>. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a <code class="highlighter-rouge">jsRules</code> <a href="https://raw.githubusercontent.com/palantir/tslint/master/src/configs/recommended.ts">section</a> to your <code class="highlighter-rouge">tslint.json</code> file, and TSLint will lint your JavaScript files.</p> - </li> - <li><strong>TypeScript 2.0+ required</strong>. This lets us deprecate/remove rules that are checked by the compiler. Problematic code that once violated these rules now cause compilation errors in <code class="highlighter-rouge">tsc</code>: - <ul> - <li>no-duplicate-key</li> - <li>no-unreachable</li> - <li>no-unused-variable</li> - </ul> - </li> - <li> - <p><strong>Node.js API Change</strong>. <a href="https://github.com/palantir/tslint/pull/1720">Moved and renamed</a> some things to make more sense. Get it all when you use <code class="highlighter-rouge">import * as TSLint from "tslint"</code>.</p> - </li> - <li><strong><a href="https://github.com/palantir/tslint/pull/1717/files#diff-6e3940e8ec3d59837c4435f32975ed2c">Recommended Rules Updated</a></strong> - <ul> - <li><a href="/tslint/rules/adjacent-overload-signatures">adjacent-overload-signatures</a></li> - <li><a href="/tslint/rules/array-type">array-type</a></li> - <li><a href="/tslint/rules/arrow-parens">arrow-parens</a></li> - <li><a href="/tslint/rules/max-classes-per-file">max-classes-per-file</a></li> - <li><a href="/tslint/rules/no-unsafe-finally">no-unsafe-finally</a></li> - <li><a href="/tslint/rules/object-literal-key-quotes">object-literal-key-quotes</a> (as needed)</li> - <li><a href="/tslint/rules/object-literal-shorthand">object-literal-shorthand</a></li> - <li><a href="/tslint/rules/only-arrow-functions">only-arrow-functions</a></li> - <li><a href="/tslint/rules/ordered-imports">ordered-imports</a></li> - <li><a href="/tslint/rules/prefer-for-of">prefer-for-of</a></li> - </ul> - </li> - <li><strong>Other rules you might find handy</strong>: - <ul> - <li><a href="/tslint/rules/completed-docs">completed-docs</a></li> - <li><a href="/tslint/rules/cyclomatic-complexity">cyclomatic-complexity</a></li> - </ul> - </li> -</ul> - -<hr /> - -<h2 id="create-your-own-fixer">Create your own fixer</h2> -<p>To create your own fixer, instantiate a <code class="highlighter-rouge">Fix</code> object and pass it in as an argument to <code class="highlighter-rouge">addFailure</code>.</p> - -<p>This snippet updates the <a href="/tslint/develop/custom-rules">sample custom rule</a> by adding a fixer which replaces the offending import statement with an empty string:</p> - -<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// create a fixer for this failure</span> -<span class="kd">const</span> <span class="nx">replacement</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Replacement</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="s2">""</span><span class="p">);</span> -<span class="kd">const</span> <span class="nx">fix</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Lint</span><span class="p">.</span><span class="nx">Fix</span><span class="p">(</span><span class="s2">"no-imports"</span><span class="p">,</span> <span class="p">[</span><span class="nx">replacement</span><span class="p">]);</span> - -<span class="k">this</span><span class="p">.</span><span class="nx">addFailure</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">createFailure</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">getStart</span><span class="p">(),</span> <span class="nx">node</span><span class="p">.</span><span class="nx">getWidth</span><span class="p">(),</span> <span class="nx">Rule</span><span class="p">.</span><span class="nx">FAILURE_STRING</span><span class="p">,</span> <span class="nx">fix</span><span class="p">));</span> -</code></pre></div></div> - - - Thu, 17 Nov 2016 10:19:00 -0500 - http://localhost:4000/tslint/2016/11/17/new-for-4.0.html - http://localhost:4000/tslint/2016/11/17/new-for-4.0.html - - - - - - Sharable Configurations and Rules - <p>With the release of <a href="https://github.com/palantir/tslint/releases">TSLint v3.7.0</a> comes a few new features that will make configuration files (aka <a href="/tslint/usage/tslint-json"><code class="highlighter-rouge">tslint.json</code> files</a>) -easier to maintain and share. The crux of the changes is a new <code class="highlighter-rouge">extends</code> field, which when provided indicates that a configuration -file augments another configuration file.</p> - -<h3 id="example">Example</h3> - -<p>Let’s imagine you’ve created some custom rules and want to share them with others. -You also have a couple of configurations for them you want to share.</p> - -<p>Here’s the layout of our NPM package, which we’ll call <code class="highlighter-rouge">shared-tslint-rules</code>. We have a directory with rules, -as well as a few different config files for TSLint.</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>shared-tslint-rules -├── package.json -├── rules -│   ├── noAdditionRule.js -│   ├── noErrorsRule.js -│   └── noExcessiveCommentingRule.js -├── tslint-base.json -├── tslint-config.json -└── tslint-crazy-config.js -</code></pre></div></div> - -<p>Our starting-point config file just references the directory the custom rules are in -but doesn’t enable any of them:</p> - -<p><strong>tslint-base.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"rulesDirectory"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./rules"</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>We also want to provide a sane default config for our rules. -Notice how it extends our base config, so we don’t have to redeclare <code class="highlighter-rouge">rulesDirectory</code> here:</p> - -<p><strong>tslint-config.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"extends"</span><span class="p">:</span><span class="w"> </span><span class="s2">"./tslint-base.json"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"rules"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> - </span><span class="s2">"no-errors"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> - </span><span class="s2">"no-addition"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> - </span><span class="p">}</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>Finally, we can even make a crazy config file for fun that gives you back a different config -each time you run TSLint. Notice how this is a <code class="highlighter-rouge">.js</code> file that exports an object:</p> - -<p><strong>tslint-crazy-config.js</strong></p> - -<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">{</span> - <span class="na">extends</span><span class="p">:</span> <span class="s2">"./tslint-base.json"</span><span class="p">,</span> - <span class="na">rules</span><span class="p">:</span> <span class="p">{</span> - <span class="s2">"no-excessive-commenting"</span><span class="p">:</span> <span class="p">[</span><span class="kc">true</span><span class="p">,</span> <span class="p">{</span><span class="na">maxComments</span><span class="p">:</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="mi">10</span><span class="p">}]</span> - <span class="p">}</span> -<span class="p">};</span> -</code></pre></div></div> - -<p>Finally, we have our <code class="highlighter-rouge">package.json</code> file which references our base config file through its <code class="highlighter-rouge">main</code> field:</p> - -<p><strong>package.json</strong>:</p> - -<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> - </span><span class="s2">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"shared-tslint-rules"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Some TSLint rules that are great!"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"main"</span><span class="p">:</span><span class="w"> </span><span class="s2">"tslint-base.json"</span><span class="p">,</span><span class="w"> - </span><span class="s2">"scripts"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> - </span><span class="s2">"test"</span><span class="p">:</span><span class="w"> </span><span class="s2">"echo </span><span class="se">\"</span><span class="s2">Error: no test specified</span><span class="se">\"</span><span class="s2"> &amp;&amp; exit 1"</span><span class="w"> - </span><span class="p">},</span><span class="w"> - </span><span class="s2">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> - </span><span class="s2">"license"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MIT"</span><span class="w"> -</span><span class="p">}</span><span class="w"> -</span></code></pre></div></div> - -<p>We can publish our package on NPM to let the world use it!</p> - -<hr /> - -<p>Now let’s say we’re a user, and we want to use the custom rules above to lint our code. -First, we’ll make sure we have the necessary npm packages installed:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install -g tslint shared-tslint-rules -</code></pre></div></div> - -<p>Then, in our <code class="highlighter-rouge">tslint.json</code> file for our project, we can reference the package of custom rules with <code class="highlighter-rouge">extends</code>:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ - "extends": "shared-tslint-rules/tslint-config", - "rules": { - "no-addition": true - } -} -</code></pre></div></div> - -<p>and that’s all we have to do to use the custom rules! -We can now run TSLint as we would normally and see any lint errors produced by the custom rules:</p> - -<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tslint -c path/to/tslint.json my/files/**/to/lint.ts -</code></pre></div></div> - - - Thu, 31 Mar 2016 11:19:00 -0400 - http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html - http://localhost:4000/tslint/2016/03/31/sharable-configurations-rules.html - - - - - - A New TSLint Website - <p>As TSLint has grown in usage and popularity alongside of TypeScript, it also has -evolved in terms of functionality and complexity. Today, all sorts of projects and products, -from <a href="https://angular.io/">Angular 2</a> to the <a href="https://github.com/Microsoft/TypeScript">TypeScript compiler itself</a> use TSLint -to help keep their code high-quality.</p> - -<p>Unfortunately, we’ve done a poor job of scaling the documentation and guides for TSLint as it has grown. -For example, the only good way to see the possible rules TSLint can enforce and what they can do is to scroll through the quite-long <a href="https://github.com/palantir/tslint/blob/409aa6e4aa4b63da11fd61e15b26b0100cf1e845/README.md">TSLint README</a>. -Each rule is accompanied by a short description of its functionality, but nowhere does it explain why the rule is actually useful. -There’s also a short description of the rule’s options, but the syntax for specifying these options is often unclear.</p> - -<p>This website, in its current, very simple form, marks the beginning of a renewed focus on developer and user experience. But it’s just the tip of the iceberg in changes to come - other things in progress include:</p> - -<ul> - <li><a href="https://github.com/palantir/tslint/issues/830">A documentation overhaul</a> that will provide -more comprehensive and clear documentation on TSLint and will make it easier to navigate that documentation.</li> - <li><a href="https://github.com/palantir/tslint/pull/871">A new <code class="highlighter-rouge">--init</code> feature</a> in the TSLint CLI that will make it easier to -generate a sensible initial <code class="highlighter-rouge">tslint.json</code> config file.</li> - <li><a href="https://github.com/palantir/tslint/issues/831">An improved contributor experience</a> that will make things easier for those who want to contribute code to TSLint.</li> -</ul> - -<p>Feedback is always great, so please comment on any of the above GitHub issues and let us know what you would like to see to make TSLint user experience even better!</p> - - - Thu, 10 Dec 2015 15:15:21 -0500 - http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html - http://localhost:4000/tslint/2015/12/10/a-new-tslint-website.html - - - - - - diff --git a/docs/_site/formatters/checkstyle/index.html b/docs/_site/formatters/checkstyle/index.html deleted file mode 100644 index d97cd74a7c6..00000000000 --- a/docs/_site/formatters/checkstyle/index.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - TSLint formatter: checkstyle - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: checkstyle

-

-
- - -

Formats errors as through they were Checkstyle output.

- - - -

Imitates the XMLLogger from Checkstyle 4.3. All failures have the ‘warning’ severity.

- - - -
Sample Output
-
-

<?xml version="1.0" encoding="utf-8"?> -<checkstyle version="4.3"> - <file name="myFile.ts"> - <error line="1" column="14" severity="warning" message="Missing semicolon" source="failure.tslint.semicolon" /> - </file> -</checkstyle>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/codeFrame/index.html b/docs/_site/formatters/codeFrame/index.html deleted file mode 100644 index 646aee20242..00000000000 --- a/docs/_site/formatters/codeFrame/index.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - TSLint formatter: codeFrame - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: codeFrame

-

-
- - -

Framed formatter which creates a frame of error code.

- - - -

Prints syntax highlighted code in a frame with a pointer to where -exactly lint error is happening.

- - - -
Sample Output
-
-

src/components/Payment.tsx -Parentheses are required around the parameters of an arrow function definition (arrow-parens) - 21 | public componentDidMount() { - 22 | this.input.focus(); -> 23 | loadStripe().then(Stripe => Stripe.pay()); - | ^ - 24 | } - 25 | - 26 | public render() {

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/filesList/index.html b/docs/_site/formatters/filesList/index.html deleted file mode 100644 index 7b62038c1bb..00000000000 --- a/docs/_site/formatters/filesList/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - TSLint formatter: filesList - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: filesList

-

-
- - -

Lists files containing lint errors.

- - - -
Sample Output
-

directory/myFile.ts

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/index.html b/docs/_site/formatters/index.html deleted file mode 100644 index 98e0245ee62..00000000000 --- a/docs/_site/formatters/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - TSLint core formatters - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint core formatters

-

-
- - -

Lint formatters allow for transformation of lint results into various forms before outputting to stdout or a file.

- -

Built-in formatters

- -
    -
  • -

    checkstyle - Formats errors as through they were Checkstyle output.

    -
  • -
  • -

    codeFrame - Framed formatter which creates a frame of error code.

    -
  • -
  • -

    filesList - Lists files containing lint errors.

    -
  • -
  • -

    json - Formats errors as simple JSON.

    -
  • -
  • -

    junit - Formats errors as through they were JUnit output.

    -
  • -
  • -

    msbuild - Formats errors for consumption by msbuild.

    -
  • -
  • -

    pmd - Formats errors as through they were PMD output.

    -
  • -
  • -

    prose - The default formatter which outputs simple human-readable messages.

    -
  • -
  • -

    stylish - Human-readable formatter which creates stylish messages.

    -
  • -
  • -

    tap - Formats output as TAP stream.

    -
  • -
  • -

    verbose - The human-readable formatter which includes the rule name in messages.

    -
  • -
  • -

    vso - Formats output as VSO/TFS logging commands.

    -
  • -
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/json/index.html b/docs/_site/formatters/json/index.html deleted file mode 100644 index c78ec762b77..00000000000 --- a/docs/_site/formatters/json/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - TSLint formatter: json - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: json

-

-
- - -

Formats errors as simple JSON.

- - - -
Sample Output
-
-

[ - { - "endPosition": { - "character": 13, - "line": 0, - "position": 13 - }, - "failure": "Missing semicolon", - "fix": { - "innerStart": 13, - "innerLength": 0, - "innerText": ";" - }, - "name": "myFile.ts", - "ruleName": "semicolon", - "startPosition": { - "character": 13, - "line": 0, - "position": 13 - } - } -]

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/junit/index.html b/docs/_site/formatters/junit/index.html deleted file mode 100644 index c250017c108..00000000000 --- a/docs/_site/formatters/junit/index.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - TSLint formatter: junit - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: junit

-

-
- - -

Formats errors as through they were JUnit output.

- - - -

Imitates the JUnit XML Output

- - - -
Sample Output
-
-

<?xml version="1.0" encoding="utf-8"?> -<testsuites package="tslint"> - <testsuite name="myFile.ts"> - <testcase name="Line 1, Column 14: semicolon"> - <failure type="warning">Missing semicolon</failure> - </testcase> - </testsuite> -</testsuites>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/msbuild/index.html b/docs/_site/formatters/msbuild/index.html deleted file mode 100644 index 1fd56587a41..00000000000 --- a/docs/_site/formatters/msbuild/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - TSLint formatter: msbuild - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: msbuild

-

-
- - -

Formats errors for consumption by msbuild.

- - -

The output is compatible with both msbuild and Visual Studio.

- - - -
Sample Output
-

myFile.ts(1,14): warning: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/pmd/index.html b/docs/_site/formatters/pmd/index.html deleted file mode 100644 index 1cbfa0afbd9..00000000000 --- a/docs/_site/formatters/pmd/index.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - TSLint formatter: pmd - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: pmd

-

-
- - -

Formats errors as through they were PMD output.

- - -

Imitates the XML output from PMD. All errors have a priority of 1.

- - - -
Sample Output
-
-

<pmd version="tslint"> - <file name="myFile.ts"> - <violation begincolumn="14" beginline="1" priority="3" rule="Missing semicolon"></violation> - </file> -</pmd>

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/prose/index.html b/docs/_site/formatters/prose/index.html deleted file mode 100644 index 9f2f5064551..00000000000 --- a/docs/_site/formatters/prose/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - TSLint formatter: prose - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: prose

-

-
- - -

The default formatter which outputs simple human-readable messages.

- - - -
Sample Output
-

ERROR: myFile.ts[1, 14]: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/stylish/index.html b/docs/_site/formatters/stylish/index.html deleted file mode 100644 index 2a5a45e35b2..00000000000 --- a/docs/_site/formatters/stylish/index.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - TSLint formatter: stylish - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: stylish

-

-
- - -

Human-readable formatter which creates stylish messages.

- - - -

The output matches what is produced by ESLint’s stylish formatter. -Its readability is enhanced through spacing and colouring.

- - - -
Sample Output
-
-

myFile.ts -1:14 semicolon Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/tap/index.html b/docs/_site/formatters/tap/index.html deleted file mode 100644 index 2d49c37147a..00000000000 --- a/docs/_site/formatters/tap/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - TSLint formatter: tap - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: tap

-

-
- - -

Formats output as TAP stream.

- - -

Provides error messages output in TAP13 format which can be consumed by any TAP formatter.

- - - -
Sample Output
-
-

TAP version 13 -1..1 -not ok 1 - Some error - — - message: Variable has any type - severity: error - data: - ruleName: no-any - fileName: test-file.ts - line: 10 - character: 10 - failureString: Some error - rawLines: Some raw output - …

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/verbose/index.html b/docs/_site/formatters/verbose/index.html deleted file mode 100644 index e4a50b64168..00000000000 --- a/docs/_site/formatters/verbose/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - TSLint formatter: verbose - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: verbose

-

-
- - -

The human-readable formatter which includes the rule name in messages.

- - -

The output is the same as the prose formatter with the rule name included

- - - -
Sample Output
-

ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/formatters/vso/index.html b/docs/_site/formatters/vso/index.html deleted file mode 100644 index 9d75a798dd9..00000000000 --- a/docs/_site/formatters/vso/index.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - TSLint formatter: vso - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint formatter: vso

-

-
- - -

Formats output as VSO/TFS logging commands.

- - - -

Integrates with Visual Studio Online and Team Foundation Server by outputting errors -as ‘warning’ logging commands.

- - - -
Sample Output
-

##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon

-
- - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/index.html b/docs/_site/index.html deleted file mode 100644 index 783c4e542bc..00000000000 --- a/docs/_site/index.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - TSLint - - - - - - - - - - - -
- - - - -
- - -
-

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.

- -

Quick start

- -
# Install the global CLI and its peer dependency
-yarn global add tslint typescript
-
-# Navigate to to your sources folder
-cd path/to/project
-
-# Generate a basic configuration file
-tslint --init
-
-# Lint TypeScript source globs
-tslint -c tslint.json 'src/**/*.ts'
-
- -

Check out the full usage guide to learn more.

- - - - -
- - - - diff --git a/docs/_site/news/index.html b/docs/_site/news/index.html deleted file mode 100644 index 6f757ed92e5..00000000000 --- a/docs/_site/news/index.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - News - - - - - - - - - - - -
- - -
- - -
-
-
- - - -
-

TSLint 4.0 Released

- -
-
-

TSLint 4.0 has been released! With this release comes a few exciting changes. Some of the highlights:

- - - -
- -

Create your own fixer

-

To create your own fixer, instantiate a Fix object and pass it in as an argument to addFailure.

- -

This snippet updates the sample custom rule by adding a fixer which replaces the offending import statement with an empty string:

- -
// create a fixer for this failure
-const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
-const fix = new Lint.Fix("no-imports", [replacement]);
-
-this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
-
- - -
- -
- - -

Also Read...

- - - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/adjacent-overload-signatures/index.html b/docs/_site/rules/adjacent-overload-signatures/index.html deleted file mode 100644 index bac8513a733..00000000000 --- a/docs/_site/rules/adjacent-overload-signatures/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: adjacent-overload-signatures - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: adjacent-overload-signatures

-

-
- - -

Enforces function overloads to be consecutive.

- - - - -
Rationale
-

Improves readability and organization by grouping naturally related items together.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"adjacent-overload-signatures": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/align/index.html b/docs/_site/rules/align/index.html deleted file mode 100644 index 4f02cdd3092..00000000000 --- a/docs/_site/rules/align/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - Rule: align - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: align

-

-
- - -

Enforces vertical alignment.

- - - - -
Rationale
-

Helps maintain a readable, consistent style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "parameters" checks alignment of function parameters.
  • -
  • "arguments" checks alignment of function call arguments.
  • -
  • "statements" checks alignment of statements.
  • -
  • "members" checks alignment of members of classes, interfaces, type literal, object literals and -object destructuring.
  • -
  • "elements" checks alignment of elements of array iterals, array destructuring and tuple types.
  • -
- - -
Config examples
- -
-"align": [true, "parameters", "statements"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "arguments",
-      "elements",
-      "members",
-      "parameters",
-      "statements"
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/array-type/index.html b/docs/_site/rules/array-type/index.html deleted file mode 100644 index d4a3ee2a3bf..00000000000 --- a/docs/_site/rules/array-type/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: array-type - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: array-type

-

-
- - -

Requires using either ‘T[]’ or ‘Array' for arrays.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • "array" enforces use of T[] for all types T.
  • -
  • "generic" enforces use of Array<T> for all types T.
  • -
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
  • -
- - -
Config examples
- -
-"array-type": [true, "array"]
-
- -
-"array-type": [true, "generic"]
-
- -
-"array-type": [true, "array-simple"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "array",
-    "generic",
-    "array-simple"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/arrow-parens/index.html b/docs/_site/rules/arrow-parens/index.html deleted file mode 100644 index d3a3ac56769..00000000000 --- a/docs/_site/rules/arrow-parens/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - Rule: arrow-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: arrow-parens

-

-
- - -

Requires parentheses around the parameters of arrow function definitions.

- - - - -
Rationale
-

Maintains stylistic consistency with other arrow function definitions.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If ban-single-arg-parens is specified, then arrow functions with one parameter -must not have parentheses if removing them is allowed by TypeScript.

- - -
Config examples
- -
-"arrow-parens": true
-
- -
-"arrow-parens": [true, "ban-single-arg-parens"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ban-single-arg-parens"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/arrow-return-shorthand/index.html b/docs/_site/rules/arrow-return-shorthand/index.html deleted file mode 100644 index 6dacef1b99b..00000000000 --- a/docs/_site/rules/arrow-return-shorthand/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: arrow-return-shorthand - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: arrow-return-shorthand

-

-
- - -

Suggests to convert () => { return x; } to () => x.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If multiline is specified, then this will warn even if the function spans multiple lines.

- - -
Config examples
- -
-"arrow-return-shorthand": true
-
- -
-"arrow-return-shorthand": [true, "multiline"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "multiline"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/await-promise/index.html b/docs/_site/rules/await-promise/index.html deleted file mode 100644 index d1a701b8ed7..00000000000 --- a/docs/_site/rules/await-promise/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - Rule: await-promise - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: await-promise

-

-
- - -

Warns for an awaited value that is not a Promise.

- - - - -
Rationale
- -

While it is valid TypeScript to await a non-Promise-like value (it will resolve immediately), -this pattern is often a programmer error and the resulting semantics can be unintuitive.

- - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

A list of ‘string’ names of any additional classes that should also be treated as Promises. -For example, if you are using a class called ‘Future’ that implements the Thenable interface, -you might tell the rule to consider type references with the name ‘Future’ as valid Promise-like -types. Note that this rule doesn’t check for type assignability or compatibility; it just checks -type reference names.

- - - -
Config examples
- -
-"await-promise": true
-
- -
-"await-promise": [true, "Thenable"]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban-comma-operator/index.html b/docs/_site/rules/ban-comma-operator/index.html deleted file mode 100644 index d5d006d0c53..00000000000 --- a/docs/_site/rules/ban-comma-operator/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: ban-comma-operator - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban-comma-operator

-

-
- - -

Disallows the comma operator to be used.

- - -

Read more about the comma operator here.

- - - - -
Rationale
- -

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

- -

Examples

-
foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
-
- -
switch (foo) {
-    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
-        return true;
-    case 3:
-        return false;
-}
-
- -
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
-
- - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- - - -
Config examples
- -
-"ban-comma-operator": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban-types/index.html b/docs/_site/rules/ban-types/index.html deleted file mode 100644 index e59fdf5938f..00000000000 --- a/docs/_site/rules/ban-types/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - Rule: ban-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban-types

-

-
- - - -

Bans specific types from being used. Does not ban the -corresponding runtime objects from being used.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

A list of ["regex", "optional explanation here"], which bans -types that match regex

- - -
Config examples
- -
-"ban-types": [true, ["Object", "Use {} instead."], ["String"]]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    },
-    "minLength": 1,
-    "maxLength": 2
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ban/index.html b/docs/_site/rules/ban/index.html deleted file mode 100644 index e47ac88aa1d..00000000000 --- a/docs/_site/rules/ban/index.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - Rule: ban - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ban

-

-
- - -

Bans the use of specific functions or global methods.

- - - - - - - -

Config

- -

A list of banned functions or methods in the following format:

- -
    -
  • banning functions: -
      -
    • just the name of the function: "functionName"
    • -
    • the name of the function in an array with one element: ["functionName"]
    • -
    • an object in the following format: {"name": "functionName", "message": "optional explanation message"}
    • -
    -
  • -
  • banning methods: -
      -
    • an array with the object name, method name and optional message: ["functionName", "methodName", "optional message"]
    • -
    • an object in the following format: {"name": ["objectName", "methodName"], "message": "optional message"} -
        -
      • you can also ban deeply nested methods: {"name": ["foo", "bar", "baz"]} bans foo.bar.baz()
      • -
      • the first element can contain a wildcard (*) that matches everything. {"name": ["*", "forEach"]} bans [].forEach(...), $(...).forEach(...), arr.forEach(...), etc.
      • -
      -
    • -
    -
  • -
- - -
Config examples
- -
-"ban": [
-  true,
-  "eval",
-  {"name": "$", "message": "please don't"},
-  ["describe", "only"],
-  {"name": ["it", "only"], "message": "don't focus tests"},
-  {
-    "name": ["chai", "assert", "equal"],
-    "message": "Use 'strictEqual' instead."
-  },
-  {"name": ["*", "forEach"], "message": "Use a regular for loop instead."}
-]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "anyOf": [
-      {
-        "type": "string"
-      },
-      {
-        "type": "array",
-        "items": {
-          "type": "string"
-        },
-        "minLength": 1,
-        "maxLength": 3
-      },
-      {
-        "type": "object",
-        "properties": {
-          "name": {
-            "anyOf": [
-              {
-                "type": "string"
-              },
-              {
-                "type": "array",
-                "items": {
-                  "type": "string"
-                },
-                "minLength": 1
-              }
-            ]
-          },
-          "message": {
-            "type": "string"
-          }
-        },
-        "required": [
-          "name"
-        ]
-      }
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/binary-expression-operand-order/index.html b/docs/_site/rules/binary-expression-operand-order/index.html deleted file mode 100644 index c47cfd681c5..00000000000 --- a/docs/_site/rules/binary-expression-operand-order/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: binary-expression-operand-order - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: binary-expression-operand-order

-

-
- - - -

In a binary expression, a literal should always be on the right-hand side if possible. -For example, prefer ‘x + 1’ over ‘1 + x’.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"binary-expression-operand-order": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/callable-types/index.html b/docs/_site/rules/callable-types/index.html deleted file mode 100644 index 939ef40dffe..00000000000 --- a/docs/_site/rules/callable-types/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: callable-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: callable-types

-

-
- - -

An interface or literal type with just a call signature can be written as a function type.

- - - - -
Rationale
-

style

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/class-name/index.html b/docs/_site/rules/class-name/index.html deleted file mode 100644 index a7b3db2ee23..00000000000 --- a/docs/_site/rules/class-name/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: class-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: class-name

-

-
- - -

Enforces PascalCased class and interface names.

- - - - -
Rationale
-

Makes it easy to differentiate classes from regular variables at a glance.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"class-name": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/comment-format/index.html b/docs/_site/rules/comment-format/index.html deleted file mode 100644 index 4b8e4d9bea6..00000000000 --- a/docs/_site/rules/comment-format/index.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - Rule: comment-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: comment-format

-

-
- - -

Enforces formatting rules for single-line comments.

- - - - -
Rationale
-

Helps maintain a consistent, readable style in your codebase.

- - - - - -

Config

- -

Three arguments may be optionally provided:

- -
    -
  • "check-space" requires that all single-line comments must begin with a space, as in // comment -
      -
    • note that for comments starting with multiple slashes, e.g. ///, leading slashes are ignored
    • -
    • TypeScript reference comments are ignored completely
    • -
    -
  • -
  • "check-lowercase" requires that the first non-whitespace character of a comment must be lowercase, if applicable.
  • -
  • "check-uppercase" requires that the first non-whitespace character of a comment must be uppercase, if applicable.
  • -
- -

Exceptions to "check-lowercase" or "check-uppercase" can be managed with object that may be passed as last argument.

- -

One of two options can be provided in this object:

- -
* `"ignore-words"`  - array of strings - words that will be ignored at the beginning of the comment.
-* `"ignore-pattern"` - string - RegExp pattern that will be ignored at the beginning of the comment.
-
- - -
Config examples
- -
-"comment-format": [true, "check-space", "check-uppercase"]
-
- -
-"comment-format": [true, "check-lowercase", {"ignore-words": ["TODO", "HACK"]}]
-
- -
-"comment-format": [true, "check-lowercase", {"ignore-pattern": "STD\\w{2,3}\\b"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "anyOf": [
-      {
-        "type": "string",
-        "enum": [
-          "check-space",
-          "check-lowercase",
-          "check-uppercase"
-        ]
-      },
-      {
-        "type": "object",
-        "properties": {
-          "ignore-words": {
-            "type": "array",
-            "items": {
-              "type": "string"
-            }
-          },
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "minProperties": 1,
-        "maxProperties": 1
-      }
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 4
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/completed-docs/index.html b/docs/_site/rules/completed-docs/index.html deleted file mode 100644 index f2482b31f7b..00000000000 --- a/docs/_site/rules/completed-docs/index.html +++ /dev/null @@ -1,553 +0,0 @@ - - - - - - - - - Rule: completed-docs - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: completed-docs

-

-
- - -

Enforces documentation for important items be filled out.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- -

true to enable for [classes, functions, methods, properties]], -or an array with each item in one of two formats:

- -
    -
  • string to enable for that type
  • -
  • object keying types to when their documentation is required: -
      -
    • "methods" and "properties" may specify: -
        -
      • "privacies": -
          -
        • "all"
        • -
        • "private"
        • -
        • "protected"
        • -
        • "public"
        • -
        -
      • -
      • "locations": -
          -
        • "all"
        • -
        • "instance"
        • -
        • "static"
        • -
        -
      • -
      -
    • -
    • Other types may specify "visibilities": -
        -
      • "all"
      • -
      • "exported"
      • -
      • "internal"
      • -
      -
    • -
    • All types may also provide "tags" -with members specifying tags that allow the docs to not have a body. -
        -
      • "content": Object mapping tags to RegExp bodies content allowed to count as complete docs.
      • -
      • "existence": Array of tags that must only exist to count as complete docs.
      • -
      -
    • -
    -
  • -
- -

Types that may be enabled are:

- -
    -
  • "classes"
  • -
  • "enums"
  • -
  • "enum-members"
  • -
  • "functions"
  • -
  • "interfaces"
  • -
  • "methods"
  • -
  • "namespaces"
  • -
  • "properties"
  • -
  • "types"
  • -
  • "variables"
  • -
- - -
Config examples
- -
-"completed-docs": true
-
- -
-"completed-docs": [true, "enums", "functions", "methods"]
-
- -
-"completed-docs": [
-  true,
-  {
-    "enums": true,
-    "functions": {"visibilities": ["exported"]},
-    "methods": {"locations": "instance", "privacies": ["public", "protected"]},
-    "tags": {"content": {"see": ["#.*"]}, "existence": ["inheritdoc"]}
-  }
-]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "anyOf": [
-      {
-        "options": [
-          "classes",
-          "enums",
-          "functions",
-          "interfaces",
-          "methods",
-          "namespaces",
-          "properties",
-          "types",
-          "variables"
-        ],
-        "type": "string"
-      },
-      {
-        "type": "object",
-        "properties": {
-          "classes": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "enums": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "enum-members": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "functions": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "interfaces": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "methods": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "locations": {
-                "enum": [
-                  "all",
-                  "instance",
-                  "static"
-                ],
-                "type": "string"
-              },
-              "privacies": {
-                "enum": [
-                  "all",
-                  "private",
-                  "protected",
-                  "public"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "namespaces": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "properties": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "locations": {
-                "enum": [
-                  "all",
-                  "instance",
-                  "static"
-                ],
-                "type": "string"
-              },
-              "privacies": {
-                "enum": [
-                  "all",
-                  "private",
-                  "protected",
-                  "public"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "types": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          },
-          "variables": {
-            "properties": {
-              "tags": {
-                "properties": {
-                  "content": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "object"
-                  },
-                  "existence": {
-                    "items": {
-                      "type": "string"
-                    },
-                    "type": "array"
-                  }
-                }
-              },
-              "visibilities": {
-                "enum": [
-                  "all",
-                  "exported",
-                  "internal"
-                ],
-                "type": "string"
-              }
-            },
-            "type": "object"
-          }
-        }
-      }
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/curly/index.html b/docs/_site/rules/curly/index.html deleted file mode 100644 index 67d2db2083f..00000000000 --- a/docs/_site/rules/curly/index.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - Rule: curly - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: curly

-

-
- - -

Enforces braces for if/for/do/while statements.

- - - - -
Rationale
- -
if (foo === bar)
-    foo++;
-    bar++;
-
- -

In the code above, the author almost certainly meant for both foo++ and bar++ -to be executed only if foo === bar. However, they forgot braces and bar++ will be executed -no matter what. This rule could prevent such a mistake.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following options may be provided:

- -
    -
  • "as-needed" forbids any unnecessary curly braces.
  • -
  • "ignore-same-line" skips checking braces for control-flow statements -that are on one line and start on the same line as their control-flow keyword
  • -
- - - -
Config examples
- -
-"curly": true
-
- -
-"curly": [true, "ignore-same-line"]
-
- -
-"curly": [true, "as-needed"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "as-needed",
-      "ignore-same-line"
-    ]
-  }
-}
-
- - -

Code examples:

- -
-
Require curly braces whenever possible (default)
-
"rules": { "curly": true }
-
- -
Passes
-
-
if (x > 0) {
-    doStuff();
-}
-
- -
- -
Fails
-
-
if (x > 0)
-    doStuff();
-
-if (x > 0) doStuff();
-
- -
- -
- -
-
Make an exception for single-line instances
-
"rules": { "curly": [true, "ignore-same-line"] }
-
- -
Passes
-
-
if (x > 0) doStuff();
-
- -
- -
Fails
-
-
if (x > 0)
-    doStuff()
-
- -
- -
- -
-
Error on unnecessary curly braces
-
"rules": { "curly": [true, "as-needed"] }
-
- -
Passes
-
-
if (x > 0)
-    doStuff();
-
-if (x > 0) {
-    customerUpdates.push(getInfo(customerId));
-    return customerUpdates;
-}
-
- -
- -
Fails
-
-
if (x > 0) {
-    doStuff();
-}
-
- -
- -
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/cyclomatic-complexity/index.html b/docs/_site/rules/cyclomatic-complexity/index.html deleted file mode 100644 index 1d6423fdb9e..00000000000 --- a/docs/_site/rules/cyclomatic-complexity/index.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - Rule: cyclomatic-complexity - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: cyclomatic-complexity

-

-
- - -

Enforces a threshold of cyclomatic complexity.

- - - -

Cyclomatic complexity is assessed for each function of any type. A starting value of 0 -is assigned and this value is then incremented for every statement which can branch the -control flow within the function. The following statements and expressions contribute -to cyclomatic complexity:

-
    -
  • catch
  • -
  • if and ? :
  • -
  • || and && due to short-circuit evaluation
  • -
  • for, for in and for of loops
  • -
  • while and do while loops
  • -
  • case clauses that contain statements
  • -
- - - - -
Rationale
- -

Cyclomatic complexity is a code metric which indicates the level of complexity in a -function. High cyclomatic complexity indicates confusing code which may be prone to -errors or difficult to modify.

- - - - - -

Config

- -

An optional upper limit for cyclomatic complexity can be specified. If no limit option -is provided a default value of 20 will be used.

- - -
Config examples
- -
-"cyclomatic-complexity": true
-
- -
-"cyclomatic-complexity": [true, 20]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/deprecation/index.html b/docs/_site/rules/deprecation/index.html deleted file mode 100644 index 6b290335b9a..00000000000 --- a/docs/_site/rules/deprecation/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: deprecation - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: deprecation

-

-
- - -

Warns when deprecated APIs are used.

- - -

Any usage of an identifier - with the @deprecated JSDoc annotation will trigger a warning. - See http://usejsdoc.org/tags-deprecated.html

- - - - -
Rationale
-

Deprecated APIs should be avoided, and usage updated.

- - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- - - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/encoding/index.html b/docs/_site/rules/encoding/index.html deleted file mode 100644 index d0613e55711..00000000000 --- a/docs/_site/rules/encoding/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: encoding - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: encoding

-

-
- - -

Enforces UTF-8 file encoding.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"encoding": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/eofline/index.html b/docs/_site/rules/eofline/index.html deleted file mode 100644 index 51b2108440c..00000000000 --- a/docs/_site/rules/eofline/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - Rule: eofline - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: eofline

-

-
- - -

Ensures the file ends with a newline.

- - -

Fix for single-line files is not supported.

- - - - -
Rationale
-

It is a standard convention to end files with a newline.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"eofline": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/file-header/index.html b/docs/_site/rules/file-header/index.html deleted file mode 100644 index b4710fc3412..00000000000 --- a/docs/_site/rules/file-header/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: file-header - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: file-header

-

-
- - -

Enforces a certain header comment for all files, matched by a regular expression.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

The first option, which is mandatory, is a regular expression that all headers should match. -The second argument, which is optional, is a string that should be inserted as a header comment -if fixing is enabled and no header that matches the first argument is found.

- - -
Config examples
- -
-"file-header": [true, "Copyright \\d{4}", "Copyright 2017"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string"
-    },
-    {
-      "type": "string"
-    }
-  ],
-  "additionalItems": false,
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/forin/index.html b/docs/_site/rules/forin/index.html deleted file mode 100644 index 1f122885be1..00000000000 --- a/docs/_site/rules/forin/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: forin - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: forin

-

-
- - -

Requires a for ... in statement to be filtered with an if statement.

- - - - -
Rationale
- -
for (let key in someObject) {
-    if (someObject.hasOwnProperty(key)) {
-        // code here
-    }
-}
-
-

Prevents accidental iteration over properties inherited from an object’s prototype. -See MDN’s for...in -documentation for more information about for...in loops.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"forin": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/import-blacklist/index.html b/docs/_site/rules/import-blacklist/index.html deleted file mode 100644 index 7d2743b197b..00000000000 --- a/docs/_site/rules/import-blacklist/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: import-blacklist - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: import-blacklist

-

-
- - - -

Disallows importing the specified modules directly via import and require. -Instead only sub modules may be imported from that module.

- - - - -
Rationale
- -

Some libraries allow importing their submodules instead of the entire module. -This is good practise as it avoids loading unused modules.

- - - - - -

Config

-

A list of blacklisted modules.

- - -
Config examples
- -
-"import-blacklist": true
-
- -
-"import-blacklist": [true, "rxjs", "lodash"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  },
-  "minLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/import-spacing/index.html b/docs/_site/rules/import-spacing/index.html deleted file mode 100644 index 8d712d11753..00000000000 --- a/docs/_site/rules/import-spacing/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: import-spacing - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: import-spacing

-

-
- - -

Ensures proper spacing between import statement keywords

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"import-spacing": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/indent/index.html b/docs/_site/rules/indent/index.html deleted file mode 100644 index b65104e5a91..00000000000 --- a/docs/_site/rules/indent/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - Rule: indent - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: indent

-

-
- - -

Enforces indentation with tabs or spaces.

- - - - -
Rationale
- -

Using only one of tabs or spaces for indentation leads to more consistent editor behavior, -cleaner diffs in version control, and easier programmatic manipulation.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • spaces enforces consistent spaces.
  • -
  • tabs enforces consistent tabs.
  • -
- -

A second optional argument specifies indentation size:

- -
    -
  • 2 enforces 2 space indentation.
  • -
  • 4 enforces 4 space indentation.
  • -
- -

Indentation size is required for auto-fixing, but not for rule checking.

- -

NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

- - -
Config examples
- -
-"indent": [true, "spaces"]
-
- -
-"indent": [true, "spaces", 4]
-
- -
-"indent": [true, "tabs", 2]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string",
-      "enum": [
-        "tabs",
-        "spaces"
-      ]
-    },
-    {
-      "type": "number",
-      "enum": [
-        2,
-        4
-      ]
-    }
-  ],
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/index.html b/docs/_site/rules/index.html deleted file mode 100644 index 1404635d114..00000000000 --- a/docs/_site/rules/index.html +++ /dev/null @@ -1,2129 +0,0 @@ - - - - - - - - - TSLint core rules - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint core rules

-

-
- - -

Lint rules encode logic for syntactic & semantic checks of TypeScript source code.

- -

TypeScript-specific

- -

These rules find errors related to TypeScript features:

- - - -

Functionality

- -

These rules catch common errors in JS programming or otherwise confusing constructs that are prone to producing bugs:

- - - -

Maintainability

- -

These rules make code maintenance easier:

- - - -

Style

- -

These rules enforce consistent style across your codebase:

- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/interface-name/index.html b/docs/_site/rules/interface-name/index.html deleted file mode 100644 index 924f15b4961..00000000000 --- a/docs/_site/rules/interface-name/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - Rule: interface-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: interface-name

-

-
- - -

Requires interface names to begin with a capital ‘I’

- - - - -
Rationale
-

Makes it easy to differentiate interfaces from regular classes at a glance.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

One of the following two options must be provided:

- -
    -
  • "always-prefix" requires interface names to start with an “I”
  • -
  • "never-prefix" requires interface names to not have an “I” prefix
  • -
- - -
Config examples
- -
-"interface-name": [true, "always-prefix"]
-
- -
-"interface-name": [true, "never-prefix"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always-prefix",
-    "never-prefix"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/interface-over-type-literal/index.html b/docs/_site/rules/interface-over-type-literal/index.html deleted file mode 100644 index 68ef94ccc0e..00000000000 --- a/docs/_site/rules/interface-over-type-literal/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: interface-over-type-literal - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: interface-over-type-literal

-

-
- - -

Prefer an interface declaration over a type literal (type T = { ... })

- - - - -
Rationale
-

Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"interface-over-type-literal": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/jsdoc-format/index.html b/docs/_site/rules/jsdoc-format/index.html deleted file mode 100644 index efbb195d859..00000000000 --- a/docs/_site/rules/jsdoc-format/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: jsdoc-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: jsdoc-format

-

-
- - -

Enforces basic format rules for JSDoc comments.

- - - -

The following rules are enforced for JSDoc comments (comments starting with /**):

- -
    -
  • each line contains an asterisk and asterisks must be aligned
  • -
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • -
  • the only characters before the asterisk on each line must be whitespace characters
  • -
  • one line comments must start with /** and end with */
  • -
  • multiline comments don’t allow text after /** in the first line (with option "check-multiline-start")
  • -
- - - - - -
Rationale
-

Helps maintain a consistent, readable style for JSDoc comments.

- - - - - -

Config

- -

You can optionally specify the option "check-multiline-start" to enforce the first line of a -multiline JSDoc comment to be empty.

- - - -
Config examples
- -
-"jsdoc-format": true
-
- -
-"jsdoc-format": [true, "check-multiline-start"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "minItems": 0,
-  "maxItems": 1,
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-multiline-start"
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/label-position/index.html b/docs/_site/rules/label-position/index.html deleted file mode 100644 index e46696204ce..00000000000 --- a/docs/_site/rules/label-position/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: label-position - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: label-position

-

-
- - -

Only allows labels in sensible locations.

- - -

This rule only allows labels to be on do/for/while/switch statements.

- - - - -
Rationale
- -

Labels in JavaScript only can be used in conjunction with break or continue, -constructs meant to be used for loop flow control. While you can theoretically use -labels on any block statement in JS, it is considered poor code structure to do so.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"label-position": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/linebreak-style/index.html b/docs/_site/rules/linebreak-style/index.html deleted file mode 100644 index f597372c0a1..00000000000 --- a/docs/_site/rules/linebreak-style/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: linebreak-style - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: linebreak-style

-

-
- - -

Enforces a consistent linebreak style.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following options must be provided:

- -
    -
  • "LF" requires LF (\n) linebreaks
  • -
  • "CRLF" requires CRLF (\r\n) linebreaks
  • -
- - -
Config examples
- -
-"linebreak-style": [true, "LF"]
-
- -
-"linebreak-style": [true, "CRLF"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "LF",
-    "CRLF"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/match-default-export-name/index.html b/docs/_site/rules/match-default-export-name/index.html deleted file mode 100644 index 4c91ce493c2..00000000000 --- a/docs/_site/rules/match-default-export-name/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: match-default-export-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: match-default-export-name

-

-
- - - -

Requires that a default import have the same name as the declaration it imports. -Does nothing for anonymous default exports.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"match-default-export-name": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-classes-per-file/index.html b/docs/_site/rules/max-classes-per-file/index.html deleted file mode 100644 index 69ab82fb2e0..00000000000 --- a/docs/_site/rules/max-classes-per-file/index.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - Rule: max-classes-per-file - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-classes-per-file

-

-
- - - -

A file may not contain more than the specified number of classes

- - - - -
Rationale
- -

Ensures that files have a single responsibility so that that classes each exist in their own files

- - - - - -

Config

- -

The one required argument is an integer indicating the maximum number of classes that can appear in a -file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions -from the overall class count.

- - -
Config examples
- -
-"max-classes-per-file": [true, 1]
-
- -
-"max-classes-per-file": [true, 5, "exclude-class-expressions"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "number",
-      "minimum": 1
-    },
-    {
-      "type": "string",
-      "enum": [
-        "exclude-class-expressions"
-      ]
-    }
-  ],
-  "additionalItems": false,
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-file-line-count/index.html b/docs/_site/rules/max-file-line-count/index.html deleted file mode 100644 index 562c9284102..00000000000 --- a/docs/_site/rules/max-file-line-count/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: max-file-line-count - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-file-line-count

-

-
- - -

Requires files to remain under a certain number of lines

- - - - -
Rationale
- -

Limiting the number of lines allowed in a file allows files to remain small, -single purpose, and maintainable.

- - - - - -

Config

-

An integer indicating the maximum number of lines.

- - -
Config examples
- -
-"max-file-line-count": [true, 300]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": "1"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/max-line-length/index.html b/docs/_site/rules/max-line-length/index.html deleted file mode 100644 index 2f3b787f5df..00000000000 --- a/docs/_site/rules/max-line-length/index.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - Rule: max-line-length - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: max-line-length

-

-
- - -

Requires lines to be under a certain max length.

- - - - -
Rationale
- -

Limiting the length of a line of code improves code readability. -It also makes comparing code side-by-side easier and improves compatibility with -various editors, IDEs, and diff viewers.

- - - - - -

Config

- -

It can take one argument, which can be any of the following:

-
    -
  • integer indicating maximum length of lines.
  • -
  • object with keys: -
      -
    • limit - number < 0 defining max line length
    • -
    • ignore-pattern - string defining ignore pattern for this rule, being parsed by new RegExp(). -For example: -
        -
      • // pattern will ignore all in-line comments.
      • -
      • ^import pattern will ignore all import statements.
      • -
      • ^export {(.*?)} pattern will ignore all multiple export statements.
      • -
      • class [a-zA-Z] implements pattern will ignore all class declarations implementing interfaces.
      • -
      • ^import |^export {(.*?)}|class [a-zA-Z] implements |// pattern will ignore all the cases listed above.
      • -
      -
    • -
    -
  • -
- - - -
Config examples
- -
-"max-line-length": [true, 120]
-
- -
-"max-line-length": [true, {"limit": 120, "ignore-pattern": "^import |^export {(.*?)}"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "oneOf": [
-      {
-        "type": "number"
-      },
-      {
-        "type": "object",
-        "properties": {
-          "limit": {
-            "type": "number"
-          },
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "additionalProperties": false
-      }
-    ]
-  },
-  "minLength": 1,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/member-access/index.html b/docs/_site/rules/member-access/index.html deleted file mode 100644 index d6a99a3913d..00000000000 --- a/docs/_site/rules/member-access/index.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - Rule: member-access - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: member-access

-

-
- - -

Requires explicit visibility declarations for class members.

- - - - -
Rationale
-

Explicit visibility declarations can make code more readable and accessible for those new to TS.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

These arguments may be optionally provided:

- -
    -
  • "no-public" forbids public accessibility to be specified, because this is the default.
  • -
  • "check-accessor" enforces explicit visibility on get/set accessors
  • -
  • "check-constructor" enforces explicit visibility on constructors
  • -
  • "check-parameter-property" enforces explicit visibility on parameter properties
  • -
- - -
Config examples
- -
-"member-access": true
-
- -
-"member-access": [true, "no-public"]
-
- -
-"member-access": [true, "check-accessor"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "no-public",
-      "check-accessor",
-      "check-constructor",
-      "check-parameter-property"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 4
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/member-ordering/index.html b/docs/_site/rules/member-ordering/index.html deleted file mode 100644 index 1ecb56d9037..00000000000 --- a/docs/_site/rules/member-ordering/index.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - Rule: member-ordering - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: member-ordering

-

-
- - -

Enforces member ordering.

- - - - -
Rationale
-

A consistent ordering for class members can make classes easier to read, navigate, and edit.

- - - - - -

Config

- -

One argument, which is an object, must be provided. It should contain an order property. -The order property should have a value of one of the following strings:

- -
    -
  • fields-first
  • -
  • instance-sandwich
  • -
  • statics-first
  • -
- -

Alternatively, the value for order maybe be an array consisting of the following strings:

- -
    -
  • public-static-field
  • -
  • public-static-method
  • -
  • protected-static-field
  • -
  • protected-static-method
  • -
  • private-static-field
  • -
  • private-static-method
  • -
  • public-instance-field
  • -
  • protected-instance-field
  • -
  • private-instance-field
  • -
  • public-constructor
  • -
  • protected-constructor
  • -
  • private-constructor
  • -
  • public-instance-method
  • -
  • protected-instance-method
  • -
  • private-instance-method
  • -
- -

You can also omit the access modifier to refer to “public-“, “protected-“, and “private-“ all at once; for example, “static-field”.

- -

You can also make your own categories by using an object instead of a string:

- -
{
-    "name": "static non-private",
-    "kinds": [
-        "public-static-field",
-        "protected-static-field",
-        "public-static-method",
-        "protected-static-method"
-    ]
-}
-
- -

The ‘alphabetize’ option will enforce that members within the same category should be alphabetically sorted by name.

- - -
Config examples
- -
-"member-ordering": [true, {"order": "fields-first"}]
-
- -
-"member-ordering": [
-  true,
-  {
-    "order": [
-      "public-static-field",
-      "public-instance-field",
-      "public-constructor",
-      "private-static-field",
-      "private-instance-field",
-      "private-constructor",
-      "public-instance-method",
-      "protected-instance-method",
-      "private-instance-method"
-    ]
-  }
-]
-
- -
-"member-ordering": [
-  true,
-  {
-    "order": [
-      {
-        "name": "static non-private",
-        "kinds": [
-          "public-static-field",
-          "protected-static-field",
-          "public-static-method",
-          "protected-static-method"
-        ]
-      },
-      "constructor"
-    ]
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "order": {
-      "oneOf": [
-        {
-          "type": "string",
-          "enum": [
-            "fields-first",
-            "instance-sandwich",
-            "statics-first"
-          ]
-        },
-        {
-          "type": "array",
-          "items": {
-            "type": "string",
-            "enum": [
-              "public-static-field",
-              "public-static-method",
-              "protected-static-field",
-              "protected-static-method",
-              "private-static-field",
-              "private-static-method",
-              "public-instance-field",
-              "protected-instance-field",
-              "private-instance-field",
-              "public-constructor",
-              "protected-constructor",
-              "private-constructor",
-              "public-instance-method",
-              "protected-instance-method",
-              "private-instance-method"
-            ]
-          },
-          "maxLength": 13
-        }
-      ]
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/new-parens/index.html b/docs/_site/rules/new-parens/index.html deleted file mode 100644 index d35725f0c0e..00000000000 --- a/docs/_site/rules/new-parens/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: new-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: new-parens

-

-
- - -

Requires parentheses when invoking a constructor via the new keyword.

- - - - -
Rationale
-

Maintains stylistic consistency with other function calls.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"new-parens": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/newline-before-return/index.html b/docs/_site/rules/newline-before-return/index.html deleted file mode 100644 index 32cda592847..00000000000 --- a/docs/_site/rules/newline-before-return/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: newline-before-return - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: newline-before-return

-

-
- - -

Enforces blank line before return when not the only line in the block.

- - - - -
Rationale
-

Helps maintain a readable style in your codebase.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"newline-before-return": true
-
- - -
Schema
-
-{}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/newline-per-chained-call/index.html b/docs/_site/rules/newline-per-chained-call/index.html deleted file mode 100644 index d01b1ed0ebd..00000000000 --- a/docs/_site/rules/newline-per-chained-call/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: newline-per-chained-call - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: newline-per-chained-call

-

-
- - - -

Requires that chained method calls be broken apart onto separate lines.

- - - - -
Rationale
- -

This style helps to keep code ‘vertical’, avoiding the need for side-scrolling in IDEs or text editors.

- - - - - -

Config

-

Not configurable

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-angle-bracket-type-assertion/index.html b/docs/_site/rules/no-angle-bracket-type-assertion/index.html deleted file mode 100644 index 9d51974a0ce..00000000000 --- a/docs/_site/rules/no-angle-bracket-type-assertion/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-angle-bracket-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-angle-bracket-type-assertion

-

-
- - -

Requires the use of as Type for type assertions instead of <Type>.

- - - - -
Rationale
- -

Both formats of type assertions have the same effect, but only as type assertions -work in .tsx files. This rule ensures that you have a consistent type assertion style -across your codebase.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-angle-bracket-type-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-any/index.html b/docs/_site/rules/no-any/index.html deleted file mode 100644 index 83d82049eba..00000000000 --- a/docs/_site/rules/no-any/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-any - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-any

-

-
- - -

Disallows usages of any as a type declaration.

- - - - -
Rationale
-

Using any as a type declaration nullifies the compile-time benefits of the type system.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-any": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-arg/index.html b/docs/_site/rules/no-arg/index.html deleted file mode 100644 index 6243eaa30c3..00000000000 --- a/docs/_site/rules/no-arg/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-arg - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-arg

-

-
- - -

Disallows use of arguments.callee.

- - - - -
Rationale
- -

Using arguments.callee makes various performance optimizations impossible. -See MDN -for more details on why to avoid arguments.callee.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-arg": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-bitwise/index.html b/docs/_site/rules/no-bitwise/index.html deleted file mode 100644 index 27022219ed5..00000000000 --- a/docs/_site/rules/no-bitwise/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: no-bitwise - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-bitwise

-

-
- - -

Disallows bitwise operators.

- - - -

Specifically, the following bitwise operators are banned: -&, &=, |, |=, -^, ^=, <<, <<=, ->>, >>=, >>>, >>>=, and ~. -This rule does not ban the use of & and | for intersection and union types.

- - - - -
Rationale
- -

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. -They also can be an indicator of overly clever code which decreases maintainability.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-bitwise": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-boolean-literal-compare/index.html b/docs/_site/rules/no-boolean-literal-compare/index.html deleted file mode 100644 index 2e6c26a7fd0..00000000000 --- a/docs/_site/rules/no-boolean-literal-compare/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-boolean-literal-compare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-boolean-literal-compare

-

-
- - -

Warns on comparison to a boolean literal, as in x === true.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-boolean-literal-compare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-conditional-assignment/index.html b/docs/_site/rules/no-conditional-assignment/index.html deleted file mode 100644 index 4e53b57141e..00000000000 --- a/docs/_site/rules/no-conditional-assignment/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-conditional-assignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-conditional-assignment

-

-
- - -

Disallows any type of assignment in conditionals.

- - -

This applies to do-while, for, if, and while statements and conditional (ternary) expressions.

- - - - -
Rationale
- -

Assignments in conditionals are often typos: -for example if (var1 = var2) instead of if (var1 == var2). -They also can be an indicator of overly clever code which decreases maintainability.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-conditional-assignment": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-consecutive-blank-lines/index.html b/docs/_site/rules/no-consecutive-blank-lines/index.html deleted file mode 100644 index 2c1a526b122..00000000000 --- a/docs/_site/rules/no-consecutive-blank-lines/index.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Rule: no-consecutive-blank-lines - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-consecutive-blank-lines

-

-
- - -

Disallows one or more blank lines in a row.

- - - - -
Rationale
-

Helps maintain a readable style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

An optional number of maximum allowed sequential blanks can be specified. If no value -is provided, a default of 1 will be used.

- - -
Config examples
- -
-"no-consecutive-blank-lines": true
-
- -
-"no-consecutive-blank-lines": [true, 2]
-
- - -
Schema
-
-{
-  "type": "number",
-  "minimum": "1"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-console/index.html b/docs/_site/rules/no-console/index.html deleted file mode 100644 index d492a144d4f..00000000000 --- a/docs/_site/rules/no-console/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-console - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-console

-

-
- - -

Bans the use of specified console methods.

- - - - -
Rationale
-

In general, console methods aren’t appropriate for production code.

- - - - - -

Config

-

A list of method names to ban. If no method names are provided, all console methods are banned.

- - -
Config examples
- -
-"no-console": [true, "log", "error"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-construct/index.html b/docs/_site/rules/no-construct/index.html deleted file mode 100644 index 0a3bffd6d41..00000000000 --- a/docs/_site/rules/no-construct/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-construct - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-construct

-

-
- - -

Disallows access to the constructors of String, Number, and Boolean.

- - -

Disallows constructor use such as new Number(foo) but does not disallow Number(foo).

- - - - -
Rationale
- -

There is little reason to use String, Number, or Boolean as constructors. -In almost all cases, the regular function-call version is more appropriate. -More details are available on StackOverflow.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-construct": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-debugger/index.html b/docs/_site/rules/no-debugger/index.html deleted file mode 100644 index d91a7c8195b..00000000000 --- a/docs/_site/rules/no-debugger/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-debugger - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-debugger

-

-
- - -

Disallows debugger statements.

- - - - -
Rationale
-

In general, debugger statements aren’t appropriate for production code.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-debugger": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-default-export/index.html b/docs/_site/rules/no-default-export/index.html deleted file mode 100644 index bd289c5e62e..00000000000 --- a/docs/_site/rules/no-default-export/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: no-default-export - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-default-export

-

-
- - -

Disallows default exports in ES6-style modules.

- - -

Use named exports instead.

- - - - -
Rationale
- -

Named imports/exports promote clarity. -In addition, current tooling differs on the correct way to handle default imports/exports. -Avoiding them all together can help avoid tooling bugs and conflicts.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-default-export": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-imports/index.html b/docs/_site/rules/no-duplicate-imports/index.html deleted file mode 100644 index 3b843d0d02e..00000000000 --- a/docs/_site/rules/no-duplicate-imports/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-duplicate-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-imports

-

-
- - - -

Disallows multiple import statements from the same module.

- - - - -
Rationale
- -

Using a single import statement per module will make the code clearer because you can see everything being imported -from that module on one line.

- - - - - -

Config

-

Not configurable

- - -
Config examples
- -
-"no-duplicate-imports": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-super/index.html b/docs/_site/rules/no-duplicate-super/index.html deleted file mode 100644 index 637a74d625e..00000000000 --- a/docs/_site/rules/no-duplicate-super/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-duplicate-super - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-super

-

-
- - -

Warns if ‘super()’ appears twice in a constructor.

- - - - -
Rationale
-

The second call to ‘super()’ will fail at runtime.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-duplicate-super": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-switch-case/index.html b/docs/_site/rules/no-duplicate-switch-case/index.html deleted file mode 100644 index 1882ea04451..00000000000 --- a/docs/_site/rules/no-duplicate-switch-case/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-duplicate-switch-case - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-switch-case

-

-
- - -

Prevents duplicate cases in switch statements.

- - - - - - - -

Config

- - - -
Config examples
- -
-"no-duplicate-switch-case": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-duplicate-variable/index.html b/docs/_site/rules/no-duplicate-variable/index.html deleted file mode 100644 index 9c8c627124a..00000000000 --- a/docs/_site/rules/no-duplicate-variable/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-duplicate-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-duplicate-variable

-

-
- - -

Disallows duplicate variable declarations in the same block scope.

- - - -

This rule is only useful when using the var keyword - -the compiler will detect redeclarations of let and const variables.

- - - - -
Rationale
- -

A variable can be reassigned if necessary - -there’s no good reason to have a duplicate variable declaration.

- - - - - -

Config

-

You can specify "check-parameters" to check for variables with the same name as a parameter.

- - -
Config examples
- -
-"no-duplicate-variable": true
-
- -
-"no-duplicate-variable": [true, "check-parameters"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "check-parameters"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-dynamic-delete/index.html b/docs/_site/rules/no-dynamic-delete/index.html deleted file mode 100644 index 3e7ac893867..00000000000 --- a/docs/_site/rules/no-dynamic-delete/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: no-dynamic-delete - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-dynamic-delete

-

-
- - -

Bans usage of the delete operator with computed key expressions.

- - - - -
Rationale
- -

Deleting dynamically computed keys is dangerous and not well optimized.

- -

Also consider using a Map -or Set -if you’re storing collections of objects. -Using Objects can cause occasional edge case bugs, such as if a key is named “hasOwnProperty”.

- - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-dynamic-delete": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-empty-interface/index.html b/docs/_site/rules/no-empty-interface/index.html deleted file mode 100644 index 283c1caf315..00000000000 --- a/docs/_site/rules/no-empty-interface/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-empty-interface - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-empty-interface

-

-
- - -

Forbids empty interfaces.

- - - - -
Rationale
-

An empty interface is equivalent to its supertype (or {}).

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-empty/index.html b/docs/_site/rules/no-empty/index.html deleted file mode 100644 index f2d4935079e..00000000000 --- a/docs/_site/rules/no-empty/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-empty - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-empty

-

-
- - -

Disallows empty blocks.

- - -

Blocks with a comment inside are not considered empty.

- - - - -
Rationale
-

Empty blocks are often indicators of missing code.

- - - - - -

Config

- -

If allow-empty-catch is specified, then catch blocks are allowed to be empty.

- - -
Config examples
- -
-"no-empty": true
-
- -
-"no-empty": [true, "allow-empty-catch"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-empty-catch"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-eval/index.html b/docs/_site/rules/no-eval/index.html deleted file mode 100644 index a061bb8633a..00000000000 --- a/docs/_site/rules/no-eval/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - Rule: no-eval - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-eval

-

-
- - -

Disallows eval function invocations.

- - - - -
Rationale
- -

eval() is dangerous as it allows arbitrary code execution with full privileges. There are -alternatives -for most of the use cases for eval().

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-eval": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-floating-promises/index.html b/docs/_site/rules/no-floating-promises/index.html deleted file mode 100644 index a7aa472656d..00000000000 --- a/docs/_site/rules/no-floating-promises/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: no-floating-promises - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-floating-promises

-

-
- - -

Promises returned by functions must be handled appropriately.

- - -

Use no-unused-expression in addition to this rule to reveal even more floating promises.

- - - - -
Rationale
-

Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.

- - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

A list of ‘string’ names of any additional classes that should also be handled as Promises.

- - - -
Config examples
- -
-"no-floating-promises": true
-
- -
-"no-floating-promises": [true, "JQueryPromise"]
-
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-for-in-array/index.html b/docs/_site/rules/no-for-in-array/index.html deleted file mode 100644 index d330bfea921..00000000000 --- a/docs/_site/rules/no-for-in-array/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - Rule: no-for-in-array - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-for-in-array

-

-
- - -

Disallows iterating over an array with a for-in loop.

- - - -

A for-in loop (for (var k in o)) iterates over the properties of an Object.

- -

While it is legal to use for-in loops with array types, it is not common. -for-in will iterate over the indices of the array as strings, omitting any “holes” in -the array.

- -

More common is to use for-of, which iterates over the values of an array. -If you want to iterate over the indices, alternatives include:

- -

array.forEach((value, index) => { … }); -for (const [index, value] of array.entries()) { … } -for (let i = 0; i < array.length; i++) { … }

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-for-in-array": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-implicit-dependencies/index.html b/docs/_site/rules/no-implicit-dependencies/index.html deleted file mode 100644 index 3fb7e0d8a63..00000000000 --- a/docs/_site/rules/no-implicit-dependencies/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - Rule: no-implicit-dependencies - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-implicit-dependencies

-

-
- - -

Disallows importing modules that are not listed as dependency in the project’s package.json

- - - -

Disallows importing transient dependencies and modules installed above your package’s root directory.

- - - - - - - - -

Config

- -

By default the rule looks at "dependencies" and "peerDependencies". -By adding the "dev" option the rule looks at "devDependencies" instead of "peerDependencies". -By adding the "optional" option the rule also looks at "optionalDependencies".

- - - -
Config examples
- -
-"no-implicit-dependencies": true
-
- -
-"no-implicit-dependencies": [true, "dev"]
-
- -
-"no-implicit-dependencies": [true, "optional"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "dev",
-      "optional"
-    ]
-  },
-  "minItems": 0,
-  "maxItems": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-import-side-effect/index.html b/docs/_site/rules/no-import-side-effect/index.html deleted file mode 100644 index 9ccd1ea5bec..00000000000 --- a/docs/_site/rules/no-import-side-effect/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: no-import-side-effect - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-import-side-effect

-

-
- - -

Avoid import statements with side-effect.

- - - - -
Rationale
-

Imports with side effects may have behavior which is hard for static verification.

- - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • ignore-module allows to specify a regex and ignore modules which it matches.
  • -
- - -
Config examples
- -
-"no-import-side-effect": true
-
- -
-"no-import-side-effect": [true, {"ignore-module": "(\\.html|\\.css)$"}]
-
- - -
Schema
-
-{
-  "items": {
-    "properties": {
-      "ignore-module": {
-        "type": "string"
-      }
-    },
-    "type": "object"
-  },
-  "maxLength": 1,
-  "minLength": 0,
-  "type": "array"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-inferrable-types/index.html b/docs/_site/rules/no-inferrable-types/index.html deleted file mode 100644 index 31729be771b..00000000000 --- a/docs/_site/rules/no-inferrable-types/index.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - Rule: no-inferrable-types - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-inferrable-types

-

-
- - -

Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.

- - - - -
Rationale
-

Explicit types where they can be easily inferred by the compiler make code more verbose.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • ignore-params allows specifying an inferrable type annotation for function params. -This can be useful when combining with the typedef rule.
  • -
  • ignore-properties allows specifying an inferrable type annotation for class properties.
  • -
- - -
Config examples
- -
-"no-inferrable-types": true
-
- -
-"no-inferrable-types": [true, "ignore-params"]
-
- -
-"no-inferrable-types": [true, "ignore-params", "ignore-properties"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-params",
-      "ignore-properties"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-inferred-empty-object-type/index.html b/docs/_site/rules/no-inferred-empty-object-type/index.html deleted file mode 100644 index 3d5fe55a4d8..00000000000 --- a/docs/_site/rules/no-inferred-empty-object-type/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: no-inferred-empty-object-type - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-inferred-empty-object-type

-

-
- - -

Disallow type inference of {} (empty object type) at function and constructor call sites

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-inferred-empty-object-type": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-internal-module/index.html b/docs/_site/rules/no-internal-module/index.html deleted file mode 100644 index d4ba5ba4467..00000000000 --- a/docs/_site/rules/no-internal-module/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-internal-module - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-internal-module

-

-
- - -

Disallows internal module

- - - - -
Rationale
-

Using module leads to a confusion of concepts with external modules. Use the newer namespace keyword instead.

- - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-internal-module": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-invalid-template-strings/index.html b/docs/_site/rules/no-invalid-template-strings/index.html deleted file mode 100644 index df9e1905b3f..00000000000 --- a/docs/_site/rules/no-invalid-template-strings/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-invalid-template-strings - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-invalid-template-strings

-

-
- - -

Warns on use of ${ in non-template strings.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-invalid-template-strings": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-invalid-this/index.html b/docs/_site/rules/no-invalid-this/index.html deleted file mode 100644 index dec83b55801..00000000000 --- a/docs/_site/rules/no-invalid-this/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - Rule: no-invalid-this - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-invalid-this

-

-
- - -

Disallows using the this keyword outside of classes.

- - - - -
Rationale
-

See the rule’s author’s rationale here.

- - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • check-function-in-method disallows using the this keyword in functions within class methods.
  • -
- - -
Config examples
- -
-"no-invalid-this": true
-
- -
-"no-invalid-this": [true, "check-function-in-method"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-function-in-method"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-irregular-whitespace/index.html b/docs/_site/rules/no-irregular-whitespace/index.html deleted file mode 100644 index 148af75f96d..00000000000 --- a/docs/_site/rules/no-irregular-whitespace/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-irregular-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-irregular-whitespace

-

-
- - -

Disallow irregular whitespace outside of strings and comments

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-irregular-whitespace": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-magic-numbers/index.html b/docs/_site/rules/no-magic-numbers/index.html deleted file mode 100644 index 6320e02a021..00000000000 --- a/docs/_site/rules/no-magic-numbers/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-magic-numbers - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-magic-numbers

-

-
- - - -

Disallows the use constant number values outside of variable assignments. -When no list of allowed values is specified, -1, 0 and 1 are allowed by default.

- - - - -
Rationale
- -

Magic numbers should be avoided as they often lack documentation, forcing -them to be stored in variables gives them implicit documentation.

- - - - - -

Config

-

A list of allowed numbers.

- - -
Config examples
- -
-"no-magic-numbers": true
-
- -
-"no-magic-numbers": [true, 1, 2, 3]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "number"
-  },
-  "minLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-mergeable-namespace/index.html b/docs/_site/rules/no-mergeable-namespace/index.html deleted file mode 100644 index 7261ea23cb3..00000000000 --- a/docs/_site/rules/no-mergeable-namespace/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-mergeable-namespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-mergeable-namespace

-

-
- - -

Disallows mergeable namespaces in the same file.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-mergeable-namespace": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-misused-new/index.html b/docs/_site/rules/no-misused-new/index.html deleted file mode 100644 index 66b1dd18dcf..00000000000 --- a/docs/_site/rules/no-misused-new/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-misused-new - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-misused-new

-

-
- - -

Warns on apparent attempts to define constructors for interfaces or new for classes.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-misused-new": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-namespace/index.html b/docs/_site/rules/no-namespace/index.html deleted file mode 100644 index a31424cc42a..00000000000 --- a/docs/_site/rules/no-namespace/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - Rule: no-namespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-namespace

-

-
- - -

Disallows use of internal modules and namespaces.

- - -

This rule still allows the use of declare module ... {}

- - - - -
Rationale
- -

ES6-style external modules are the standard way to modularize code. -Using module {} and namespace {} are outdated ways to organize TypeScript code.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

One argument may be optionally provided:

- -
    -
  • allow-declarations allows declare namespace ... {} to describe external APIs.
  • -
- - -
Config examples
- -
-"no-namespace": true
-
- -
-"no-namespace": [true, "allow-declarations"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-declarations"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-non-null-assertion/index.html b/docs/_site/rules/no-non-null-assertion/index.html deleted file mode 100644 index 38965c1b2d4..00000000000 --- a/docs/_site/rules/no-non-null-assertion/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-non-null-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-non-null-assertion

-

-
- - -

Disallows non-null assertions using the ! postfix operator.

- - - - -
Rationale
-

Using non-null assertion cancels the benefits of the strict null checking mode.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-non-null-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-null-keyword/index.html b/docs/_site/rules/no-null-keyword/index.html deleted file mode 100644 index 0f2bb6581f2..00000000000 --- a/docs/_site/rules/no-null-keyword/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-null-keyword - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-null-keyword

-

-
- - -

Disallows use of the null keyword literal.

- - - - -
Rationale
- -

Instead of having the dual concepts of null andundefined in a codebase, -this rule ensures that only undefined is used.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-null-keyword": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-object-literal-type-assertion/index.html b/docs/_site/rules/no-object-literal-type-assertion/index.html deleted file mode 100644 index 47ebbb0f87d..00000000000 --- a/docs/_site/rules/no-object-literal-type-assertion/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-object-literal-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-object-literal-type-assertion

-

-
- - - -

Forbids an object literal to appear in a type assertion expression. -Casting to any is still allowed.

- - - - -
Rationale
- -

Always prefer const x: T = { ... }; to const x = { ... } as T;. -The type assertion in the latter case is either unnecessary or hides an error. -The compiler will warn for excess properties with this syntax, but not missing required fields. -For example: const x: { foo: number } = {} will fail to compile, but -const x = {} as { foo: number } will succeed.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-object-literal-type-assertion": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-parameter-properties/index.html b/docs/_site/rules/no-parameter-properties/index.html deleted file mode 100644 index 1e63a106a7c..00000000000 --- a/docs/_site/rules/no-parameter-properties/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-parameter-properties - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-parameter-properties

-

-
- - -

Disallows parameter properties in class constructors.

- - - - -
Rationale
- -

Parameter properties can be confusing to those new to TS as they are less explicit -than other ways of declaring and initializing class members.

- - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-parameter-properties": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-parameter-reassignment/index.html b/docs/_site/rules/no-parameter-reassignment/index.html deleted file mode 100644 index a5b844547ad..00000000000 --- a/docs/_site/rules/no-parameter-reassignment/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: no-parameter-reassignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-parameter-reassignment

-

-
- - -

Disallows reassigning parameters.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-parameter-reassignment": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-redundant-jsdoc/index.html b/docs/_site/rules/no-redundant-jsdoc/index.html deleted file mode 100644 index a4988e8ba0e..00000000000 --- a/docs/_site/rules/no-redundant-jsdoc/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-redundant-jsdoc - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-redundant-jsdoc

-

-
- - -

Forbids JSDoc which duplicates TypeScript functionality.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-redundant-jsdoc": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-reference-import/index.html b/docs/_site/rules/no-reference-import/index.html deleted file mode 100644 index 0ac920697b5..00000000000 --- a/docs/_site/rules/no-reference-import/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - Rule: no-reference-import - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-reference-import

-

-
- - -

Don’t <reference types="foo" /> if you import foo anyway.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-reference/index.html b/docs/_site/rules/no-reference/index.html deleted file mode 100644 index 6dadb22541b..00000000000 --- a/docs/_site/rules/no-reference/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - Rule: no-reference - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-reference

-

-
- - -

Disallows /// <reference path=> imports (use ES6-style imports instead).

- - - - -
Rationale
- -

Using /// <reference path=> comments to load other files is outdated. -Use ES6-style imports to reference other files.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-reference": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-require-imports/index.html b/docs/_site/rules/no-require-imports/index.html deleted file mode 100644 index 353eae206d2..00000000000 --- a/docs/_site/rules/no-require-imports/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-require-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-require-imports

-

-
- - -

Disallows invocation of require().

- - - - -
Rationale
-

Prefer the newer ES6-style imports over require().

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-require-imports": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-return-await/index.html b/docs/_site/rules/no-return-await/index.html deleted file mode 100644 index 07484172174..00000000000 --- a/docs/_site/rules/no-return-await/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - Rule: no-return-await - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-return-await

-

-
- - -

Disallows unnecessary return await.

- - - - -
Rationale
- -

An async function always wraps the return value in a Promise. -Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.

- - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-return-await": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-shadowed-variable/index.html b/docs/_site/rules/no-shadowed-variable/index.html deleted file mode 100644 index b9b771ba95b..00000000000 --- a/docs/_site/rules/no-shadowed-variable/index.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - Rule: no-shadowed-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-shadowed-variable

-

-
- - -

Disallows shadowing variable declarations.

- - - - -
Rationale
-

Shadowing a variable masks access to it and obscures to what value an identifier actually refers.

- - - - - -

Config

- -

You can optionally pass an object to disable checking for certain kinds of declarations. -Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" -and "typeParameter". Just set the value to false for the check you want to disable. -All checks default to true, i.e. are enabled by default. -Note that you cannot disable variables and parameters.

- -

The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their -temporal dead zone. When set to false parameters, classes, enums and variables declared -with let or const are not considered shadowed if the shadowing occurs within their -temporal dead zone.

- -

The following example shows how the "temporalDeadZone" option changes the linting result:

- -
function fn(value) {
-    if (value) {
-        const tmp = value; // no error on this line if "temporalDeadZone" is false
-        return tmp;
-    }
-    let tmp = undefined;
-    if (!value) {
-        const tmp = value; // this line always contains an error
-        return tmp;
-    }
-}
-
- - - -
Config examples
- -
-"no-shadowed-variable": true
-
- -
-"no-shadowed-variable": [
-  true,
-  {
-    "class": true,
-    "enum": true,
-    "function": true,
-    "interface": false,
-    "namespace": true,
-    "typeAlias": false,
-    "typeParameter": false
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "class": {
-      "type": "boolean"
-    },
-    "enum": {
-      "type": "boolean"
-    },
-    "function": {
-      "type": "boolean"
-    },
-    "import": {
-      "type": "boolean"
-    },
-    "interface": {
-      "type": "boolean"
-    },
-    "namespace": {
-      "type": "boolean"
-    },
-    "typeAlias": {
-      "type": "boolean"
-    },
-    "typeParameter": {
-      "type": "boolean"
-    },
-    "temporalDeadZone": {
-      "type": "boolean"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-sparse-arrays/index.html b/docs/_site/rules/no-sparse-arrays/index.html deleted file mode 100644 index dee04a79850..00000000000 --- a/docs/_site/rules/no-sparse-arrays/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: no-sparse-arrays - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-sparse-arrays

-

-
- - -

Forbids array literals to contain missing elements.

- - - - -
Rationale
-

Missing elements are probably an accidentally duplicated comma.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-sparse-arrays": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-string-literal/index.html b/docs/_site/rules/no-string-literal/index.html deleted file mode 100644 index 44babe9fca7..00000000000 --- a/docs/_site/rules/no-string-literal/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: no-string-literal - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-string-literal

-

-
- - - -

Forbids unnecessary string literal property access. -Allows obj["prop-erty"] (can’t be a regular property access). -Disallows obj["property"] (should be obj.property).

- - - - -
Rationale
- -

If --noImplicitAny is turned off, -property access via a string literal will be ‘any’ if the property does not exist.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-string-literal": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-string-throw/index.html b/docs/_site/rules/no-string-throw/index.html deleted file mode 100644 index f01098bb394..00000000000 --- a/docs/_site/rules/no-string-throw/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - Rule: no-string-throw - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-string-throw

-

-
- - -

Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-submodule-imports/index.html b/docs/_site/rules/no-submodule-imports/index.html deleted file mode 100644 index be3f5182f1f..00000000000 --- a/docs/_site/rules/no-submodule-imports/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-submodule-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-submodule-imports

-

-
- - - -

Disallows importing any submodule.

- - - - -
Rationale
- -

Submodules of some packages are treated as private APIs and the import -paths may change without deprecation periods. It’s best to stick with -top-level package exports.

- - - - - -

Config

-

A list of whitelisted package or submodule names.

- - -
Config examples
- -
-"no-submodule-imports": true
-
- -
-"no-submodule-imports": [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-switch-case-fall-through/index.html b/docs/_site/rules/no-switch-case-fall-through/index.html deleted file mode 100644 index cd6c370339a..00000000000 --- a/docs/_site/rules/no-switch-case-fall-through/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - Rule: no-switch-case-fall-through - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-switch-case-fall-through

-

-
- - -

Disallows falling through case statements.

- - - -

For example, the following is not allowed:

- -
switch(foo) {
-    case 1:
-        someFunc(foo);
-    case 2:
-        someOtherFunc(foo);
-}
-
- -

However, fall through is allowed when case statements are consecutive or -a magic /* falls through */ comment is present. The following is valid:

- -
switch(foo) {
-    case 1:
-        someFunc(foo);
-        /* falls through */
-    case 2:
-    case 3:
-        someOtherFunc(foo);
-}
-
- - - - -
Rationale
-

Fall though in switch statements is often unintentional and a bug.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-switch-case-fall-through": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-this-assignment/index.html b/docs/_site/rules/no-this-assignment/index.html deleted file mode 100644 index ab7ec59beca..00000000000 --- a/docs/_site/rules/no-this-assignment/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: no-this-assignment - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-this-assignment

-

-
- - -

Disallows unnecessary references to this.

- - - - -
Rationale
-

Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not manging scope well.

- - - - - -

Config

- -

Two options may be provided on an object:

- -
    -
  • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
  • -
  • allowed-names may be specified as a list of regular expressions to match allowed variable names.
  • -
- - -
Config examples
- -
-"no-this-assignment": true
-
- -
-"no-this-assignment": [true, {"allowed-names": ["^self$"], "allow-destructuring": true}]
-
- - -
Schema
-
-{
-  "additionalProperties": false,
-  "properties": {
-    "allow-destructuring": {
-      "type": "boolean"
-    },
-    "allowed-names": {
-      "listType": "string",
-      "type": "list"
-    }
-  },
-  "type": "object"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-trailing-whitespace/index.html b/docs/_site/rules/no-trailing-whitespace/index.html deleted file mode 100644 index c99e817afa9..00000000000 --- a/docs/_site/rules/no-trailing-whitespace/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: no-trailing-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-trailing-whitespace

-

-
- - -

Disallows trailing whitespace at the end of a line.

- - - - -
Rationale
-

Keeps version control diffs clean as it prevents accidental whitespace from being committed.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Possible settings are:

- -
    -
  • "ignore-template-strings": Allows trailing whitespace in template strings.
  • -
  • "ignore-comments": Allows trailing whitespace in comments.
  • -
  • "ignore-jsdoc": Allows trailing whitespace only in JSDoc comments.
  • -
  • "ignore-blank-lines": Allows trailing whitespace on empty lines.
  • -
- - -
Config examples
- -
-"no-trailing-whitespace": true
-
- -
-"no-trailing-whitespace": [true, "ignore-comments"]
-
- -
-"no-trailing-whitespace": [true, "ignore-jsdoc"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-comments",
-      "ignore-jsdoc",
-      "ignore-template-strings",
-      "ignore-blank-lines"
-    ]
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unbound-method/index.html b/docs/_site/rules/no-unbound-method/index.html deleted file mode 100644 index 679558ef442..00000000000 --- a/docs/_site/rules/no-unbound-method/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - Rule: no-unbound-method - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unbound-method

-

-
- - -

Warns when a method is used as outside of a method call.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

You may optionally pass “ignore-static” to ignore static methods.

- - -
Config examples
- -
-"no-unbound-method": true
-
- -
-"no-unbound-method": [true, "ignore-static"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ignore-static"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html b/docs/_site/rules/no-unnecessary-callback-wrapper/index.html deleted file mode 100644 index 2db62dbb7a7..00000000000 --- a/docs/_site/rules/no-unnecessary-callback-wrapper/index.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-callback-wrapper - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-callback-wrapper

-

-
- - - -

Replaces x => f(x) with just f. -To catch more cases, enable only-arrow-functions and arrow-return-shorthand too.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-callback-wrapper": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-class/index.html b/docs/_site/rules/no-unnecessary-class/index.html deleted file mode 100644 index 7bed761e88f..00000000000 --- a/docs/_site/rules/no-unnecessary-class/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-class - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-class

-

-
- - - -

Disallows classes that are not strictly necessary.

- - - - -
Rationale
- -

Users who come from a Java-style OO language may wrap -their utility functions in an extra class, instead of -putting them at the top level.

- - - - - -

Config

- -

Three arguments may be optionally provided:

- -
    -
  • "allow-constructor-only" ignores classes whose members are constructors.
  • -
  • "allow-empty-class" ignores class DemoClass {}.
  • -
  • "allow-static-only" ignores classes whose members are static.
  • -
- - -
Config examples
- -
-"no-unnecessary-class": true
-
- -
-"no-unnecessary-class": ["allow-empty-class", "allow-constructor-only"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string"
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-initializer/index.html b/docs/_site/rules/no-unnecessary-initializer/index.html deleted file mode 100644 index dbd6e26171d..00000000000 --- a/docs/_site/rules/no-unnecessary-initializer/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-initializer - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-initializer

-

-
- - -

Forbids a ‘var’/’let’ statement or destructuring initializer to be initialized to ‘undefined’.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-initializer": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-qualifier/index.html b/docs/_site/rules/no-unnecessary-qualifier/index.html deleted file mode 100644 index ca3aabac10f..00000000000 --- a/docs/_site/rules/no-unnecessary-qualifier/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-qualifier - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-qualifier

-

-
- - -

Warns when a namespace qualifier (A.x) is unnecessary.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unnecessary-qualifier": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unnecessary-type-assertion/index.html b/docs/_site/rules/no-unnecessary-type-assertion/index.html deleted file mode 100644 index 5a2a395a3d1..00000000000 --- a/docs/_site/rules/no-unnecessary-type-assertion/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-unnecessary-type-assertion - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unnecessary-type-assertion

-

-
- - -

Warns if a type assertion does not change the type of an expression.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

-

A list of whitelisted assertion types to ignore

- - -
Config examples
- - -
Schema
-
-{
-  "type": "list",
-  "listType": {
-    "type": "array",
-    "items": {
-      "type": "string"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unsafe-any/index.html b/docs/_site/rules/no-unsafe-any/index.html deleted file mode 100644 index c134d81b2fa..00000000000 --- a/docs/_site/rules/no-unsafe-any/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: no-unsafe-any - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unsafe-any

-

-
- - - -

Warns when using an expression of type ‘any’ in a dynamic way. -Uses are only allowed if they would work for {} | null | undefined. -Type casts and tests are allowed. -Expressions that work on all values (such as "" + x) are allowed.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unsafe-any": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unsafe-finally/index.html b/docs/_site/rules/no-unsafe-finally/index.html deleted file mode 100644 index 239dd8b4d8d..00000000000 --- a/docs/_site/rules/no-unsafe-finally/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: no-unsafe-finally - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unsafe-finally

-

-
- - - -

Disallows control flow statements, such as return, continue, -break and throws in finally blocks.

- - - - - - - -
Rationale
- -

When used inside finally blocks, control flow statements, -such as return, continue, break and throws -override any other control flow statements in the same try/catch scope. -This is confusing and unexpected behavior.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-unsafe-finally": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unused-expression/index.html b/docs/_site/rules/no-unused-expression/index.html deleted file mode 100644 index 1fe05f0da72..00000000000 --- a/docs/_site/rules/no-unused-expression/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: no-unused-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unused-expression

-

-
- - -

Disallows unused expression statements.

- - - -

Unused expressions are expression statements which are not assignments or function calls -(and thus usually no-ops).

- - - - -
Rationale
- -

Detects potential errors where an assignment or function call was intended.

- - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform -method or function calls for side effects (e.g. e && e.preventDefault()).
  • -
  • allow-new allows ‘new’ expressions for side effects (e.g. new ModifyGlobalState();.
  • -
  • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
  • -
- - -
Config examples
- -
-"no-unused-expression": true
-
- -
-"no-unused-expression": [true, "allow-fast-null-checks"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-fast-null-checks",
-      "allow-new",
-      "allow-tagged-template"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-unused-variable/index.html b/docs/_site/rules/no-unused-variable/index.html deleted file mode 100644 index eb2977a14a3..00000000000 --- a/docs/_site/rules/no-unused-variable/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - Rule: no-unused-variable - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-unused-variable

-

-
- - -

Disallows unused imports, variables, functions and - private class members. Similar to tsc’s –noUnusedParameters and –noUnusedLocals - options, but does not interrupt code compilation.

- - - -

In addition to avoiding compilation errors, this rule may still be useful if you -wish to have tslint automatically remove unused imports, variables, functions, -and private class members, when using TSLint’s --fix option.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - - Requires Type Info - -
- - -

Config

- -

Three optional arguments may be optionally provided:

- -
    -
  • "check-parameters" disallows unused function and constructor parameters. -
      -
    • NOTE: this option is experimental and does not work with classes - that use abstract method declarations, among other things.
    • -
    -
  • -
  • {"ignore-pattern": "pattern"} where pattern is a case-sensitive regexp. -Variable names and imports that match the pattern will be ignored.
  • -
- - -
Config examples
- -
-"no-unused-variable": true
-
- -
-"no-unused-variable": [true, {"ignore-pattern": "^_"}]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "oneOf": [
-      {
-        "type": "string",
-        "enum": [
-          "check-parameters"
-        ]
-      },
-      {
-        "type": "object",
-        "properties": {
-          "ignore-pattern": {
-            "type": "string"
-          }
-        },
-        "additionalProperties": false
-      }
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 3
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-use-before-declare/index.html b/docs/_site/rules/no-use-before-declare/index.html deleted file mode 100644 index 1513735112a..00000000000 --- a/docs/_site/rules/no-use-before-declare/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: no-use-before-declare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-use-before-declare

-

-
- - -

Disallows usage of variables before their declaration.

- - - -

This rule is primarily useful when using the var keyword since the compiler will -automatically detect if a block-scoped let and const variable is used before -declaration. Since most modern TypeScript doesn’t use var, this rule is generally -discouraged and is kept around for legacy purposes. It is slow to compute, is not -enabled in the built-in configuration presets, and should not be used to inform TSLint -design decisions.

- - - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-use-before-declare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-var-keyword/index.html b/docs/_site/rules/no-var-keyword/index.html deleted file mode 100644 index 554d8876240..00000000000 --- a/docs/_site/rules/no-var-keyword/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: no-var-keyword - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-var-keyword

-

-
- - -

Disallows usage of the var keyword.

- - -

Use let or const instead.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-var-keyword": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-var-requires/index.html b/docs/_site/rules/no-var-requires/index.html deleted file mode 100644 index 768c7655fe8..00000000000 --- a/docs/_site/rules/no-var-requires/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: no-var-requires - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-var-requires

-

-
- - -

Disallows the use of require statements except in import statements.

- - - -

In other words, the use of forms such as var module = require("module") are banned. -Instead use ES6 style imports or import foo = require('foo') imports.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"no-var-requires": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/no-void-expression/index.html b/docs/_site/rules/no-void-expression/index.html deleted file mode 100644 index 72eb363ba52..00000000000 --- a/docs/_site/rules/no-void-expression/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Rule: no-void-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: no-void-expression

-

-
- - -

Requires expressions of type void to appear in statement position.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

- -

If ignore-arrow-function-shorthand is provided, () => returnsVoid() will be allowed. -Otherwise, it must be written as () => { returnsVoid(); }.

- - -
Config examples
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-arrow-function-shorthand"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/number-literal-format/index.html b/docs/_site/rules/number-literal-format/index.html deleted file mode 100644 index 451dc8d70cd..00000000000 --- a/docs/_site/rules/number-literal-format/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: number-literal-format - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: number-literal-format

-

-
- - -

Checks that decimal literals should begin with ‘0.’ instead of just ‘.’, and should not end with a trailing ‘0’.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"number-literal-format": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-key-quotes/index.html b/docs/_site/rules/object-literal-key-quotes/index.html deleted file mode 100644 index 114438125a4..00000000000 --- a/docs/_site/rules/object-literal-key-quotes/index.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - Rule: object-literal-key-quotes - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-key-quotes

-

-
- - -

Enforces consistent object literal property quote style.

- - - -

Object literal property names can be defined in two ways: using literals or using strings. -For example, these two objects are equivalent:

- -

var object1 = { - property: true -};

- -

var object2 = { - “property”: true -};

- -

In many cases, it doesn’t matter if you choose to use an identifier instead of a string -or vice-versa. Even so, you might decide to enforce a consistent style in your code.

- -

This rules lets you enforce consistent quoting of property names. Either they should always -be quoted (default behavior) or quoted only as needed (“as-needed”).

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Possible settings are:

- -
    -
  • "always": Property names should always be quoted. (This is the default.)
  • -
  • "as-needed": Only property names which require quotes may be quoted (e.g. those with spaces in them).
  • -
  • "consistent": Property names should either all be quoted or unquoted.
  • -
  • "consistent-as-needed": If any property name requires quotes, then all properties must be quoted. Otherwise, no -property names may be quoted.
  • -
- -

For ES6, computed property names ({[name]: value}) and methods ({foo() {}}) never need -to be quoted.

- - -
Config examples
- -
-"object-literal-key-quotes": [true, "as-needed"]
-
- -
-"object-literal-key-quotes": [true, "always"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always",
-    "as-needed",
-    "consistent",
-    "consistent-as-needed"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-shorthand/index.html b/docs/_site/rules/object-literal-shorthand/index.html deleted file mode 100644 index ba176698197..00000000000 --- a/docs/_site/rules/object-literal-shorthand/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: object-literal-shorthand - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-shorthand

-

-
- - -

Enforces/disallows use of ES6 object literal shorthand.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

If the ‘never’ option is provided, any shorthand object literal syntax will cause a failure.

- - -
Config examples
- -
-"object-literal-shorthand": true
-
- -
-"object-literal-shorthand": [true, "never"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "never"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/object-literal-sort-keys/index.html b/docs/_site/rules/object-literal-sort-keys/index.html deleted file mode 100644 index dffa767b71e..00000000000 --- a/docs/_site/rules/object-literal-sort-keys/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - Rule: object-literal-sort-keys - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: object-literal-sort-keys

-

-
- - - -

Checks ordering of keys in object literals.

- -

When using the default alphabetical ordering, additional blank lines may be used to group -object properties together while keeping the elements within each group in alphabetical order.

- - - - - -
Rationale
-

Useful in preventing merge conflicts

- - - - - -

Config

- -

By default, this rule checks that keys are in alphabetical order. -The following may optionally be passed:

- -
    -
  • “ignore-case” will to compare keys in a case insensitive way.
  • -
  • -

    “match-declaration-order” will prefer to use the key ordering of the contextual type of the object literal, as in:

    - -

    interface I { foo: number; bar: number; } - const obj: I = { foo: 1, bar: 2 };

    -
  • -
- -

If a contextual type is not found, alphabetical ordering will be used instead.

- - -
Config examples
- -
-"object-literal-sort-keys": true
-
- -
-"object-literal-sort-keys": [true, "ignore-case", "match-declaration-order"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "ignore-case",
-    "match-declaration-order"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/one-line/index.html b/docs/_site/rules/one-line/index.html deleted file mode 100644 index 24ef7fb4108..00000000000 --- a/docs/_site/rules/one-line/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: one-line - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: one-line

-

-
- - -

Requires the specified tokens to be on the same line as the expression preceding them.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • -
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • -
  • "check-else" checks that else is on the same line as the closing brace for if.
  • -
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • -
  • "check-whitespace" checks preceding whitespace for the specified tokens.
  • -
- - -
Config examples
- -
-"one-line": [true, "check-catch", "check-finally", "check-else"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-catch",
-      "check-finally",
-      "check-else",
-      "check-open-brace",
-      "check-whitespace"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/one-variable-per-declaration/index.html b/docs/_site/rules/one-variable-per-declaration/index.html deleted file mode 100644 index 244bc7da596..00000000000 --- a/docs/_site/rules/one-variable-per-declaration/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - Rule: one-variable-per-declaration - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: one-variable-per-declaration

-

-
- - -

Disallows multiple variable definitions in the same declaration statement.

- - - - - - - -

Config

- -

One argument may be optionally provided:

- -
    -
  • ignore-for-loop allows multiple variable definitions in a for loop declaration.
  • -
- - -
Config examples
- -
-"one-variable-per-declaration": true
-
- -
-"one-variable-per-declaration": [true, "ignore-for-loop"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "ignore-for-loop"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/only-arrow-functions/index.html b/docs/_site/rules/only-arrow-functions/index.html deleted file mode 100644 index 34f30022312..00000000000 --- a/docs/_site/rules/only-arrow-functions/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - Rule: only-arrow-functions - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: only-arrow-functions

-

-
- - -

Disallows traditional (non-arrow) function expressions.

- - - - -
Rationale
-

Traditional functions don’t bind lexical scope, which can lead to unexpected behavior when accessing ‘this’.

- - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • "allow-declarations" allows standalone function declarations.
  • -
  • "allow-named-functions" allows the expression function foo() {} but not function() {}.
  • -
- - - -
Config examples
- -
-"only-arrow-functions": true
-
- -
-"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-declarations",
-      "allow-named-functions"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 1
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/ordered-imports/index.html b/docs/_site/rules/ordered-imports/index.html deleted file mode 100644 index 2b0af21cb5e..00000000000 --- a/docs/_site/rules/ordered-imports/index.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - Rule: ordered-imports - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: ordered-imports

-

-
- - -

Requires that import statements be alphabetized and grouped.

- - - -

Enforce a consistent ordering for ES6 imports:

-
    -
  • Named imports must be alphabetized (i.e. “import {A, B, C} from “foo”;”) -
      -
    • The exact ordering can be controlled by the named-imports-order option.
    • -
    • “longName as name” imports are ordered by “longName”.
    • -
    -
  • -
  • Import sources must be alphabetized within groups, i.e.: - import * as foo from “a”; - import * as bar from “b”;
  • -
  • Groups of imports are delineated by blank lines. You can use these to group imports - however you like, e.g. by first- vs. third-party or thematically or can you can - enforce a grouping of third-party, parent directories and the current directory.
  • -
- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

You may set the "import-sources-order" option to control the ordering of source -imports (the "foo" in import {A, B, C} from "foo").

- -

Possible values for "import-sources-order" are:

- -
    -
  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • -
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • -
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • -
  • "any": Allow any order.
  • -
- -

You may set the "grouped-imports" option to control the grouping of source -imports (the "foo" in import {A, B, C} from "foo").

- -

Possible values for "grouped-imports" are:

- -
    -
  • false: Do not enforce grouping. (This is the default.)
  • -
  • true: Group source imports by "bar", "../baz", "./foo".
  • -
- -

You may set the "named-imports-order" option to control the ordering of named -imports (the {A, B, C} in import {A, B, C} from "foo").

- -

Possible values for "named-imports-order" are:

- -
    -
  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • -
  • "lowercase-first": Correct order is {b, A, C}.
  • -
  • "lowercase-last": Correct order is {A, C, b}.
  • -
  • "any": Allow any order.
  • -
- -

You may set the "module-source-path" option to control the ordering of imports based full path -or just the module name

- -

Possible values for "module-source-path" are:

- -
    -
  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • -
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
  • -
- - - -
Config examples
- -
-"ordered-imports": true
-
- -
-"ordered-imports": [
-  true,
-  {
-    "import-sources-order": "lowercase-last",
-    "named-imports-order": "lowercase-first"
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "grouped-imports": {
-      "type": "boolean"
-    },
-    "import-sources-order": {
-      "type": "string",
-      "enum": [
-        "case-insensitive",
-        "lowercase-first",
-        "lowercase-last",
-        "any"
-      ]
-    },
-    "named-imports-order": {
-      "type": "string",
-      "enum": [
-        "case-insensitive",
-        "lowercase-first",
-        "lowercase-last",
-        "any"
-      ]
-    },
-    "module-source-path": {
-      "type": "string",
-      "enum": [
-        "full",
-        "basename"
-      ]
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-conditional-expression/index.html b/docs/_site/rules/prefer-conditional-expression/index.html deleted file mode 100644 index 0ceb1ab03d3..00000000000 --- a/docs/_site/rules/prefer-conditional-expression/index.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - Rule: prefer-conditional-expression - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-conditional-expression

-

-
- - - -

Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

- - - - -
Rationale
- -

This reduces duplication and can eliminate an unnecessary variable declaration.

- - - - - -

Config

-

If check-else-if is specified, the rule also checks nested if-else-if statements.

- - -
Config examples
- -
-"prefer-conditional-expression": true
-
- -
-"prefer-conditional-expression": [true, "check-else-if"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "check-else-if"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-const/index.html b/docs/_site/rules/prefer-const/index.html deleted file mode 100644 index a8bd2397065..00000000000 --- a/docs/_site/rules/prefer-const/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - Rule: prefer-const - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-const

-

-
- - -

Requires that variable declarations use const instead of let and var if possible.

- - - -

If a variable is only assigned to once when it is declared, it should be declared using ‘const’

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

An optional object containing the property “destructuring” with two possible values:

- -
    -
  • “any” (default) - If any variable in destructuring can be const, this rule warns for those variables.
  • -
  • “all” - Only warns if all variables in destructuring can be const.
  • -
- - -
Config examples
- -
-"prefer-const": true
-
- -
-"prefer-const": [true, {"destructuring": "all"}]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "destructuring": {
-      "type": "string",
-      "enum": [
-        "all",
-        "any"
-      ]
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-for-of/index.html b/docs/_site/rules/prefer-for-of/index.html deleted file mode 100644 index 50b0ab9dcad..00000000000 --- a/docs/_site/rules/prefer-for-of/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Rule: prefer-for-of - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-for-of

-

-
- - -

Recommends a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated.

- - - - -
Rationale
-

A for(… of …) loop is easier to implement and read when the index is not needed.

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-for-of": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-function-over-method/index.html b/docs/_site/rules/prefer-function-over-method/index.html deleted file mode 100644 index 5a7f2260e15..00000000000 --- a/docs/_site/rules/prefer-function-over-method/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: prefer-function-over-method - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-function-over-method

-

-
- - -

Warns for class methods that do not use ‘this’.

- - - - - - - -

Config

- -

“allow-public” excludes checking of public methods. -“allow-protected” excludes checking of protected methods.

- - -
Config examples
- -
-"prefer-function-over-method": true
-
- -
-"prefer-function-over-method": [true, "allow-public", "allow-protected"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-public",
-    "allow-protected"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-method-signature/index.html b/docs/_site/rules/prefer-method-signature/index.html deleted file mode 100644 index 5e19bbedb0c..00000000000 --- a/docs/_site/rules/prefer-method-signature/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: prefer-method-signature - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-method-signature

-

-
- - -

Prefer foo(): void over foo: () => void in interfaces and types.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-method-signature": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-object-spread/index.html b/docs/_site/rules/prefer-object-spread/index.html deleted file mode 100644 index 508b297c200..00000000000 --- a/docs/_site/rules/prefer-object-spread/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - Rule: prefer-object-spread - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-object-spread

-

-
- - -

Enforces the use of the ES2015 object spread operator over Object.assign() where appropriate.

- - - - -
Rationale
-

Object spread allows for better type checking and inference.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"prefer-object-spread": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-readonly/index.html b/docs/_site/rules/prefer-readonly/index.html deleted file mode 100644 index b457aa3e537..00000000000 --- a/docs/_site/rules/prefer-readonly/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: prefer-readonly - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-readonly

-

-
- - -

Requires that private variables are marked as readonly if they’re never modified outside of the constructor.

- - - -

If a private variable is only assigned to in the constructor, it should be declared as readonly.

- - - - - -
Rationale
- -

Marking never-modified variables as readonly helps enforce the code’s intent of keeping them as never-modified. -It can also help prevent accidental changes of members not meant to be changed.

- - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

If only-inline-lambdas is specified, only immediately-declared arrow functions are checked.

- - -
Config examples
- -
-"prefer-readonly": true
-
- -
-"prefer-readonly": [true, "only-inline-lambdas"]
-
- - -
Schema
-
-{
-  "enum": [
-    "only-inline-lambdas"
-  ],
-  "type": "string"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-switch/index.html b/docs/_site/rules/prefer-switch/index.html deleted file mode 100644 index 01260987a4b..00000000000 --- a/docs/_site/rules/prefer-switch/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - Rule: prefer-switch - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-switch

-

-
- - -

Prefer a switch statement to an if statement with simple === comparisons.

- - - - - - - -

Config

- -

An optional object with the property ‘min-cases’. -This is the number cases needed before a switch statement is recommended. -Defaults to 3.

- - -
Config examples
- -
-"prefer-switch": true
-
- -
-"prefer-switch": [true, {"min-cases": 2}]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "min-cases": {
-      "type": "number"
-    }
-  }
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/prefer-template/index.html b/docs/_site/rules/prefer-template/index.html deleted file mode 100644 index 0b217edf748..00000000000 --- a/docs/_site/rules/prefer-template/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: prefer-template - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: prefer-template

-

-
- - -

Prefer a template expression over string literal concatenation.

- - - - - - - -

Config

- -

If allow-single-concat is specified, then a single concatenation (x + y) is allowed, but not more (x + y + z).

- - -
Config examples
- -
-"prefer-template": true
-
- -
-"prefer-template": [true, "allow-single-concat"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "allow-single-concat"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/promise-function-async/index.html b/docs/_site/rules/promise-function-async/index.html deleted file mode 100644 index 17910e28437..00000000000 --- a/docs/_site/rules/promise-function-async/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: promise-function-async - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: promise-function-async

-

-
- - -

Requires any function or method that returns a promise to be marked async.

- - - - -
Rationale
- -

Ensures that each function is only capable of 1) returning a rejected promise, or 2) -throwing an Error object. In contrast, non-async Promise-returning functions -are technically capable of either. This practice removes a requirement for consuming -code to handle both cases.

- - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"promise-function-async": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/quotemark/index.html b/docs/_site/rules/quotemark/index.html deleted file mode 100644 index 9eecc3cb306..00000000000 --- a/docs/_site/rules/quotemark/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: quotemark - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: quotemark

-

-
- - -

Requires single or double quotes for string literals.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "single" enforces single quotes.
  • -
  • "double" enforces double quotes.
  • -
  • "jsx-single" enforces single quotes for JSX attributes.
  • -
  • "jsx-double" enforces double quotes for JSX attributes.
  • -
  • "avoid-template" forbids single-line untagged template strings that do not contain string interpolations.
  • -
  • "avoid-escape" allows you to use the “other” quotemark in cases where escaping would normally be required. -For example, [true, "double", "avoid-escape"] would not report a failure on the string literal -'Hello "World"'.
  • -
- - -
Config examples
- -
-"quotemark": [true, "single", "avoid-escape", "avoid-template"]
-
- -
-"quotemark": [true, "single", "jsx-double"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "single",
-      "double",
-      "jsx-single",
-      "jsx-double",
-      "avoid-escape",
-      "avoid-template"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/radix/index.html b/docs/_site/rules/radix/index.html deleted file mode 100644 index 9a8ceca4e16..00000000000 --- a/docs/_site/rules/radix/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: radix - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: radix

-

-
- - -

Requires the radix parameter to be specified when calling parseInt.

- - - - -
Rationale
- -

From MDN:

-
-

Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. -Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

-
- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"radix": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/restrict-plus-operands/index.html b/docs/_site/rules/restrict-plus-operands/index.html deleted file mode 100644 index 1275aa0163f..00000000000 --- a/docs/_site/rules/restrict-plus-operands/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: restrict-plus-operands - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: restrict-plus-operands

-

-
- - -

When adding two variables, operands must both be of type number or of type string.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"restrict-plus-operands": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/return-undefined/index.html b/docs/_site/rules/return-undefined/index.html deleted file mode 100644 index 283dff0140b..00000000000 --- a/docs/_site/rules/return-undefined/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: return-undefined - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: return-undefined

-

-
- - -

Prefer return; in void functions and return undefined; in value-returning functions.

- - - - - - -
Notes:
-
- - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"return-undefined": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/semicolon/index.html b/docs/_site/rules/semicolon/index.html deleted file mode 100644 index 5ee5bc6c5ce..00000000000 --- a/docs/_site/rules/semicolon/index.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - Rule: semicolon - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: semicolon

-

-
- - -

Enforces consistent semicolon usage at the end of every statement.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One of the following arguments must be provided:

- -
    -
  • "always" enforces semicolons at the end of every statement.
  • -
  • "never" disallows semicolons at the end of every statement except for when they are necessary.
  • -
- -

The following arguments may be optionally provided:

- -
    -
  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • -
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • -
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any -other assignment. This option overrides "ignore-bound-class-methods".
  • -
- - - -
Config examples
- -
-"semicolon": [true, "always"]
-
- -
-"semicolon": [true, "never"]
-
- -
-"semicolon": [true, "always", "ignore-interfaces"]
-
- -
-"semicolon": [true, "always", "ignore-bound-class-methods"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "string",
-      "enum": [
-        "always",
-        "never"
-      ]
-    },
-    {
-      "type": "string",
-      "enum": [
-        "ignore-interfaces"
-      ]
-    }
-  ],
-  "additionalItems": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/space-before-function-paren/index.html b/docs/_site/rules/space-before-function-paren/index.html deleted file mode 100644 index 1b86f637dd2..00000000000 --- a/docs/_site/rules/space-before-function-paren/index.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - Rule: space-before-function-paren - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: space-before-function-paren

-

-
- - -

Require or disallow a space before function parenthesis

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One argument which is an object which may contain the keys anonymous, named, and asyncArrow -These should be set to either "always" or "never".

- -
    -
  • "anonymous" checks before the opening paren in anonymous functions
  • -
  • "named" checks before the opening paren in named functions
  • -
  • "asyncArrow" checks before the opening paren in async arrow functions
  • -
  • "method" checks before the opening paren in class methods
  • -
  • "constructor" checks before the opening paren in class constructors
  • -
- - - -
Config examples
- -
-"space-before-function-paren": true
-
- -
-"space-before-function-paren": [true, "always"]
-
- -
-"space-before-function-paren": [true, "never"]
-
- -
-"space-before-function-paren": [true, {"anonymous": "always", "named": "never", "asyncArrow": "always"}]
-
- - -
Schema
-
-{
-  "properties": {
-    "anonymous": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "asyncArrow": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "constructor": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "method": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    },
-    "named": {
-      "enum": [
-        "always",
-        "never"
-      ],
-      "type": "string"
-    }
-  },
-  "type": "object"
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/space-within-parens/index.html b/docs/_site/rules/space-within-parens/index.html deleted file mode 100644 index 164b8dd93b5..00000000000 --- a/docs/_site/rules/space-within-parens/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - Rule: space-within-parens - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: space-within-parens

-

-
- - -

Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

You may enforce the amount of whitespace within parentheses.

- - - -
Config examples
- - -
Schema
-
-{
-  "type": "number",
-  "min": 0
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/strict-boolean-expressions/index.html b/docs/_site/rules/strict-boolean-expressions/index.html deleted file mode 100644 index b17f9c49c8e..00000000000 --- a/docs/_site/rules/strict-boolean-expressions/index.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - Rule: strict-boolean-expressions - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: strict-boolean-expressions

-

-
- - - -

Restricts the types allowed in boolean expressions. By default only booleans are allowed.

- -

The following nodes are checked:

- -
    -
  • Arguments to the !, &&, and || operators
  • -
  • The condition in a conditional expression (cond ? x : y)
  • -
  • Conditions for if, for, while, and do-while statements.
  • -
- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

- -

These options may be provided:

- -
    -
  • allow-null-union allows union types containing null. -
      -
    • It does not allow null itself.
    • -
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • -
    -
  • -
  • allow-undefined-union allows union types containing undefined. -
      -
    • It does not allow undefined itself.
    • -
    • Without the ‘–strictNullChecks’ compiler option, this will allow anything other than a string, number, or enum.
    • -
    -
  • -
  • allow-string allows strings. -
      -
    • It does not allow unions containing string.
    • -
    • It does not allow string literal types.
    • -
    -
  • -
  • allow-number allows numbers. -
      -
    • It does not allow unions containing number.
    • -
    • It does not allow enums or number literal types.
    • -
    -
  • -
  • allow-mix allows multiple of the above to appear together. -
      -
    • For example, string | number or RegExp | null | undefined would normally not be allowed.
    • -
    • A type like "foo" | "bar" | undefined is always allowed, because it has only one way to be false.
    • -
    -
  • -
  • allow-boolean-or-undefined allows boolean | undefined. -
      -
    • Also allows true | false | undefined.
    • -
    • Does not allow false | undefined.
    • -
    • This option is a subset of allow-undefined-union, so you don’t need to enable both options at the same time.
    • -
    -
  • -
- - - -
Config examples
- -
-"strict-boolean-expressions": true
-
- -
-"strict-boolean-expressions": [
-  true,
-  "allow-null-union",
-  "allow-undefined-union",
-  "allow-string",
-  "allow-number"
-]
-
- -
-"strict-boolean-expressions": [true, "allow-boolean-or-undefined"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-null-union",
-      "allow-undefined-union",
-      "allow-string",
-      "allow-number",
-      "allow-boolean-or-undefined"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/strict-type-predicates/index.html b/docs/_site/rules/strict-type-predicates/index.html deleted file mode 100644 index 90551c4f0ac..00000000000 --- a/docs/_site/rules/strict-type-predicates/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - Rule: strict-type-predicates - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: strict-type-predicates

-

-
- - - -

Warns for type predicates that are always true or always false. -Works for ‘typeof’ comparisons to constants (e.g. ‘typeof foo === “string”’), and equality comparison to ‘null’/’undefined’. -(TypeScript won’t let you compare ‘1 === 2’, but it has an exception for ‘1 === undefined’.) -Does not yet work for ‘instanceof’. -Does not warn for ‘if (x.y)’ where ‘x.y’ is always truthy. For that, see strict-boolean-expressions.

- -

This rule requires strictNullChecks to work properly.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"strict-type-predicates": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/switch-default/index.html b/docs/_site/rules/switch-default/index.html deleted file mode 100644 index 9a259fcd44a..00000000000 --- a/docs/_site/rules/switch-default/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: switch-default - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: switch-default

-

-
- - -

Require a default case in all switch statements.

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"switch-default": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/switch-final-break/index.html b/docs/_site/rules/switch-final-break/index.html deleted file mode 100644 index a3c7ec04bea..00000000000 --- a/docs/_site/rules/switch-final-break/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Rule: switch-final-break - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: switch-final-break

-

-
- - -

Checks whether the final clause of a switch statement ends in break;.

- - - - - - - -

Config

- -

If no options are passed, a final ‘break;’ is forbidden. -If the “always” option is passed this will require a ‘break;’ to always be present -unless control flow is escaped in some other way.

- - -
Config examples
- -
-"switch-final-break": true
-
- -
-"switch-final-break": [true, "always"]
-
- - -
Schema
-
-{
-  "type": "string",
-  "enum": [
-    "always"
-  ]
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/trailing-comma/index.html b/docs/_site/rules/trailing-comma/index.html deleted file mode 100644 index 91ca73fee0e..00000000000 --- a/docs/_site/rules/trailing-comma/index.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - Rule: trailing-comma - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: trailing-comma

-

-
- - - -

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, -named imports and exports and function parameters.

- - - - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

One argument which is an object with the keys multiline and singleline. -Both can be set to a string ("always" or "never") or an object.

- -

The object can contain any of the following keys: "arrays", "objects", "functions", -"imports", "exports", and "typeLiterals"; each key can have one of the following -values: "always", "never", and "ignore". Any missing keys will default to "ignore".

- -
    -
  • "multiline" checks multi-line object literals.
  • -
  • "singleline" checks single-line object literals.
  • -
- -

An array is considered “multiline” if its closing bracket is on a line -after the last array element. The same general logic is followed for -object literals, function typings, named import statements -and function parameters.

- -

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, -there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on -object and array rest and rest parameters.

- - - -
Config examples
- -
-"trailing-comma": [true, {"multiline": "always", "singleline": "never"}]
-
- -
-"trailing-comma": [
-  true,
-  {
-    "multiline": {
-      "objects": "always",
-      "arrays": "always",
-      "functions": "never",
-      "typeLiterals": "ignore"
-    },
-    "esSpecCompliant": true
-  }
-]
-
- - -
Schema
-
-{
-  "type": "object",
-  "properties": {
-    "multiline": {
-      "anyOf": [
-        {
-          "type": "string",
-          "enum": [
-            "always",
-            "never"
-          ]
-        },
-        {
-          "type": "object",
-          "properties": {
-            "arrays": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "exports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "functions": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "imports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "objects": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "typeLiterals": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            }
-          }
-        }
-      ]
-    },
-    "singleline": {
-      "anyOf": [
-        {
-          "type": "string",
-          "enum": [
-            "always",
-            "never"
-          ]
-        },
-        {
-          "type": "object",
-          "properties": {
-            "arrays": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "exports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "functions": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "imports": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "objects": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            },
-            "typeLiterals": {
-              "type": "string",
-              "enum": [
-                "always",
-                "never",
-                "ignore"
-              ]
-            }
-          }
-        }
-      ]
-    },
-    "esSpecCompliant": {
-      "type": "boolean"
-    }
-  },
-  "additionalProperties": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/triple-equals/index.html b/docs/_site/rules/triple-equals/index.html deleted file mode 100644 index e1a52692712..00000000000 --- a/docs/_site/rules/triple-equals/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Rule: triple-equals - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: triple-equals

-

-
- - -

Requires === and !== in place of == and !=.

- - - - - - - -

Config

- -

Two arguments may be optionally provided:

- -
    -
  • "allow-null-check" allows == and != when comparing to null.
  • -
  • "allow-undefined-check" allows == and != when comparing to undefined.
  • -
- - -
Config examples
- -
-"triple-equals": true
-
- -
-"triple-equals": [true, "allow-null-check"]
-
- -
-"triple-equals": [true, "allow-undefined-check"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "allow-null-check",
-      "allow-undefined-check"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 2
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/type-literal-delimiter/index.html b/docs/_site/rules/type-literal-delimiter/index.html deleted file mode 100644 index cc11e78c589..00000000000 --- a/docs/_site/rules/type-literal-delimiter/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: type-literal-delimiter - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: type-literal-delimiter

-

-
- - - -

Checks that type literal members are separated by semicolons. -Enforces a trailing semicolon for multiline type literals.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"type-literal-delimiter": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typedef-whitespace/index.html b/docs/_site/rules/typedef-whitespace/index.html deleted file mode 100644 index 9577ca446ee..00000000000 --- a/docs/_site/rules/typedef-whitespace/index.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - Rule: typedef-whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typedef-whitespace

-

-
- - -

Requires or disallows whitespace for type definitions.

- - -

Determines if a space is required or not before the colon in a type specifier.

- - - - - - -
Notes:
-
- - TS Only - - - Has Fixer - - -
- - -

Config

- -

Two arguments which are both objects. -The first argument specifies how much space should be to the left of a typedef colon. -The second argument specifies how much space should be to the right of a typedef colon. -Each key should have a value of "onespace", "space" or "nospace". -Possible keys are:

- -
    -
  • "call-signature" checks return type of functions.
  • -
  • "index-signature" checks index type specifier of indexers.
  • -
  • "parameter" checks function parameters.
  • -
  • "property-declaration" checks object property declarations.
  • -
  • "variable-declaration" checks variable declaration.
  • -
- - -
Config examples
- -
-"typedef-whitespace": [
-  true,
-  {
-    "call-signature": "nospace",
-    "index-signature": "nospace",
-    "parameter": "nospace",
-    "property-declaration": "nospace",
-    "variable-declaration": "nospace"
-  },
-  {
-    "call-signature": "onespace",
-    "index-signature": "onespace",
-    "parameter": "onespace",
-    "property-declaration": "onespace",
-    "variable-declaration": "onespace"
-  }
-]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": [
-    {
-      "type": "object",
-      "properties": {
-        "call-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "index-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "parameter": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "property-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "variable-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        }
-      },
-      "additionalProperties": false
-    },
-    {
-      "type": "object",
-      "properties": {
-        "call-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "index-signature": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "parameter": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "property-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        },
-        "variable-declaration": {
-          "type": "string",
-          "enum": [
-            "nospace",
-            "onespace",
-            "space"
-          ]
-        }
-      },
-      "additionalProperties": false
-    }
-  ],
-  "additionalItems": false
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typedef/index.html b/docs/_site/rules/typedef/index.html deleted file mode 100644 index db818114025..00000000000 --- a/docs/_site/rules/typedef/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Rule: typedef - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typedef

-

-
- - -

Requires type definitions to exist.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

- -

Several arguments may be optionally provided:

- -
    -
  • "call-signature" checks return type of functions.
  • -
  • "arrow-call-signature" checks return type of arrow functions.
  • -
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • -
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • -
  • "property-declaration" checks return types of interface properties.
  • -
  • "variable-declaration" checks non-binding variable declarations.
  • -
  • "member-variable-declaration" checks member variable declarations.
  • -
  • "object-destructuring" checks object destructuring declarations.
  • -
  • "array-destructuring" checks array destructuring declarations.
  • -
- - -
Config examples
- -
-"typedef": [true, "call-signature", "parameter", "member-variable-declaration"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "call-signature",
-      "arrow-call-signature",
-      "parameter",
-      "arrow-parameter",
-      "property-declaration",
-      "variable-declaration",
-      "member-variable-declaration",
-      "object-destructuring",
-      "array-destructuring"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 7
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/typeof-compare/index.html b/docs/_site/rules/typeof-compare/index.html deleted file mode 100644 index 8bf29aeea38..00000000000 --- a/docs/_site/rules/typeof-compare/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Rule: typeof-compare - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: typeof-compare

-

-
- - -

Makes sure result of typeof is compared to correct string values

- - - - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"typeof-compare": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/unified-signatures/index.html b/docs/_site/rules/unified-signatures/index.html deleted file mode 100644 index 35d5c431165..00000000000 --- a/docs/_site/rules/unified-signatures/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - Rule: unified-signatures - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: unified-signatures

-

-
- - -

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

- - - - - - -
Notes:
-
- - TS Only - - - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"unified-signatures": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/use-default-type-parameter/index.html b/docs/_site/rules/use-default-type-parameter/index.html deleted file mode 100644 index 00af31cac99..00000000000 --- a/docs/_site/rules/use-default-type-parameter/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - Rule: use-default-type-parameter - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: use-default-type-parameter

-

-
- - -

Warns if an explicitly specified type argument is the default for that type parameter.

- - - - - - -
Notes:
-
- - TS Only - - - - Requires Type Info - -
- - -

Config

-

Not configurable.

- - -
Config examples
- -
-"use-default-type-parameter": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/use-isnan/index.html b/docs/_site/rules/use-isnan/index.html deleted file mode 100644 index a857b2254da..00000000000 --- a/docs/_site/rules/use-isnan/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - Rule: use-isnan - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: use-isnan

-

-
- - -

Enforces use of the isNaN() function to check for NaN references instead of a comparison to the NaN constant.

- - - - -
Rationale
- -

Since NaN !== NaN, comparisons with regular operators will produce unexpected results. -So, instead of if (myVar === NaN), do if (isNaN(myVar)).

- - - - - -

Config

-

Not configurable.

- - -
Config examples
- -
-"use-isnan": true
-
- - -
Schema
-
-null
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/variable-name/index.html b/docs/_site/rules/variable-name/index.html deleted file mode 100644 index 591b3432fce..00000000000 --- a/docs/_site/rules/variable-name/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - Rule: variable-name - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: variable-name

-

-
- - -

Checks variable names for various errors.

- - - - - - - -

Config

- -

Five arguments may be optionally provided:

- -
    -
  • "check-format": allows only lowerCamelCased or UPPER_CASED variable names -
      -
    • "allow-leading-underscore" allows underscores at the beginning (only has an effect if “check-format” specified)
    • -
    • "allow-trailing-underscore" allows underscores at the end. (only has an effect if “check-format” specified)
    • -
    • "allow-pascal-case" allows PascalCase in addition to lowerCamelCase.
    • -
    • "allow-snake-case" allows snake_case in addition to lowerCamelCase.
    • -
    -
  • -
  • "ban-keywords": disallows the use of certain TypeScript keywords as variable or parameter names. -
      -
    • These are: any, Number, number, String, string, Boolean, boolean, Undefined, undefined
    • -
    -
  • -
- - -
Config examples
- -
-"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-format",
-      "allow-leading-underscore",
-      "allow-trailing-underscore",
-      "allow-pascal-case",
-      "allow-snake-case",
-      "ban-keywords"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 5
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/rules/whitespace/index.html b/docs/_site/rules/whitespace/index.html deleted file mode 100644 index 39b41928e7e..00000000000 --- a/docs/_site/rules/whitespace/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - Rule: whitespace - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Rule: whitespace

-

-
- - -

Enforces whitespace style conventions.

- - - - -
Rationale
-

Helps maintain a readable, consistent style in your codebase.

- - - - -
Notes:
-
- - - Has Fixer - - -
- - -

Config

- -

Ten arguments may be optionally provided:

- -
    -
  • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
  • -
  • "check-decl"checks that variable declarations have whitespace around the equals token.
  • -
  • "check-operator" checks for whitespace around operator tokens.
  • -
  • "check-module" checks for whitespace in import & export statements.
  • -
  • "check-separator" checks for whitespace after separator tokens (,/;).
  • -
  • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
  • -
  • "check-type" checks for whitespace before a variable type specification.
  • -
  • "check-typecast" checks for whitespace between a typecast and its target.
  • -
  • "check-type-operator" checks for whitespace between type operators | and &.
  • -
  • "check-preblock" checks for whitespace before the opening brace of a block
  • -
- - -
Config examples
- -
-"whitespace": [true, "check-branch", "check-operator", "check-typecast"]
-
- - -
Schema
-
-{
-  "type": "array",
-  "items": {
-    "type": "string",
-    "enum": [
-      "check-branch",
-      "check-decl",
-      "check-operator",
-      "check-module",
-      "check-separator",
-      "check-rest-spread",
-      "check-type",
-      "check-typecast",
-      "check-type-operator",
-      "check-preblock"
-    ]
-  },
-  "minLength": 0,
-  "maxLength": 10
-}
-
- - - -
-
- - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/cli/index.html b/docs/_site/usage/cli/index.html deleted file mode 100644 index 770702a244e..00000000000 --- a/docs/_site/usage/cli/index.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - TSLint command-line interface - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint command-line interface

-

-
- - -

Installation

- -

Local (in your project’s working directory):

- -
npm install tslint typescript --save-dev
-# or
-yarn add tslint typescript --dev
-
- -

Global:

- -
npm install tslint typescript -g
-# or
-yarn global add tslint typescript
-
- -
Peer dependencies
- -

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. -This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

- -

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

- -

CLI Usage

- -

Please ensure that the TypeScript source files compile correctly before running the linter.

- -

Usage: tslint [options] [file ...]

- -

Options:

- -
-v, --version                          output the version number
--c, --config [config]                  configuration file
--e, --exclude <exclude>                exclude globs from path expansion
---fix                                  fixes linting errors for select rules (this may overwrite linted files)
---force                                return status code 0 even if there are lint errors
--i, --init                             generate a tslint.json config file in the current working directory
--o, --out [out]                        output file
---outputAbsolutePaths                  whether or not outputted file paths are absolute
--r, --rules-dir [rules-dir]            rules directory
--s, --formatters-dir [formatters-dir]  formatters directory
--t, --format [format]                  output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)
---test                                 test that tslint produces the correct output for the specified directory
--p, --project [project]                tsconfig.json file
---type-check                           (deprecated) check for type errors before linting the project
--h, --help                             output usage information
-
- -

By default, TSLint looks for a configuration file named tslint.json in the directory -of the file being linted and, if not found, searches ancestor directories. Check out the rules section for more details on what rules are available.

- -

tslint accepts the following command-line options:

- -
-c, --config:
-    The location of the configuration file that tslint will use to
-    determine which rules are activated and what options to provide
-    to the rules. If no option is specified, the config file named
-    tslint.json is used, so long as it exists in the path.
-    The format of the file is { rules: { /* rules list */ } },
-    where /* rules list */ is a key: value comma-separated list of
-    rulename: rule-options pairs. Rule-options can be either a
-    boolean true/false value denoting whether the rule is used or not,
-    or a list [boolean, ...] where the boolean provides the same role
-    as in the non-list case, and the rest of the list are options passed
-    to the rule that will determine what it checks for (such as number
-    of characters for the max-line-length rule, or what functions to ban
-    for the ban rule).
-
--e, --exclude:
-    A filename or glob which indicates files to exclude from linting.
-    This option can be supplied multiple times if you need multiple
-    globs to indicate which files to exclude.
-
---fix:
-    Fixes linting errors for select rules. This may overwrite linted files.
-
---force:
-    Return status code 0 even if there are any lint errors.
-    Useful while running as npm script.
-
--i, --init:
-    Generates a tslint.json config file in the current working directory.
-
--o, --out:
-    A filename to output the results to. By default, tslint outputs to
-    stdout, which is usually the console where you're running it from.
-
---outputAbsolutePaths:
-    If true, all paths in the output will be absolute.
-
--r, --rules-dir:
-    An additional rules directory, for user-created rules.
-    tslint will always check its default rules directory, in
-    node_modules/tslint/lib/rules, before checking the user-provided
-    rules directory, so rules in the user-provided rules directory
-    with the same name as the base rules will not be loaded.
-
--s, --formatters-dir:
-    An additional formatters directory, for user-created formatters.
-    Formatters are files that will format the tslint output, before
-    writing it to stdout or the file passed in --out. The default
-    directory, node_modules/tslint/build/formatters, will always be
-    checked first, so user-created formatters with the same names
-    as the base formatters will not be loaded.
-
--t, --format:
-    The formatter to use to format the results of the linter before
-    outputting it to stdout or the file passed in --out. The core
-    formatters are prose (human readable), json (machine readable)
-    and verbose. prose is the default if this option is not used.
-    Other built-in options include pmd, msbuild, checkstyle, and vso.
-    Additional formatters can be added and used if the --formatters-dir
-    option is set.
-
---test:
-    Runs tslint on matched directories and checks if tslint outputs
-    match the expected output in .lint files. Automatically loads the
-    tslint.json files in the directories as the configuration file for
-    the tests. See the full tslint documentation for more details on how
-    this can be used to test custom rules.
-
--p, --project:
-    The path or directory containing a tsconfig.json file that will be
-    used to determine which files will be linted. This flag also enables
-    rules that require the type checker.
-
---type-check:
-    (deprecated) Checks for type errors before linting a project.
-    --project must be specified in order to enable type checking.
-
--v, --version:
-    The current version of tslint.
-
--h, --help:
-    Prints this help message.
-
- -

Exit Codes

- -

The CLI process may exit with the following codes:

- -
    -
  • 0: Linting succeeded without errors (warnings may have occurred)
  • -
  • 1: An invalid command line argument or combination thereof was used
  • -
  • 2: Linting failed with one or more rule violations with severity error
  • -
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/configuration/index.html b/docs/_site/usage/configuration/index.html deleted file mode 100644 index 8396f37921a..00000000000 --- a/docs/_site/usage/configuration/index.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - Configuring TSLint - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Configuring TSLint

-

-
- - -

TSLint Configuration

- -

When using the CLI or many third-party tools, a file named tslint.json or tslint.yaml is used to -configure which rules get run and each of their options.

- -

tslint.json or tslint.yaml files can have the following fields specified:

- -
    -
  • extends?: string | string[]: -The name of a built-in configuration preset (see built-in presets below), or a path or -array of paths to other configuration files which are extended by this configuration. -This value is handled using node module resolution semantics. -For example, a value of "tslint-config" would tell TSLint to try and load the main file of a module -named “tslint-config” as a configuration file. Specific files inside node modules can also be -specified, eg. "tslint-config/path/to/submodule". Relative paths to JSON files or JS modules -are also supported, e.g. "./tslint-config".
  • -
  • rulesDirectory?: string | string[]: -A path to a directory or an array of paths to directories of custom rules. These values are handled using node module resolution semantics, if an index.js is placed in your rules directory. We fallback to use relative or absolute paths, if the module can’t be resolved. If you want to avoid module resolution you can directly use a relative or absolute path (e.g. with ./).
  • -
  • rules?: { [name: string]: RuleSetting }: A map of rule names to their configuration settings. -
      -
    • These rules are applied to .ts and .tsx files.
    • -
    • Each rule is associated with an object containing: -
        -
      • options?: any: An array of values that are specific to a rule.
      • -
      • severity?: "default" | "error" | "warning" | "off": Severity level. Level “error” will cause exit code 2.
      • -
      -
    • -
    • A boolean value may be specified instead of the above object, and is equivalent to setting no options with default severity.
    • -
    • Any rules specified in this block will override those configured in any base configuration being extended.
    • -
    • Check out the full rules list here.
    • -
    -
  • -
  • jsRules?: any: Same format as rules. These rules are applied to .js and .jsx files.
  • -
  • defaultSeverity?: "error" | "warning" | "off": The severity level used when a rule specifies a default warning level. If undefined, “error” is used. This value is not inherited and is only applied to rules in this file.
  • -
  • linterOptions?: { exclude?: string[] }: -
      -
    • exclude: string[]: An array of globs. Any file matching these globs will not be linted. All exclude patterns are relative to the configuration file they were specified in.
    • -
    -
  • -
- -

tslint.json configuration files may have JavaScript-style // single-line and /* multi-line */ comments in them (even though this is technically invalid JSON). If this confuses your syntax highlighter, you may want to switch it to JavaScript format.

- -

An example tslint.json file might look like this:

- -
{
-    "extends": "tslint:recommended",
-    "rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"],
-    "rules": {
-        "max-line-length": {
-            "options": [120]
-        },
-        "new-parens": true,
-        "no-arg": true,
-        "no-bitwise": true,
-        "no-conditional-assignment": true,
-        "no-consecutive-blank-lines": false,
-        "no-console": {
-            "severity": "warning",
-            "options": [
-                "debug",
-                "info",
-                "log",
-                "time",
-                "timeEnd",
-                "trace",
-            ]
-        }
-    },
-    "jsRules": {
-        "max-line-length": {
-            "options": [120]
-        }
-    }
-}
-
- -

The corresponding YAML file looks like this:

- -
---
-extends: "tslint:recommended"
-rulesDirectory:
-    - path/to/custom/rules/directory/
-    - another/path/
-rules:
-    max-line-length:
-        options: [120]
-    new-parens: true
-    no-arg: true
-    no-bitwise: true
-    no-conditional-assignment: true
-    no-consecutive-blank-lines: false
-    no-console:
-        severity: warning
-        options:
-            - debug
-            - info
-            - log
-            - time
-            - timeEnd
-            - trace
-jsRules:
-    max-line-length:
-        options: [120]
-...
-
- -

Rule severity

- -

The severity level of each rule can can be configured to default, error, warning/warn, or off/none. If no severity level is specified, default is used. The defaultSeverity top-level option replaces the severity level for each rule that uses severity level default in the current file. Valid values for defaultSeverity include error, warning/warn, and off/none.

- -

Configuration presets

- -

TSLint ships with a handful of built-in configurations presets. You may inspect their source here.

- -

tslint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will not have breaking changes across minor or patch releases.

- -

tslint:latest extends tslint:recommended and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, tslint:recommended will be updated to be identical to tslint:latest.

- -

tslint:all turns on all rules to their strictest settings. This will use type checking, so it must be combined with the --project option. -(Exceptions include rules such as "ban", "import-blacklist", and "file-header", which have no sensible defaults, and deprecated rules.)

- -

Custom rules

- -

If TSLint’s core rules don’t have all the lint checks you’re looking for, -you may write your own custom rules or use custom rules that others have developed.

- -

Some commonly used custom rule packages in the TSLint community are listed in the -README.

- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/library/index.html b/docs/_site/usage/library/index.html deleted file mode 100644 index b34cb6228f6..00000000000 --- a/docs/_site/usage/library/index.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - Using TSLint as a Node.js library - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Using TSLint as a Node.js library

-

-
- - -

Installation

- -
npm install tslint typescript
-# or
-yarn add tslint typescript
-
- -
Peer dependencies
- -

The typescript package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. -This also means that tslint will have to use the same version of tsc which is used to actually compile your sources.

- -

Although the peer dependency allows installing the latest nightly releases of typescript@next, be aware that these might include breaking changes that cause the linter to malfunction.

- -

Library usage

- -

Please ensure that the TypeScript source files compile correctly before running the linter.

- -

TypeScript

- -

This code will need to be transpiled to JavaScript to run under Node.js.

- -
import { Linter, Configuration } from "tslint";
-import * as fs from "fs";
-
-const fileName = "Specify input file name";
-const configurationFilename = "Specify configuration file name";
-const options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-
-const fileContents = fs.readFileSync(fileName, "utf8");
-const linter = new Linter(options);
-const configuration = Configuration.findConfiguration(configurationFilename, fileName).results;
-linter.lint(fileName, fileContents, configuration);
-const result = linter.getResult();
-
- -

JavaScript (ES5)

- -

This code will run directly under Node.js, including if it’s called from the command line.

- -
"use strict";
-var tslint = require("tslint");
-var fs = require("fs");
-var fileName = "Specify input file name";
-var configurationFilename = "Specify configuration file name";
-var options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-var fileContents = fs.readFileSync(fileName, "utf8");
-var linter = new tslint.Linter(options);
-var configuration = tslint.Configuration.findConfiguration(configurationFilename, fileName).results;
-linter.lint(fileName, fileContents, configuration);
-var result = linter.getResult();
-
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/rule-flags/index.html b/docs/_site/usage/rule-flags/index.html deleted file mode 100644 index 68c2da9dd46..00000000000 --- a/docs/_site/usage/rule-flags/index.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - TSLint rule flags - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

TSLint rule flags

-

-
- - -

Comment flags in source code

- -

In addition to global configuration, you may also enable/disable linting or a subset of lint rules within a file with the following comment rule flags:

- -
    -
  • /* tslint:disable */ - Disable all rules for the rest of the file
  • -
  • /* tslint:enable */ - Enable all rules for the rest of the file
  • -
  • /* tslint:disable:rule1 rule2 rule3... */ - Disable the listed rules for the rest of the file
  • -
  • /* tslint:enable:rule1 rule2 rule3... */ - Enable the listed rules for the rest of the file
  • -
  • // tslint:disable-next-line - Disables all rules for the following line
  • -
  • someCode(); // tslint:disable-line - Disables all rules for the current line
  • -
  • // tslint:disable-next-line:rule1 rule2 rule3... - Disables the listed rules for the next line
  • -
  • etc.
  • -
- -

Rules flags enable or disable rules as they are parsed. Disabling an already disabled rule or enabling an already enabled rule has no effect. Enabling a rule that is not present or disabled in tslint.json has also no effect.

- -

For example, imagine the directive /* tslint:disable */ on the first line of a file, /* tslint:enable:ban class-name */ on the 10th line and /* tslint:enable */ on the 20th. No rules will be checked between the 1st and 10th lines, only the ban and class-name rules will be checked between the 10th and 20th, and all rules will be checked for the remainder of the file.

- -

Here’s an example:

- -
function validRange (range: any) {
-   return range.min <= range.middle && range.middle <= range.max;
-}
-
-/* tslint:disable:object-literal-sort-keys */
-const range = {
-   min: 5,
-   middle: 10,    // TSLint will *not* warn about unsorted keys here
-   max: 20
-};
-/* tslint:enable:object-literal-sort-keys */
-
-const point = {
-   x: 3,
-   z: 5,          // TSLint will warn about unsorted keys here
-   y: 4,
-}
-
-console.log(validRange(range));
-
- - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/third-party-tools/index.html b/docs/_site/usage/third-party-tools/index.html deleted file mode 100644 index c34ca08b36b..00000000000 --- a/docs/_site/usage/third-party-tools/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - Third-Party Tools - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Third-Party Tools

-

-
- - -

A variety of tools and libraries are available to help you integrate TSLint automatically into your build process or IDE. Please see their respective sites for usage.

- -

Note: Most of these tools are not maintained by TSLint.

- - - - -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - - diff --git a/docs/_site/usage/type-checking/index.html b/docs/_site/usage/type-checking/index.html deleted file mode 100644 index 19fbe5be788..00000000000 --- a/docs/_site/usage/type-checking/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - Type Checking - - - - - - - - - - - -
- - -
- - -
-
-
- -
-

Type Checking

-

-
- - -

Semantic lint rules

- -

Some TSLint rules go further than linting code syntax. Semantic rules use the compiler’s program APIs to inspect static types and validate code patterns.

- -
CLI
- -

When using the CLI, use the --project flag and specify your tsconfig.json to enable rules that work with the type checker. TSLint will lint all files included in your project as specified in tsconfig.json.

- -
tslint --project tsconfig.json --config tslint.json # lints every file in your project
-tslint -p . -c tslint.json # shorthand of the command above
-tslint -p tsconfig.json --exclude '**/*.d.ts' # lint all files in the project excluding declaration files
-tslint -p tsconfig.json **/*.ts # ignores files in tsconfig.json and uses the provided glob instead
-
- -
Library
- -

To enable rules that work with the type checker, a TypeScript program object must be passed to the linter when using the programmatic API. Helper functions are provided to create a program from a tsconfig.json file. A project directory can be specified if project files do not lie in the same directory as the tsconfig.json file.

- -
import { Linter, Configuration } from "tslint";
-
-const configurationFilename = "Specify configuration file name";
-const options = {
-    fix: false,
-    formatter: "json",
-    rulesDirectory: "customRules/",
-    formattersDirectory: "customFormatters/"
-};
-
-const program = Linter.createProgram("tsconfig.json", "projectDir/");
-const linter = new Linter(options, program);
-
-const files = Linter.getFileNames(program);
-files.forEach(file => {
-    const fileContents = program.getSourceFile(file).getFullText();
-    const configuration = Configuration.findConfiguration(configurationFilename, file).results;
-    linter.lint(file, fileContents, configuration);
-});
-
-const results = linter.getResult();
-
- -
-
- - - - - - - - - - - - - - -
- -
- - - -
- - - -