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
docs: fix examples for several rules #17645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ Examples of **correct** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$", { | |
```js | ||
/*eslint id-match: [2, "^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true }]*/ | ||
|
||
do_something(__dirname); | ||
foo = __dirname; | ||
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. This was "correct" regardless of the option, so I replaced it with an example that would be "incorrect" with |
||
``` | ||
|
||
::: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,7 +192,7 @@ Examples of **correct** code for this rule with the `4, { "ignoredNodes": ["Call | |
foo(); | ||
bar(); | ||
|
||
}) | ||
})(); | ||
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. The selector targets IIFEs. This wasn't an IIFE, so it was "incorrect". |
||
``` | ||
|
||
::: | ||
|
@@ -403,7 +403,7 @@ function foo(x) { | |
})(); | ||
|
||
if (y) { | ||
console.log('foo'); | ||
console.log('foo'); | ||
} | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ if (condition) { bar = 1; } else { baz = 2; } | |
for (var i = 0; i < length; ++i) { bar = 1; baz = 2; } | ||
switch (discriminant) { case 'test': break; default: break; } | ||
function foo() { bar = 1; baz = 2; } | ||
var qux = function qux() { bar = 1; }; | ||
var qux = function qux() { bar = 1; baz = 2; }; | ||
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. Function expression doesn't count as a statement, so this was "correct". |
||
(function foo() { bar = 1; baz = 2; })(); | ||
``` | ||
|
||
|
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.
These examples in "incorrect" were "correct".