Skip to content

Instantly share code, notes, and snippets.

@alex35mil
Created December 7, 2016 06:23
Show Gist options
  • Save alex35mil/1de6c041a35c86dc70a1204dafd4e50a to your computer and use it in GitHub Desktop.
Save alex35mil/1de6c041a35c86dc70a1204dafd4e50a to your computer and use it in GitHub Desktop.
Eslint comma-dangle w/ rest/spread operators
/* 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);
/* 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