Closed petrelselina closed 8 years ago
I mean write an array in single line, thx.
Hello.
According to https://github.com/airbnb/javascript#arrays--callback-return it should looks like these:
// good
[1, 2, 3].map(x => x + 1);
// good
const flat = {};
[[0, 1], [2, 3], [4, 5]].reduce((memo, item, index) => {
const flatten = memo.concat(item);
flat[index] = flatten;
return flatten;
});
It looks like a bug tho since requireTrailingComma
should not require it for inlined arrays.
/cc @markelog @hzoo Thoughts?
Just run jscs --preset airbnb
on
const flat = {};
[[0, 1], [2, 3], [4, 5]].reduce((memo, item, index) => {
const flatten = memo.concat(item);
flat[index] = flatten;
return flatten;
});
Don't see any errors. With those three rules i also don't see any contradictions.
@petrelselina i'm gonna close this for now, please ping us up if you find any bugs, thank you
requireTrailingComma:true disallowSpacesInsideArrayBrackets:true requireSpaceAfterComma:true These 3 rules in presets/airbnb.json , please show me how to write an array. It must write comma before closing bracket, if write space after comma, but cannot write space before closing bracket, so there is no way to write an array.