Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for newlines-between-types? #234

Open
gBasil opened this issue Mar 1, 2025 · 5 comments
Open

Support for newlines-between-types? #234

gBasil opened this issue Mar 1, 2025 · 5 comments

Comments

@gBasil
Copy link

gBasil commented Mar 1, 2025

It is an option for the order rule:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#newlines-between-types


Also, I was curious what the performance difference between is this package and the original, and what things are faster. I only want to do import sorting, so I was wondering if there are any performance improvements to that in this package, or if there wouldn't be much of a difference.

@gBasil
Copy link
Author

gBasil commented Mar 1, 2025

Looking at that property again, it seems I misunderstood what it does. What I wanted is for the order rule to sort types like I specify in groups, put types at the top, with a newline separating them from the other imports, and disallowing newlines anywhere else, like so:

import type foo from 'foo';
import type { bar } from 'bar';

import foo from 'foo';
import { bar } from 'bar';
import { baz, bazLegacy } from 'baz';

The rule doesn't seem to do this, and I don't know if it's possible to do this with the current configuration options.

So what I'm asking for is for this behavior, rather than that of newlines-between-types.

@silverwind
Copy link

This is a stylistic rule, right? Might fit better in https://github.com/eslint-stylistic/eslint-stylistic, or maybe they already have such a rule.

@JounQin
Copy link
Member

JounQin commented Mar 6, 2025

But also PR welcome to sync with upstream, so user migration from upstream plugin would be easier.

@silverwind
Copy link

Right, import/order is quite a bloated rule, but I guess upstream parity is always good.

@gBasil
Copy link
Author

gBasil commented Mar 7, 2025

This is a stylistic rule, right? Might fit better in https://github.com/eslint-stylistic/eslint-stylistic, or maybe they already have such a rule.

I had already looked around these before turning to eslint-plugin-import. From what I can tell, ESLint Stylistic decided to delegate all import-related code to eslint-plugin-import, which includes all the import ordering and newline rules and whatnot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants