eslint-plugin-modules-newline
eslint-plugin-modules-newline copied to clipboard
Options for newlines, and imported specifiers count
Hi, thank you for such a nice plugin :), would be amazing to have ability to transform such code:
const a, {x, y} from 'z'
Into
const a, {
x,
y,
} from 'z';
And also to ignore such cases:
const {x} from 'z';
const {x, y} from 'z';
Could you please add options for this :)? It can be something like:
-
newLineBeforeCurlyOpen
-
minSpecifiersCount
- or
minSpecifiersLength
, the thing is names can be pretty short:
import {x, y, z, a, b, c} from 'alphabet'
For this case, specifiersLengnth
count, and it's much readable in one line :). What do you think about it?
Update: implemented in eslint-plugin-putout.
Hello @coderaiser.
Thank you for a good suggestion. I'll allocate some time for implementation later. PRs are welcome =).
+1 for leaving the default value with the curly on the same line.
Thanks so much gmsorrow for the excellent eslint plugin. I too, am greatly desiring the "only warn me if there are 4 or more things on the same import line" option, which I presume is what coderaiser means by "minSpecifiersCount". (This is exactly what the Airbnb style guide prescribes, which is the most popular style guide in the world, if I am not mistaken.)
hi @gmsorrow how is this issue? is it implemented? this issue is also what I want
I've since created eslint-plugin-import-newlines for this to use in my projects.
@SeinopSys, is it possible to apply this rule for export, object destructuring...?
Feel free to open as issue in my repo for it and I'll take a look when I have the time. I find Eslint's plugin documentation extremely lacking to say the least, so I can't make any promises if I'll be able to figure anything else out that my package doesn't already do.
For everyone reading this thread, I recommend this, which I have been using for a while and am very happy with: https://github.com/simonhaenisch/prettier-plugin-organize-imports