Key-spacing alignment problem.
See original GitHub issueI really like intelliJ Idea style object alignment. But I didn’t create a linting rule for desired alignment style. For instance the following snippet is properly formatted in My IDE.
let items = {
item115: {
id : 100,
name : 'item1',
itemList: [1, 2, 3]
},
item2 : {
id : 101,
name : 'item2',
itemList: [1, 2, 3]
}
};
My key-spacing rule is:
{
"key-spacing" : [
"error",
{
"singleLine": {
"beforeColon": false,
"afterColon" : true
},
"multiLine" : {
"beforeColon": true,
"afterColon" : true,
"align" : "colon"
}
}
]
}
IMHO multiLine beforeColon option should be three stated. true, false and off. Is there a way to properly linting above code snippet?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:16 (11 by maintainers)
Top Results From Across the Web
"key-spacing" tab alignment · Issue #12432 · eslint ... - GitHub
This revisits issues #1727 and #9523. What rule do you want to change? key-spacing Does this change cause the rule to produce more...
Read more >Key-spacing - ESLint - W3cubDocs
This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment...
Read more >ESLint always throwing key-spacing error - vue.js
in a multi-line assignment, the colons line up horizontally, and there is a space both before and after each colon. the strange thing...
Read more >How can I correct wrong key spacing of an accoustic piano?
You align the keys by spacing the front rail and balance rail pins, but before you do that, you have to know WHY...
Read more >Issue with the alignment of the array - LaTeX Stack Exchange
I am having the issue with the alignment of an array. Please, find the below code: \documentclass[12 pt, a4paper]{book} ...
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
@firatkucuk thanks, let’s see if we can get support from the team to accept this so you can start working.
To the team: We had an accepted proposal in #2668 that would support IntelliJ-style alignment in key-spacing, but the issue was closed when nobody was interested in working on it. @firatkucuk has volunteered to work on a PR, so I’ll copy the proposal here and see what you all think.
A new option
"grouping"
which has two possible values:"multi-line"
(default): Values spanning multiple lines end their group"empty-line"
: Blank lines (no comments, no code, just whitespace) create new groupsI do think we should support IntelliJ-style alignment, so I’ll champion.
Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.