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

[function-call-argument-newline] doesn't handle newlines inside arguments properly #12419

Closed
fabiospampinato opened this issue Oct 13, 2019 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon

Comments

@fabiospampinato
Copy link

fabiospampinato commented Oct 13, 2019

Tell us about your environment

  • ESLint Version: 6.5.1
  • Node Version: 10.15.0
  • npm Version: 6.4.1

What parser (default, Babel-ESLint, etc.) are you using?

@typescript-eslint/parser

Please show your full configuration:

Here it is, just uncomment the "function-call-argument-newline" rule.

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

fn ( 123, () => {
});

fn ( 123, () => {
}, [foo]);
npx eslint src --ext '.ts, .tsx'

What did you expect to happen?

No error detected.

What actually happened? Please include the actual, raw output from ESLint.

I think ESLint is kind of considering a newline inside an argument (inside the body of the passed arrow function in this case) as a newline between arguments, which is what should trigger this rule IMHO.

As a result of this misbehavior the first call to fn is fine but the second one is not.

Also this is a fairly common pattern to write when passing a dependency array to a React hook, so this would probably affect a lot of people.

Are you willing to submit a pull request to fix this bug?

I'm not too familiar with the AST, but with some pointers perhaps I can help.

@fabiospampinato fabiospampinato added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Oct 13, 2019
@mdjermanovic
Copy link
Member

This might be a duplicate of #12123

@fabiospampinato
Copy link
Author

fabiospampinato commented Oct 14, 2019

Yes, I'm closing this then.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 13, 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 Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants