`key-spacing`: `multiLine.align.mode` is overridden, `multiLine.mode` with `align` causes an error
See original GitHub issueWhat version of ESLint are you using? ESLint 3.1.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
case1.js
module.exports = {
"rules" : {
"key-spacing" : [
"error",
{
"multiLine" : {
"beforeColon": false,
"afterColon" : true,
"mode" : "strict",
"align" : {
"beforeColon": false,
"afterColon" : true,
"on" : "colon",
"mode" : "minimum"
}
}
}
]
}
};
case2.js
module.exports = {
"rules": {
"key-spacing": [
"error",
{
"multiLine": {
"beforeColon": false,
"afterColon" : true,
"mode" : "strict"
},
"align" : {
"beforeColon": false,
"afterColon" : true,
"on" : "colon",
"mode" : "minimum"
}
}
]
}
};
What did you do? Please include the actual source code causing the issue.
test.js
var a = {
foo : 1,
align1: {
foo: 2
},
align2: {
foo: 3
},
bar: 4
};
What did you expect to happen?
Case 1
5:5 warning Unexpected a line break before this close brace object-curly-newline
6:13 warning Unexpected a line break after this open brace object-curly-newline
Case2
1:1 error Unexpected var, use let or const instead no-var
1:5 error 'a' is defined but never used no-unused-vars
3:13 warning Unexpected a line break after this open brace object-curly-newline
5:5 warning Unexpected a line break before this close brace object-curly-newline
6:13 warning Unexpected a line break after this open brace object-curly-newline
8:5 warning Unexpected a line break before this close brace object-curly-newline
What actually happened? Please include the actual, raw output from ESLint.
Case 1
4:17 error Extra space before value for key 'foo' key-spacing
5:5 warning Unexpected a line break before this close brace object-curly-newline
6:13 warning Unexpected a line break after this open brace object-curly-newline
7:17 error Extra space before value for key 'foo' key-spacing
Case2
/path/to/config/case2.js:
Configuration for rule "key-spacing" is invalid:
Value "[object Object]" no schemas match.
Error: /path/to/config/case2.js:
Configuration for rule "key-spacing" is invalid:
Value "[object Object]" no schemas match.
Because of https://github.com/eslint/eslint/blob/67c3cc2fa655e9e92e01d7a88e9a9d60cd4a4ce9/lib/rules/key-spacing.js#L271-L321 (multiLine.mode
isn’t allowed with align
option)
Are they designed as they are?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
A very complicated multiple lines problem in the align ...
As you see in the pdf file, formulas (1) and (2) are usual situation in the align environment. But if (2) is too...
Read more >How to align equations in LaTeX?
1. Left alignment of multiline equations in LaTeX. The first environment from the amsmath package that we are going to explain is the...
Read more >Developers Who Use Spaces Make More Money Than Those ...
In my experience, it's the complete opposite. Tabs “just work” and let me align things effortlessly. You can align with spaces, but that...
Read more >Configuration | Grafana Loki documentation
Configuring Grafana Loki Grafana Loki is configured in a YAML file (usually referred to as loki.yaml ) which contains information on the Loki...
Read more >Using Adobe FrameMaker (2019 release)
Structured FrameMaker mode . ... Set automatic alignment for a vertical list or multiline equation . ... Align items in a horizontal list...
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
@whizark is right -
align
isn’t respecting its ownmode
at all, and is instead usingmultiLine
’smode
value.Two steps to fixing this:
mode.align
. Right now justmultiLine.align.mode
is permitted.mode
usesalign
’s setting, if present, when properties are part of a group.@btmills made a PR if you’d like to check it out