Description
Tell us about your environment
- ESLint Version: 6.5.1
- Node Version: 10.16.0
- npm Version: 6.9.0
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
module.exports = {
parserOptions: {
ecmaVersion: 2015,
}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
/* eslint function-call-argument-newline: ["error", "never"] */
f(a, // comment
b);
eslint index.js --fix
What did you expect to happen?
I'm not sure, maybe an error without autofix.
What actually happened? Please include the actual, raw output from ESLint.
/* eslint function-call-argument-newline: ["error", "never"] */
f(a, // comment b);
Are you willing to submit a pull request to fix this bug?
Yes. #12280 should be probably merged first.
Autofix also doesn't work quite well when a comment or the comma ,
is on the same line with the argument that shouldn't have a linebreak before - Demo Link
The reported locations are wrong and autofix just removes whitespace (or even inserts a new space in some cases), but the linebreak and the error are still there.
Maybe we could do here the same as with array-element-newline
- Demo Link
From this demo, it looks like the logic is as the following:
- If there is a comment anywhere between two elements, just report error without any autofixes.
- If there are no comments, then fix the code. If the comma is on the same line as the second element, remove the range between the first element and the comma, instead of between the comma and the second element.
Reported locations are also not correct.