eslint-plugin-import
eslint-plugin-import copied to clipboard
autofixing "no-duplicates" does not add whitespace after commas
I had some code like this
import { a } from "pkg"
import { b } from "pkg"
ESLint's autofix for "import/no-duplicates" did work, but it left a and b glued together like so
import { a,b } from "pkg"
Having the imports glued by commas upsets Prettier. A sensible solution is to add a whitespace after the comma(s).
import { a, b } from "pkg"
It seems that setting up eslint-plugin-prettier gets around this... But it'd be nice if this plugin could add the whitespaces by itself
prettier should only ever be run via eslint anyways :-)
an alternative solution is to use the comma-spacing eslint rule to correct it. I’d be fine changing this rule to add the whitespaces by default tho, since that’s by far the more common style.