Object-curly-newline for destructuring not working as expected in editor
See original GitHub issueI’m utilizing prettier to format code based on eslint rules. According to the documentation, the following rules should reformat the destructure (originally all in 1 line) into multiple line with one property per line (just like the object literal). However, it’s not working as expected (see attached for how the code gets formatted). Can someone explain to me what I might be doing wrong?
.eslintrc.json
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"max-len": [
2,
80,
4,
{
"ignoreStrings": true,
"ignoreComments": true,
"ignoreUrls": true
}
],
"object-curly-newline": [
"error",
{
"ObjectExpression": "always",
"ObjectPattern": { "minProperties": 2 }
}
]
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
object-curly-newline - 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 >eslint object-curly-newline conflicts prettier multi-line rationale
I'm new in prettier + typescript + eslint. Most of the integration works fine but multi-line in destructure object is not. Prettier 1.19.1 ......
Read more >Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >Code Issues - Embold Help Center
In this block, the logger level is expected to be as "error". This is a good list describing the log levels : 1....
Read more >Code style for JS6 destructured object lacks settings in ...
I can't even fix it manually, as I'm too used to reformat the code every now and then and I can't always remember...
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
Oh, also: If any ESLint documentation is incorrect, could you please let us know where it is so we can fix it? Thanks!
Actually never mind, after reading this issue again I figured out what’s going on. It seems like the issue is just that the
object-property-newline
rule doesn’t check object destructuring.There is already an issue about this (https://github.com/eslint/eslint/issues/9259), so I’m going to close this issue in favor of that one.