question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tell us about your environment

  • ESLint Version: v3.12.2
  • Node Version: v6.9.1
  • npm Version: 3.10.9

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

Please show your full configuration:

{
  "extends": "airbnb",
  "rules": {
    "strict": 0,
    "no-underscore-dangle": ["error", { "allow": ["__"] }],
    "new-cap": ["error", { "capIsNew": false }],
    "no-confusing-arrow": ["error", { "allowParens": true }]
  },
  "parserOptions": {
      "ecmaVersion": 6,
      "ecmaFeatures": {
          "experimentalObjectRestSpread": true
      }
  }
}

What did you do? Please include the actual source code causing the issue.

        const headers = R.compose(
          R.assoc('X-Requested-With', 'XMLHttpRequest'),
          R.merge({ 'Content-Type': 'application/json;charset=UTF-8' }),
          R.defaultTo({})
        )(header);

What did you expect to happen? in the line of R.defaultTo({}), should not output “comma-dangle” error

What actually happened? Please include the actual, raw output from ESLint. Missing trailing comma. (comma-dangle)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
vitorbalcommented, Jan 4, 2017

Thanks for the report, however I believe this is working as intended. As far as I remember, airbnb-base uses the following config for comma-dangle, which means comma dangles will also be enforced for function invocations:

    'comma-dangle': ['error', {
      arrays: 'always-multiline',
      objects: 'always-multiline',
      imports: 'always-multiline',
      exports: 'always-multiline',
      functions: 'always-multiline',
    }]

If you don’t want to enforce trailing commas for functions invocations you should override the airbnb default config and turn off checking for functions:

    'comma-dangle': ['error', {
      arrays: 'always-multiline',
      objects: 'always-multiline',
      imports: 'always-multiline',
      exports: 'always-multiline',
      functions: 'never',
    }]
0reactions
adispringcommented, Jan 14, 2017

@vitorbal @ilyavolodin , got it, I’ll close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

comma-dangle - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Why does this trigger comma-dangle rule in eslint?
Based on the airbnb config the rule is setup like this comma-dangle: [2, "always-multiline"] . Acoording to this, The expected code is
Read more >
How to Allow Trailing Commas (Comma-Dangle) With ...
Allowing comma-dangle in TypeScript requires two configurations in your ESLint setup. At first, you must turn off ESLint's default comma-dangle ...
Read more >
comma-dangle with rest bug · Issue #7857 - GitHub
Thanks for the report, but this is working as intended -- trailing commas after rest properties are a syntax error. Also see: #7614,...
Read more >
jsonc/comma-dangle | eslint-plugin-jsonc
Rule Details. This rule enforces consistent use of trailing commas in object and array literals. 1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found