Closed lveillard closed 2 years ago
Hi!
Regarding tsconfig.json: I thought a lot about adding automatic support for paths
and baseUrl
in there, but came to the conclusion that it’s complexity I don’t need myself so I don’t want to maintain it: https://github.com/lydell/eslint-plugin-simple-import-sort/issues/31#issuecomment-939271796
This section in the docs is interesting as well: https://github.com/lydell/eslint-plugin-simple-import-sort#custom-grouping
If you’re looking at custom grouping because you want to move
src/Button
,@company/Button
and similar – also consider using names that do not look like npm packages, such as@/Button
and~company/Button
. Then you won’t need to customize the grouping at all, and as a bonus things might be less confusing for other people working on the code base.
Otherwise you’ll basically need to duplicate your baseUrl config in this plugin’s options, and possibly use fs.readdirSync
: https://github.com/lydell/eslint-plugin-simple-import-sort/issues/31#issuecomment-654152415
Finally, if you already have a working import/order
setup, just out of curiosity I’m interested in why you’re looking into switching to this plugin?
Closing because I don’t think there’s anything I’d like to change, and there was no response to the import/order
question.
Because im using this boilerplate: https://github.com/ixartz/Next-js-Boilerplate
They removed the import/order config and added this package. I check it from time to time and i do as they do because they tend to take rigth decisions for DX.
But in this case i have my custom baseurl so it does not work properly.
I reverted it and kept using my config, but wanted to share it with you and add the config, in case you wanted to make it compatible for those cases also.
But i totally understand your decision, and the package is a quick win for everyone not modifying the baseurl which is 99% of the people 👌
Hello! I'm using
"baseUrl": "./src",
in my tsconfig file in order to import my modules without the annoying../......
thingsHowever this makes some weird sorting like these:
where all nut the two last ones are internal libs Is there a way to fix this? thanks!
btw in case it helps, this eslintr config works properly: