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

Rule proposal: import sorting rule which matches that of Organize Imports in TypeScript #113

Closed
aboyton opened this issue Jan 21, 2019 · 6 comments
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on

Comments

@aboyton
Copy link
Contributor

aboyton commented Jan 21, 2019

TypeScript has a wonderful feature "Organise Imports". To ensure that everyone orders imports the same way it's great to also have this as a lint rule as well (rather than someone reformatting the file who has "organise imports" turned on in their editor).

The TSLint rule ordered-imports can almost be configured to support this ordering (there's a bug with the differences between .toUpperCase and .toLowerCase see palantir/tslint#4063 and aboyton/tslint@fa78d7c).

Maybe I'm just incompetent, but I couldn't get import/order as suggested in https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md#style to order things in the same order as TypeScript's "Organise Imports" feature.

It would be great to have a rule that orders in this order (which is basically case-insensitive by doing x.toUpperCase). Whether this comes from making a new rule or adding an option to import/order doesn't really both me.

@aboyton aboyton added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jan 21, 2019
@j-f1 j-f1 added enhancement: new plugin rule New rule request for eslint-plugin and removed triage Waiting for maintainers to take a look labels Jan 22, 2019
armanio123 pushed a commit to armanio123/typescript-eslint that referenced this issue Jan 24, 2019
@djskinner
Copy link

Seems related to #256

@alfaproject
Copy link

I have the same issue and I'm currently using import/order but I really dislike because I've tried so many different configuration options and can't really match TypeScript ordering.

Does anyone have working rules/plugins that can suggest here that might help other people?

@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@bradzacher bradzacher changed the title Support import ordering to match that of Organize Imports in TypeScript Rule proposal: import sorting rule which matches that of Organize Imports in TypeScript May 3, 2022
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Feb 5, 2023

We've been using eslint-plugin-simple-import-sort for a while internally and have been very satisfied with it. @typescript-eslint/triage-team what do you think about us wontfixing this issue and directing people to that plugin?

As much as I would love to have an aligned-to-TypeScript auto-fixing import sorting rule in typescript-eslint, we really don't have the maintainer bandwidth to take on that surprisingly large rule.

@bradzacher
Copy link
Member

Yeah I think that it's not something we're going to work on - there are plenty of other import sorting rules out there and I don't think adding another one to the pile really helps the ecosystem, esp when we would have to take on the maintenance burden of keeping it in-sync with the TS implementation for the user's installed version.

I'm happy to close this.

@JoshuaKGoldberg JoshuaKGoldberg added wontfix This will not be worked on and removed accepting prs Go ahead, send a pull request that resolves this issue labels Feb 5, 2023
@JamesHenry
Copy link
Member

👍

@cmalard
Copy link

cmalard commented Feb 5, 2023

For those who want to have this feature anyway: I'm using https://www.npmjs.com/package/prettier-plugin-organize-imports
That's not with ESLint but with Prettier... and according to Prettier team, this is not something that should be done by Prettier (ie, sorting things or changing the AST).
But it does the job how I want it... until someone finds the time & the motivation to do it through Prettier 🍻 (and if you have some Prettier plugins conflicts, this one can help ^^)
Best 🍻

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

8 participants