-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
docs: rewrite using let and const in rule examples #19320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
82002be
docs: rewrite var using let and const
PoloSpark e1fc896
docs: rewrite examples using let and const
PoloSpark 772beb0
Merge branch 'main' into main
PoloSpark c0879d8
docs: rewrite var using let and const
PoloSpark 74b5ac4
Update docs/src/rules/accessor-pairs.md
PoloSpark 8087bd2
Update docs/src/rules/accessor-pairs.md
PoloSpark f393ab1
docs: rewrite using const
PoloSpark bba35fd
Merge branch 'main' of https://github.com/PoloSpark/eslint
PoloSpark a1985d1
Update accessor-pairs.md
PoloSpark f2495f5
Update accessor-pairs.md
PoloSpark 2f7af03
Update let variables to const
PoloSpark a7fb4ac
Merge branch 'main' into main
PoloSpark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,12 +35,12 @@ Examples of **incorrect** code for this rule with the `"always"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "always"]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [1]; | ||||||
var c = [1, 2]; | ||||||
var d = [1, | ||||||
let a = []; | ||||||
let b = [1]; | ||||||
let c = [1, 2]; | ||||||
let d = [1, | ||||||
2]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
dosomething(); | ||||||
}]; | ||||||
``` | ||||||
|
@@ -54,19 +54,19 @@ Examples of **correct** code for this rule with the `"always"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "always"]*/ | ||||||
|
||||||
var a = [ | ||||||
let a = [ | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1 | ||||||
]; | ||||||
var c = [ | ||||||
let c = [ | ||||||
1, 2 | ||||||
]; | ||||||
var d = [ | ||||||
let d = [ | ||||||
1, | ||||||
2 | ||||||
]; | ||||||
var e = [ | ||||||
let e = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
@@ -84,19 +84,19 @@ Examples of **incorrect** code for this rule with the `"never"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "never"]*/ | ||||||
|
||||||
var a = [ | ||||||
let a = [ | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1 | ||||||
]; | ||||||
var c = [ | ||||||
let c = [ | ||||||
1, 2 | ||||||
]; | ||||||
var d = [ | ||||||
let d = [ | ||||||
1, | ||||||
2 | ||||||
]; | ||||||
var e = [ | ||||||
let e = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
@@ -112,12 +112,12 @@ Examples of **correct** code for this rule with the `"never"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "never"]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [1]; | ||||||
var c = [1, 2]; | ||||||
var d = [1, | ||||||
let a = []; | ||||||
let b = [1]; | ||||||
let c = [1, 2]; | ||||||
let d = [1, | ||||||
2]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
dosomething(); | ||||||
}]; | ||||||
``` | ||||||
|
@@ -133,15 +133,15 @@ Examples of **incorrect** code for this rule with the `"consistent"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "consistent"]*/ | ||||||
|
||||||
var a = [1 | ||||||
let a = [1 | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1]; | ||||||
var c = [function foo() { | ||||||
let c = [function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
] | ||||||
var d = [ | ||||||
let d = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
}] | ||||||
|
@@ -156,17 +156,17 @@ Examples of **correct** code for this rule with the `"consistent"` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", "consistent"]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [ | ||||||
let a = []; | ||||||
let b = [ | ||||||
]; | ||||||
var c = [1]; | ||||||
var d = [ | ||||||
let c = [1]; | ||||||
let d = [ | ||||||
1 | ||||||
]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
dosomething(); | ||||||
}]; | ||||||
var f = [ | ||||||
let f = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
@@ -184,17 +184,17 @@ Examples of **incorrect** code for this rule with the default `{ "multiline": tr | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "multiline": true }]*/ | ||||||
|
||||||
var a = [ | ||||||
let a = [ | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1 | ||||||
]; | ||||||
var c = [ | ||||||
let c = [ | ||||||
1, 2 | ||||||
]; | ||||||
var d = [1, | ||||||
let d = [1, | ||||||
2]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
dosomething(); | ||||||
}]; | ||||||
``` | ||||||
|
@@ -208,14 +208,14 @@ Examples of **correct** code for this rule with the default `{ "multiline": true | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "multiline": true }]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [1]; | ||||||
var c = [1, 2]; | ||||||
var d = [ | ||||||
let a = []; | ||||||
let b = [1]; | ||||||
let c = [1, 2]; | ||||||
let d = [ | ||||||
1, | ||||||
2 | ||||||
]; | ||||||
var e = [ | ||||||
let e = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
@@ -233,15 +233,15 @@ Examples of **incorrect** code for this rule with the `{ "minItems": 2 }` option | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ | ||||||
|
||||||
var a = [ | ||||||
let a = [ | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1 | ||||||
]; | ||||||
var c = [1, 2]; | ||||||
var d = [1, | ||||||
let c = [1, 2]; | ||||||
let d = [1, | ||||||
2]; | ||||||
var e = [ | ||||||
let e = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
@@ -257,16 +257,16 @@ Examples of **correct** code for this rule with the `{ "minItems": 2 }` option: | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [1]; | ||||||
var c = [ | ||||||
let a = []; | ||||||
let b = [1]; | ||||||
let c = [ | ||||||
1, 2 | ||||||
]; | ||||||
var d = [ | ||||||
let d = [ | ||||||
1, | ||||||
2 | ||||||
]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
dosomething(); | ||||||
}]; | ||||||
``` | ||||||
|
@@ -282,15 +282,15 @@ Examples of **incorrect** code for this rule with the `{ "multiline": true, "min | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ | ||||||
|
||||||
var a = [ | ||||||
let a = [ | ||||||
]; | ||||||
var b = [ | ||||||
let b = [ | ||||||
1 | ||||||
]; | ||||||
var c = [1, 2]; | ||||||
var d = [1, | ||||||
let c = [1, 2]; | ||||||
let d = [1, | ||||||
2]; | ||||||
var e = [function foo() { | ||||||
let e = [function foo() { | ||||||
dosomething(); | ||||||
}]; | ||||||
``` | ||||||
|
@@ -304,16 +304,16 @@ Examples of **correct** code for this rule with the `{ "multiline": true, "minIt | |||||
```js | ||||||
/*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ | ||||||
|
||||||
var a = []; | ||||||
var b = [1]; | ||||||
var c = [ | ||||||
let a = []; | ||||||
let b = [1]; | ||||||
let c = [ | ||||||
1, 2 | ||||||
]; | ||||||
var d = [ | ||||||
let d = [ | ||||||
1, | ||||||
2 | ||||||
]; | ||||||
var e = [ | ||||||
let e = [ | ||||||
function foo() { | ||||||
dosomething(); | ||||||
} | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update in all places in the
array-backet-newline.md
file also.