Skip to content
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

Fix: invalid autofix in function-call-argument-newline (fixes #12454) #12539

Merged
merged 3 commits into from Nov 10, 2019
Merged

Fix: invalid autofix in function-call-argument-newline (fixes #12454) #12539

merged 3 commits into from Nov 10, 2019

Conversation

yeonjuan
Copy link
Member

@yeonjuan yeonjuan commented Nov 7, 2019

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

This is a PR for #12454

  • Add checking whether there is a line comment(// comment) before currentArgToken

Is there anything you'd like reviewers to focus on?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 7, 2019
@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Nov 7, 2019
Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! Can we add tests that document that it does autofix block comments? They can be the same tests tests, just with block comments instead of line comments.

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for contributing!

@platinumazure
Copy link
Member

@kaicataldo It looks like there are some tests with the "consistent" option which show that the autofix works:

{
code: "fn(a,\n\tb /* comment */, c)",
output: "fn(a,\n\tb /* comment */,\nc)",
options: ["consistent"],
errors: [
{
messageId: "missingLineBreak",
line: 2,
column: 18,
endLine: 2,
endColumn: 19
}
]
},
{
code: "fn(a,\n\tb, /* comment */ c)",
output: "fn(a,\n\tb, /* comment */\nc)",
options: ["consistent"],
errors: [
{
messageId: "missingLineBreak",
line: 2,
column: 18,
endLine: 2,
endColumn: 19
}
]
},

It may be a good idea to add more tests for other options, but could that potentially be in a separate PR?

@kaicataldo
Copy link
Member

Ah, I missed that. Thanks for pointing that out!

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@@ -390,6 +390,21 @@ ruleTester.run("function-call-argument-newline", rule, {
}
]
},
{
code: "fn(a,/* commeent */\nb)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but I’m assuming the intention was comment rather than commeent here 😄

Copy link
Member Author

@yeonjuan yeonjuan Nov 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaicataldo Oh it's typo. I fixed it. Thanks.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 10, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants