-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
docs: rewrite var with const in rules examples #19317
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
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
docs/src/rules/max-statements.md
Outdated
| const bar; | ||
| const baz; |
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.
| const bar; | |
| const baz; | |
| let bar; | |
| let baz; |
when we use const to declare a variable, we must assign it a value at the time of declaration. so lets use let here.
docs/src/rules/max-statements.md
Outdated
| const bar; | ||
| const baz; |
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.
| const bar; | |
| const baz; | |
| let bar; | |
| let baz; |
same as https://github.com/eslint/eslint/pull/19317/files#r1904412913
docs/src/rules/max-statements.md
Outdated
| const bar; | ||
| const baz; |
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.
| const bar; | |
| const baz; | |
| let bar; | |
| let baz; |
Uninitialized const is a syntax error.
docs/src/rules/max-statements.md
Outdated
| const bar; | ||
| const baz; |
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.
| const bar; | |
| const baz; | |
| let bar; | |
| let baz; |
|
Fixed, just a question I need to update this branch? |
docs/src/rules/max-statements.md
Outdated
| }; | ||
| } | ||
|
|
||
| let bar = () => { |
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.
| let bar = () => { | |
| const bar = () => { |
This can be declared as const.
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.
alright, any more suggestions?
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.
No, Only two suggestions are left.
docs/src/rules/max-statements.md
Outdated
| const foo11 = 11; // Too many. | ||
| } | ||
|
|
||
| let bar = () => { |
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.
| let bar = () => { | |
| const bar = () => { |
same as https://github.com/eslint/eslint/pull/19317/files#r1904454700
amareshsm
left a comment
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.
LGTM. Thanks!
Tanujkanti4441
left a comment
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.
LGTM. thanks!
|
One more thing, eslint/docs/src/rules/max-statements.md Line 146 in 26c3003
we can also use |
mdjermanovic
left a comment
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.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Rewrited var using const in following rule examples:
new-capno-alertmax-statementsRelated Issue: #19240
Is there anything you'd like reviewers to focus on?
I used
constto replacevar, I believe it is the best solution for the issue