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

TSLint named-imports-order and ESLint sort-imports don't order special chars (_) the same as organizeImports #37548

Closed
snebjorn opened this issue Mar 24, 2020 · 3 comments
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@snebjorn
Copy link

TypeScript Version: 3.8.3

Search Terms:

  • named-imports-order organizeImports
  • named-imports-order

Code

// ordered using vscode organizeImports
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';

// ordered using tslint "named-imports-order": "case-insensitive" (this is the default)
// also tried "lowercase-first" and "lowercase-last" - it's worse
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';

Expected behavior:
They should sort _ the same.

Actual behavior:
TSLint seems to put _ first while organizeImports put it last. This is probably a general issue for non-alpha chars.

ESLint sort-imports also sorts special chars first.
Valid ESLint import order
Invalid ESLint import order

@snebjorn
Copy link
Author

snebjorn commented Mar 2, 2023

Wonder if this is solved by Case-Insensitive Import Sorting in Editors

@jakebailey
Copy link
Member

I think so? If not, the unstable options might cover it too.

cc @andrewbranch to confirm.

@andrewbranch
Copy link
Member

This is probably a general issue for non-alpha chars.

It was a problem only with the characters whose ASCII code is sandwiched between the uppercase and lowercase letters, of which only _ was a valid identifier character 😄

And yeah, it should have been fixed by #51733. Let us know if it’s not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants