TypeScript: Organize Imports doesn't sort '_' as tslint expects it
TypeScript Version: 3.0.0-dev.20180620 vscode Version: 1.24.0 (6a6e02cef0f2122ee1469765b704faf5d0e0d859 2018-06-06T17:37:01.579Z) OS Version: Ubuntu 16.04 LTS
Search Terms: organise organize imports tslint
Code
import { foo, _bar } from 'baz';
Expected behavior: tslint expects the imports to have _ before alphabetic characters, so Organize Imports should sort it to import { _bar, foo }
Actual behavior: It sorts it to import { foo, _bar }, which causes a tslint error.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 11
- Comments: 16 (1 by maintainers)
As TSLint getting deprecated, we are trying to move to eslint-plugin-import’s import/order, which has the same issue. I filed an issue on their end (https://github.com/benmosher/eslint-plugin-import/issues/1742).
My PR for TSLint https://github.com/palantir/tslint/pull/4064 to change their order to be consistent with
Organise Importsactually got pushed 16 days ago (after more than a year) so once they make a release we should be able to close this issue.Personally I would love it if TypeScript would break imports onto multiple lines in the same way as Prettier does as running
Organise ImportsandPrettierboth conflict with each other, but maybe that’s deserving of a new issue 😃I think we decided it would be better to address this on the TSLint end but my PR there is waiting a major release despite having a backwards compatibility flag. I’d try bumping there myself. That said TSLint isn’t getting much love recently so I should get back to my PR on ESLint and address the issues that they had so it can be merged https://github.com/typescript-eslint/typescript-eslint/pull/256
Thanks for the reminder. There was a request on my PR, I’ve addressed that now and updated the PR. (Personally I just forked the TSLint rule but it would be nicer to get this merged into master.)
Ohh, okay. Thanks @Shobhit1