Document comma-dangle: functions: always-multiline behaviour in promises
See original GitHub issue-
ESLint Version v3.13.1 (although this is documentation specific, not the linter itself
-
The problem you want to solve. The behaviour of always-multiline comma dangle in promises isn’t clearly documented. As In #7786 @mysticatea described why a trailing comma is forced in some
Promise.then
situations -
Your take on the correct solution to problem. Update the documentation for the rule to include a
always-multiline
section with the rest of the function docs, showing:
-Promise.then(x => x
- .replace('asdasdsdsda', '123213213')
- .replace('cxvcxvcxvcx', '546546546')
- .replace('ewrewrewrew', '877876876'),
-)
+Promise.then(x => (
+ x.replace('asdasdsdsda', '123213213')
+ .replace('cxvcxvcxvcx', '546546546')
+ .replace('ewrewrewrew', '877876876')
+))
Raised this as an issue instead of a PR as I guess it’s a conflict between two rules in the airbnb config, but it might not belong on that page
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top 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 you should enforce Dangling Commas for Multiline ...
Fortunately ESLint has the comma-dangle rule which allows you to enforce dangling commas for multiline statements. comma-dangle: “always-multiline”. With ...
Read more >eslint-plugin-flowtype - npm
If it is 'always-multiline' then a problem is raised when there is no trailing comma on a multi-line definition, or there is a...
Read more >eslint-plugin-flowtype - npm Package Health Analysis - Snyk
This rule has a string option and an object one. String options are: "always" (default) requires parens around arguments in all cases. "as-needed ......
Read more >client/node_modules/eslint-plugin-flowtype - GitLab
If it is 'always-multiline' then a problem is raised when there is no trailing comma on a multi-line definition, or there is a...
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 FreeTop 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
Top GitHub Comments
I agree, this seems like it would help a lot. Would you like to make a PR?
Also, keep in mind that the parser configuration (e.g.
ecmaVersion: 2016
and the rule configuration (e.g.functions: always-multiline
) are independent from each other. The defaultfunctions
configuration isignore
(i.e. no errors are reported for trailing function commas), but if you’re using a shareable config such aseslint-config-airbnb
, it’s possible the config is explicitly enablingfunctions: always-multiline
. To override this, you can use something likeThis is fixed by https://github.com/eslint/eslint/pull/8468.