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
Update: fix wrong indentation about catch
,finally
#7371
Conversation
LGTM |
@mysticatea, thanks for your PR! By analyzing the history of the files in this pull request, we identified @vitorbal, @valorkin and @gyandeeps to be potential reviewers. |
} | ||
finally { | ||
} | ||
} |
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.
nit: I think we should stick to string concat here because this makes it hard to read in this particular scenario. (or maybe its just me)
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.
Agreed.
LGTM |
I updated as using string concatenations. |
LGTM |
I'm merging this PR since this is a good companion of |
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix (template)
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
I realized this while I was reviewing #7347.
$ eslint test.js --no-ignore --no-eslintrc --rule "indent:error" --fix
test.js
is:What did you expect to happen?
ESLint fixes the code to:
What actually happened? Please include the actual, raw output from ESLint.
ESLint fixed the code to:
What changes did you make? (Give an overview)
If
catch
/finally
keywords are at the first on a line,indent
rule reports wrong indentations.The rule does not report indentations of those keywords, then the rule makes indentations of those blocks as based on the keywords. As a result, the indentations are wrong.
In a similar case,
else
keyword, the rule handles the keyword correctly.This PR changes
indent
rule aboutcatch
andfinally
(andwhile
of DoWhileStatement) keywords as the same way ofelse
keyword.semver-minor
: this is a bug fix which increases warnings. The following code has been no warning before.Is there anything you'd like reviewers to focus on?
Is the place of this change right?
I wrote the code in the same place with the code of
else
keyword.