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.

[comma-dangle] Difference between function declaration and function call?

See original GitHub issue

Just a suggestion, if it would make sense to have a difference for the function definition and function call? I’m asking that because sometimes it feels weird to have the comma. Especially in function which takes an arrow function.

something.map(url =>
  sthelse
);

With the rule enabled with multiline, it asks a comma after sthelse. Would it be possible to have an option to not do it? Would it make sense?

This is particularly weird when playing with jsx.

const component = renderer.create(
  <ESLintItem>
    <a href="http://eslint.org">ESLint</a>
  </ESLintItem>,
);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
ljharbcommented, Nov 21, 2016

@johntran the airbnb config requires trailing commas on function arguments.

Indeed, your arrow function, and @cmalard, your console.log argument, need trailing commas. It is indeed valid JS, it’s just ES2017. The airbnb config expects you’re using https://npmjs.com/babel-preset-airbnb

1reaction
msmichellegarcommented, Nov 21, 2016

I was just reporting the same issue as you commented @ljharb. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Difference between 'function declaration' and ... - GeeksforGeeks
A function Expression is similar to a function declaration without the function name. Function expressions can be stored in a variable ...
Read more >
The Difference Between Function Declaration & Function ...
Function declarations are written with the keyword “function”, while function expressions are defined with a variable keyword and store the ...
Read more >
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 >
Trailing comma in ECMAScript 2017 function parameter list
The comma-dangle allows you to enforce a dangling comma in object and array literals. It doesn't work with function declarations and invocations ...
Read more >
comma-dangle | typescript-eslint
(e.g. function foo<T,>() {} ); "tuples" is for trailing comma in tuple. (e.g. type Foo = [string,] ). Options​.
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