diff --git a/docs/src/rules/indent-legacy.md b/docs/src/rules/indent-legacy.md index c3543133be4..a8097b22932 100644 --- a/docs/src/rules/indent-legacy.md +++ b/docs/src/rules/indent-legacy.md @@ -140,20 +140,23 @@ function foo(d) { Examples of **correct** code for this rule with the `"tab"` option: + + ::: correct ```js /*eslint indent-legacy: ["error", "tab"]*/ if (a) { -/*tab*/b=c; -/*tab*/function foo(d) { -/*tab*//*tab*/e=f; -/*tab*/} + b=c; + function foo(d) { + e=f; + } } ``` ::: + ### SwitchCase diff --git a/docs/src/rules/indent.md b/docs/src/rules/indent.md index 72efad26568..ea700b240bb 100644 --- a/docs/src/rules/indent.md +++ b/docs/src/rules/indent.md @@ -141,20 +141,23 @@ function foo(d) { Examples of **correct** code for this rule with the `"tab"` option: + + ::: correct ```js /*eslint indent: ["error", "tab"]*/ if (a) { -/*tab*/b=c; -/*tab*/function foo(d) { -/*tab*//*tab*/e=f; -/*tab*/} + b=c; + function foo(d) { + e=f; + } } ``` ::: + ### ignoredNodes diff --git a/docs/src/rules/max-len.md b/docs/src/rules/max-len.md index eabd3efc4c6..fb3310269e3 100644 --- a/docs/src/rules/max-len.md +++ b/docs/src/rules/max-len.md @@ -69,30 +69,36 @@ var foo = { Examples of **incorrect** code for this rule with the default `{ "tabWidth": 4 }` option: + + ::: incorrect ```js /*eslint max-len: ["error", { "code": 80, "tabWidth": 4 }]*/ -\t \t var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } }; + var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } }; ``` ::: + Examples of **correct** code for this rule with the default `{ "tabWidth": 4 }` option: + + ::: correct ```js /*eslint max-len: ["error", { "code": 80, "tabWidth": 4 }]*/ -\t \t var foo = { -\t \t \t \t "bar": "This is a bar.", -\t \t \t \t "baz": { "qux": "This is a qux" } -\t \t }; + var foo = { + "bar": "This is a bar.", + "baz": { "qux": "This is a qux" } + }; ``` ::: + ### comments @@ -203,7 +209,8 @@ Examples of **correct** code for this rule with the `ignorePattern` option: ::: correct ```js -/*eslint max-len: ["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(" }]*/ +/*eslint max-len: +["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(" }]*/ var dep = require('really/really/really/really/really/really/really/really/long/module'); ``` diff --git a/docs/src/rules/no-mixed-spaces-and-tabs.md b/docs/src/rules/no-mixed-spaces-and-tabs.md index 29f82e2191f..39c230b2dca 100644 --- a/docs/src/rules/no-mixed-spaces-and-tabs.md +++ b/docs/src/rules/no-mixed-spaces-and-tabs.md @@ -15,42 +15,42 @@ This rule disallows mixed spaces and tabs for indentation. Examples of **incorrect** code for this rule: + + ::: incorrect ```js /*eslint no-mixed-spaces-and-tabs: "error"*/ function add(x, y) { -// --->..return x + y; - - return x + y; + return x + y; } function main() { -// --->var x = 5, -// --->....y = 7; - - var x = 5, - y = 7; + var x = 5, + y = 7; } ``` ::: + Examples of **correct** code for this rule: + + ::: correct ```js /*eslint no-mixed-spaces-and-tabs: "error"*/ function add(x, y) { -// --->return x + y; - return x + y; + return x + y; } ``` ::: + ## Options @@ -62,18 +62,18 @@ This rule has a string option. Examples of **correct** code for this rule with the `"smart-tabs"` option: + + ::: correct ```js /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/ function main() { -// --->var x = 5, -// --->....y = 7; - - var x = 5, - y = 7; + var x = 5, + y = 7; } ``` ::: + diff --git a/docs/src/rules/no-tabs.md b/docs/src/rules/no-tabs.md index 316db6203f3..c105b6a8193 100644 --- a/docs/src/rules/no-tabs.md +++ b/docs/src/rules/no-tabs.md @@ -12,26 +12,33 @@ This rule looks for tabs anywhere inside a file: code, comments or anything else Examples of **incorrect** code for this rule: + + ::: incorrect ```js -var a \t= 2; +/* eslint no-tabs: "error" */ + +var a = 2; /** -* \t\t it's a test function +* it's a test function */ function test(){} -var x = 1; // \t test +var x = 1; // test ``` ::: + Examples of **correct** code for this rule: ::: correct ```js +/* eslint no-tabs: "error" */ + var a = 2; /** @@ -54,19 +61,22 @@ This rule has an optional object option with the following properties: Examples of **correct** code for this rule with the `allowIndentationTabs: true` option: + + ::: correct ```js /* eslint no-tabs: ["error", { allowIndentationTabs: true }] */ function test() { -\tdoSomething(); + doSomething(); } -\t// comment with leading indentation tab + // comment with leading indentation tab ``` ::: + ## When Not To Use It