Import order
is there a vscode extension or prettier/eslint setting to do this?
and whenever you do a document format it'll order things
10 Replies
sort-imports - Visual Studio Marketplace
Extension for Visual Studio Code - Sort ES6 imports automatically.
npm
@trivago/prettier-plugin-sort-imports
A prettier plugins to sort imports in provided RegEx order. Latest version: 4.0.0, last published: 2 months ago. Start using @trivago/prettier-plugin-sort-imports in your project by running
npm i @trivago/prettier-plugin-sort-imports
. There are 50 other projects in the npm registry using @trivago/prettier-plugin-sort-imports.npm
eslint-plugin-simple-import-sort
Easy autofixable import sorting. Latest version: 10.0.0, last published: 8 days ago. Start using eslint-plugin-simple-import-sort in your project by running
npm i eslint-plugin-simple-import-sort
. There are 815 other projects in the npm registry using eslint-plugin-simple-import-sort.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, I can see how that can be an issue, if VS Code would do auto importing all the time it wouldn't be so big of a problem lol
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I can also recommend this package.
You can even create custom groups to adjust what comes first and what later 😍
https://github.com/lydell/eslint-plugin-simple-import-sort/#custom-grouping
GitHub
GitHub - lydell/eslint-plugin-simple-import-sort: Easy autofixable ...
Easy autofixable import sorting. Contribute to lydell/eslint-plugin-simple-import-sort development by creating an account on GitHub.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sort-imports - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
I use these settings
it was pretty hard core at first, but I absolutely love the alphabetical order... would never go back, honestly
it's like with books, you buy a bunch of them, and first you organize them according to topic, etc...
but then comes the point (for me it was ~3000 copies) when I just went fuck it, and rearranged everything in ruthless alphabetical order
it's reallly nice in the context of big, enterprise code