eslint-plugin-import-newlines
eslint-plugin-import-newlines copied to clipboard
Comment on a new line gives error
import {
BaseButton,
Box,
Provider,
// here is a comment
Typography,
theme,
} from '...';
I'm getting Import lines cannot have more than one blank line between them.
when I have a comment, maybe this is a bug given that it's not a newline but a comment?
If it helps, I'm using hermes-parser
to parse my JS not sure if that would cause a problem
I am having quite a difficult time dealing with comments in the imports as I need to reconstruct the import statement from scratch each time to check how the fixed output would look like and adding comment processing to that is a significant effort for me. I already made an exception for the ts-ignore comments above the last line of the import but supporting every possible scenario starts to get out of hand. (think: line comment above the import, just after it, or block comments in either position)
I'll leave the issue open but I consider this issue really low priority and I'm not giving an ETA for a fix. My suggestion would be to stop commenting inside the imports, but I understand this is not something that is always within your control. In such cases I suggest not using this plugin or contributing a fix via a PR.
Thanks for the insight. I'm a fan of what this plugin provides so I'm keen to keep using it, I'll see what I can come up with