What version of ESLint are you using?
v2.11.1
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
{
"rules": {
"comma-dangle": ["error", "always"]
}
}
What did you do? Please include the actual source code causing the issue.
console.log(
1,
2,
3,
4,
);
What did you expect to happen?
ESLint should pass with no errors since I'm allowing trailing commas
What actually happened? Please include the actual, raw output from ESLint.
$ eslint test.js --debug
eslint:cli Running on files +0ms
eslint:ignored-paths Looking for ignore file in /Users/axg/Desktop +32ms
eslint:ignored-paths Could not find ignore file in cwd +1ms
eslint:glob-util Creating list of files to process. +0ms
eslint:cli-engine Processing /Users/axg/Desktop/test.js +2ms
eslint:cli-engine Linting /Users/axg/Desktop/test.js +0ms
eslint:config Constructing config for /Users/axg/Desktop/test.js +0ms
eslint:config Using .eslintrc and package.json files +1ms
eslint:config Using personal config +1ms
eslint:config-file Loading JSON config file: /Users/axg/.eslintrc.json +1ms
eslint:config Merging command line environment settings +6ms
eslint:config-ops Apply environment settings to config +1ms
eslint:cli-engine Linting complete in: 63ms +45ms
/Users/axg/Desktop/test.js
5:3 error Parsing error: Unexpected token )
✖ 1 problem (1 error, 0 warnings)
If I'm doing anything wrong, apologies in advance 😄
Oh, I forgot to mention: If I remove the dangling comma everything works as expected.
Dangling comma is only allowed in certain parts of the grammar- I don't think function calls is one of them.
Trailing function commas is a Stage 3 proposal, and as such is not yet part of the ECMA Script specification. Espree (default parser for ESLint), only supports approved ECMA Script features. If you want to use trailing function commas you need to use babel-eslint
.
Closing as this is working as expected.
Most helpful comment
Trailing function commas is a Stage 3 proposal, and as such is not yet part of the ECMA Script specification. Espree (default parser for ESLint), only supports approved ECMA Script features. If you want to use trailing function commas you need to use
babel-eslint
.Closing as this is working as expected.