[comma-dangle] Difference between function declaration and function call?
See original GitHub issueJust 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:
- Created 7 years ago
- Reactions:6
- Comments:11 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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
I was just reporting the same issue as you commented @ljharb. Thanks!