Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions docs/src/rules/camelcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Examples of **incorrect** code for this rule with the default `{ "properties": "

import { no_camelcased } from "external-module"

var my_favorite_color = "#112C85";
const my_favorite_color = "#112C85";

function do_something() {
// ...
Expand All @@ -57,15 +57,15 @@ function baz({ no_camelcased = 'default value' }) {
// ...
};

var obj = {
const obj = {
my_pref: 1
};

var { category_id = 1 } = query;
const { category_id = 1 } = query;

var { foo: snake_cased } = bar;
const { foo: snake_cased } = bar;

var { foo: bar_baz = 1 } = quz;
const { foo: bar_baz = 1 } = quz;
```

:::
Expand All @@ -79,18 +79,18 @@ Examples of **correct** code for this rule with the default `{ "properties": "al

import { no_camelcased as camelCased } from "external-module";

var myFavoriteColor = "#112C85";
var _myFavoriteColor = "#112C85";
var myFavoriteColor_ = "#112C85";
var MY_FAVORITE_COLOR = "#112C85";
var foo1 = bar.baz_boom;
var foo2 = { qux: bar.baz_boom };
const myFavoriteColor = "#112C85";
const _myFavoriteColor = "#112C85";
const myFavoriteColor_ = "#112C85";
const MY_FAVORITE_COLOR = "#112C85";
const foo1 = bar.baz_boom;
const foo2 = { qux: bar.baz_boom };

obj.do_something();
do_something();
new do_something();

var { category_id: category } = query;
const { category_id: category } = query;

function foo({ isCamelCased }) {
// ...
Expand All @@ -104,11 +104,11 @@ function baz({ isCamelCased = 'default value' }) {
// ...
};

var { categoryId = 1 } = query;
const { categoryId = 1 } = query;

var { foo: isCamelCased } = bar;
const { foo: isCamelCased } = bar;

var { foo: isCamelCased = 1 } = quz;
const { foo: camelCasedName = 1 } = quz;

```

Expand All @@ -123,7 +123,7 @@ Examples of **correct** code for this rule with the `{ "properties": "never" }`
```js
/*eslint camelcase: ["error", {properties: "never"}]*/

var obj = {
const obj = {
my_pref: 1
};

Expand All @@ -141,15 +141,15 @@ Examples of **incorrect** code for this rule with the default `{ "ignoreDestruct
```js
/*eslint camelcase: "error"*/

var { category_id } = query;
const { category_id } = query;

var { category_name = 1 } = query;
const { category_name = 1 } = query;

var { category_id: category_title } = query;
const { category_id: category_title } = query;

var { category_id: category_alias } = query;
const { category_id: category_alias } = query;

var { category_id: categoryId, ...other_props } = query;
const { category_id: categoryId, ...other_props } = query;
```

:::
Expand All @@ -163,9 +163,9 @@ Examples of **incorrect** code for this rule with the `{ "ignoreDestructuring":
```js
/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/

var { category_id: category_alias } = query;
const { category_id: category_alias } = query;

var { category_id, ...other_props } = query;
const { category_id, ...other_props } = query;
```

:::
Expand All @@ -177,11 +177,11 @@ Examples of **correct** code for this rule with the `{ "ignoreDestructuring": tr
```js
/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/

var { category_id } = query;
const { category_id } = query;

var { category_id = 1 } = query;
const { category_name = 1 } = query;

var { category_id: category_id } = query;
const { category_id_name: category_id_name } = query;
```

:::
Expand All @@ -195,8 +195,8 @@ Examples of additional **incorrect** code for this rule with the `{ "ignoreDestr
```js
/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/

var { some_property } = obj; // allowed by {ignoreDestructuring: true}
var foo = some_property + 1; // error, ignoreDestructuring does not apply to this statement
const { some_property } = obj; // allowed by {ignoreDestructuring: true}
const foo = some_property + 1; // error, ignoreDestructuring does not apply to this statement
```

:::
Expand All @@ -210,7 +210,7 @@ Examples of additional **correct** code for this rule with the `{ "ignoreDestruc
```js
/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/

var { some_property, ...rest } = obj;
const { some_property, ...rest } = obj;
// do something with 'rest', nothing with 'some_property'
```

Expand All @@ -225,7 +225,7 @@ Examples of additional **correct** code for this rule with the `{ "properties":
```js
/*eslint camelcase: ["error", {"properties": "never", ignoreDestructuring: true}]*/

var { some_property } = obj;
const { some_property } = obj;
doSomething({ some_property });
```

Expand Down
6 changes: 3 additions & 3 deletions docs/src/rules/curly.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ while (true) {
doSomething();
}

for (var i=0; i < items.length; i++) {
for (let i=0; i < items.length; i++) {
doSomething();
}
```
Expand Down Expand Up @@ -209,7 +209,7 @@ while (true) {
doSomething();
}

for (var i = 0; foo; i++) {
for (let i = 0; foo; i++) {
doSomething();
}
```
Expand Down Expand Up @@ -243,7 +243,7 @@ if (foo)
while (true)
doSomething();

for (var i = 0; foo; i++)
for (let i = 0; foo; i++)
doSomething();
```

Expand Down
14 changes: 7 additions & 7 deletions docs/src/rules/dot-notation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Examples of **incorrect** code for this rule:
```js
/*eslint dot-notation: "error"*/

var x = foo["bar"];
const x = foo["bar"];
```

:::
Expand All @@ -34,9 +34,9 @@ Examples of **correct** code for this rule:
```js
/*eslint dot-notation: "error"*/

var x = foo.bar;
const x = foo.bar;

var x = foo[bar]; // Property name is a variable, square-bracket notation required
const y = foo[bar]; // Property name is a variable, square-bracket notation required
```

:::
Expand All @@ -57,8 +57,8 @@ Examples of **correct** code for the `{ "allowKeywords": false }` option:
```js
/*eslint dot-notation: ["error", { "allowKeywords": false }]*/

var foo = { "class": "CS 101" }
var x = foo["class"]; // Property name is a reserved word, square-bracket notation required
const foo = { "class": "CS 101" }
const x = foo["class"]; // Property name is a reserved word, square-bracket notation required
```

:::
Expand Down Expand Up @@ -91,7 +91,7 @@ Examples of **incorrect** code for the sample `{ "allowPattern": "^[a-z]+(_[a-z]
```js
/*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/

var data = {};
const data = {};
data["fooBar"] = 42;
```

Expand All @@ -103,7 +103,7 @@ Examples of **correct** code for the sample `{ "allowPattern": "^[a-z]+(_[a-z]+)
```js
/*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/

var data = {};
const data = {};
data["foo_bar"] = 42;
```

Expand Down
8 changes: 4 additions & 4 deletions docs/src/rules/id-denylist.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Examples of **incorrect** code for this rule with sample `"data", "callback"` re
```js
/*eslint id-denylist: ["error", "data", "callback"] */

var data = { ...values };
const data = { ...values };

function callback() {
// ...
Expand All @@ -56,7 +56,7 @@ element.callback = function() {
// ...
};

var itemSet = {
const itemSet = {
data: [...values]
};

Expand Down Expand Up @@ -86,7 +86,7 @@ Examples of **correct** code for this rule with sample `"data", "callback"` rest
```js
/*eslint id-denylist: ["error", "data", "callback"] */

var encodingOptions = {...values};
const encodingOptions = {...values};

function processFileResult() {
// ...
Expand All @@ -96,7 +96,7 @@ element.successHandler = function() {
// ...
};

var itemSet = {
const itemSet = {
entities: [...values]
};

Expand Down
20 changes: 10 additions & 10 deletions docs/src/rules/max-lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Examples of **incorrect** code for this rule with a max value of `3`:

```js
/*eslint max-lines: ["error", 3]*/
var a,
let a,
b,
c;
```
Expand All @@ -51,7 +51,7 @@ var a,
```js
/*eslint max-lines: ["error", 3]*/

var a,
let a,
b,c;
```

Expand All @@ -62,7 +62,7 @@ var a,
```js
/*eslint max-lines: ["error", 3]*/
// a comment
var a,
let a,
b,c;
```

Expand All @@ -74,7 +74,7 @@ Examples of **correct** code for this rule with a max value of `3`:

```js
/*eslint max-lines: ["error", 3]*/
var a,
let a,
b, c;
```

Expand All @@ -85,7 +85,7 @@ var a,
```js
/*eslint max-lines: ["error", 3]*/

var a, b, c;
let a, b, c;
```

:::
Expand All @@ -95,7 +95,7 @@ var a, b, c;
```js
/*eslint max-lines: ["error", 3]*/
// a comment
var a, b, c;
let a, b, c;
```

:::
Expand All @@ -109,7 +109,7 @@ Examples of **incorrect** code for this rule with the `{ "skipBlankLines": true
```js
/*eslint max-lines: ["error", {"max": 3, "skipBlankLines": true}]*/

var a,
let a,
b,
c;
```
Expand All @@ -123,7 +123,7 @@ Examples of **correct** code for this rule with the `{ "skipBlankLines": true }`
```js
/*eslint max-lines: ["error", {"max": 3, "skipBlankLines": true}]*/

var a,
let a,
b, c;
```

Expand All @@ -138,7 +138,7 @@ Examples of **incorrect** code for this rule with the `{ "skipComments": true }`
```js
/*eslint max-lines: ["error", {"max": 2, "skipComments": true}]*/
// a comment
var a,
let a,
b,
c;
```
Expand All @@ -152,7 +152,7 @@ Examples of **correct** code for this rule with the `{ "skipComments": true }` o
```js
/*eslint max-lines: ["error", {"max": 2, "skipComments": true}]*/
// a comment
var a,
let a,
b, c;
```

Expand Down
Loading