Created
December 7, 2016 06:23
-
-
Save alex35mil/1de6c041a35c86dc70a1204dafd4e50a to your computer and use it in GitHub Desktop.
Eslint comma-dangle w/ rest/spread operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint comma-dangle: ["error", "always-multiline"] */ | |
// rest | |
/* ok */ | |
const rest = ({ | |
prop, | |
...otherProps | |
// ^ | |
// no comma | |
}) => console.log(prop, ...otherProps); | |
/* error */ | |
const rest = ({ | |
prop, | |
...otherProps, | |
// ^ | |
// comma | |
}) => console.log(prop, ...otherProps); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint comma-dangle: ["error", "always-multiline"] */ | |
// spread | |
const obj = { a: 1, b: 2 }; | |
/* ok */ | |
const spread = { | |
...obj, | |
// ^ | |
// comma | |
}; | |
/* error */ | |
const spread = { | |
...obj | |
// ^ | |
// no comma | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment