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

Conversation

@yeonjuan
Copy link
Member

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 eslint bot added the triage label Nov 7, 2019
@aladdin-add aladdin-add added accepted bug rule and removed triage labels Nov 7, 2019
Copy link
Member

aladdin-add left a comment

LGTM, thanks!

Copy link
Member

kaicataldo left a comment

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 left a comment

Looks good, thanks for contributing!

@platinumazure
Copy link
Member

platinumazure commented Nov 7, 2019

@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

kaicataldo commented Nov 10, 2019

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

Copy link
Member

kaicataldo left a comment

LGTM, thanks!

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

This comment has been minimized.

Copy link
@kaicataldo

kaicataldo Nov 10, 2019

Member

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

This comment has been minimized.

Copy link
@yeonjuan

yeonjuan Nov 10, 2019

Author Member

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

@kaicataldo kaicataldo merged commit 0afb518 into eslint:master Nov 10, 2019
18 checks passed
18 checks passed
Verify Files
Details
Test (ubuntu-latest, 13.x)
Details
Test (ubuntu-latest, 12.x)
Details
Test (ubuntu-latest, 10.x)
Details
Test (ubuntu-latest, 8.x)
Details
Test (ubuntu-latest, 8.10.0)
Details
Test (windows-latest, 12.x)
Details
Test (macOS-latest, 12.x)
Details
Browser Test
Details
commit-message PR title follows commit message guidelines
Details
continuous-integration Build #20191110.4 succeeded
Details
continuous-integration (Test on Node.js 10 (Linux)) Test on Node.js 10 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Linux)) Test on Node.js 12 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Windows)) Test on Node.js 12 (Windows) succeeded
Details
continuous-integration (Test on Node.js 12 (macOS)) Test on Node.js 12 (macOS) succeeded
Details
continuous-integration (Test on Node.js 8 (Linux)) Test on Node.js 8 (Linux) succeeded
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
@yeonjuan yeonjuan deleted the yeonjuan:function-call-arg-nl branch Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.