tslint-to-eslint-config
tslint-to-eslint-config copied to clipboard
Consider using an eslint import plugin instead of import/order
🚀 Feature Request
The script swaps in import/order for tslint's ordered-imports. I spent quite a while trying to configure it to sort things like tslint's rule did, before discovering eslint-plugin-simple-import-sort, which seems much closer to the old rule (and also much easier to configure!).
Existing Behavior
ordered-imports becomes import/order.
Change Proposal
ordered-imports becomes eslint-plugin-simple-import-sort
I haven't taken the time to check how well this would work for tslint.json settings beyond the ones I use, but for me simple-import-sort was fantastic!
Hi @danvk
In this case, we are basing our rule converters (hence the ESLint outputs) to the ones defined at typescript-eslint ROADMAP.
Heh, thanks for the link to eslint-plugin-simple-import-sort, that's a very appealing package...
For now, as KingDarBoja said, I think we are a little bound here to go with the typescript-eslint roadmap for the canonical rule replacements... however, IMO it really wouldn't be the end of the world if either:
- We bucked the trend and recommended a much closer rule
- The roadmap switched to the much closer rule
I don't suppose you have any thoughts @bradzacher?
🤷 I have no opinions about the "roadmap" file - the file was pieced together by people who aren't me over the years!
I've never used TSLint myself so I just defer to the community's guidance here. If there's a better rule feel free to update the file appropriately.
If that's the case, we could switch to the much closer plugin as it is easier for users to configure it like TSLint equivalent. I don't think community will be annoyed by this small change as this is only 1 rule being changed.
Hmm, I've been playing around with this and it seems eslint-plugin-import could be a better fit instead of eslint-plugin-simple-import-sort. The former has many options that line up with TSLint, including alphabetically, case-insensitivity, and grouping. eslint-plugin-simple-import-sort only has one option, groups, which means many options will be dropped during the conversion. There is also the fact that eslint-plugin-import seems to be more popular.
As others have mentioned, if we are deferring rules to an external package, we might as well make them as close as possible to TSLint. I would like to create a PR with either option ^w^, but I just wanted to make sure we make the right choice before I work on it
Hmm, that makes sense - you're right @hyperupcall. I'd love a PR for eslint-plugin-import then!