New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
key-spacing
: multiLine.align.mode
is overridden, multiLine.mode
with align
causes an error
#6691
Comments
The object var a = {
foo : 1,
align1: {
foo: 2
},
align2: {
foo: 3
},
bar: 4
}; Since As for the schema error, that is a bug. |
@btmills Thank you for you explanation. I had a slight misunderstanding about align... 😳 var myObj = {
key1: 1, // uses multiLine
key2: 2, // uses align (when defined)
key3: 3, // uses align (when defined)
key4: 4 // uses multiLine
} The result is: 4:12 error Extra space before value for key 'key2' key-spacing
5:12 error Extra space before value for key 'key3' key-spacing I'm a little confused because |
@whizark is right - Two steps to fixing this:
|
i'll work on this! |
Great, @azhang496 - let us know if you need any help! |
sorry for the delay - @btmills is it necessary to change the schema? seems like this can be fixed just by changing this eslint/lib/rules/key-spacing.js Line 139 in 67c3cc2
mode: toOptions.multiline.align.mode
|
@azhang496 I'm on my phone, so I can't check to be sure, but if the scheme is left unchanged, won't the case 2 config (setting a mode under align) still throw a validation error? It looks like your suggestion would fix case 1 👍 If you want to tackle one at a time, a first PR with (refs #6691) would be fine. |
@btmills i can do both! i didn't realize the goal was to fix both cases, since just fixing case 1 would give the option to have different modes for |
@btmills made a PR if you'd like to check it out |
What 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
case2.js
What did you do? Please include the actual source code causing the issue.
test.js
What did you expect to happen?
Case 1
Case2
What actually happened? Please include the actual, raw output from ESLint.
Case 1
Because of
eslint/lib/rules/key-spacing.js
Line 139 in 67c3cc2
Case2
Because of
eslint/lib/rules/key-spacing.js
Lines 271 to 321 in 67c3cc2
multiLine.mode
isn't allowed withalign
option)Are they designed as they are?
The text was updated successfully, but these errors were encountered: