Recommended import grouping and order?
See original GitHub issueIs there a recommended import grouping and order for es6 modules?
python has some specifications in PEP as well as some logical extensions: https://code.google.com/p/soc/wiki/PythonStyleGuide#Imports_grouping_and_order
given that es6 imports are reversed, ie instead of:
from <module> import <function>
(python)
its
import <function> from <module>
sorting by module isn’t as intuitive
Issue Analytics
- State:
- Created 8 years ago
- Reactions:7
- Comments:5
Top Results From Across the Web
What's the correct way to sort Python `import x` and `from x ...
Imports should be grouped in the following order: standard library imports; related third party imports; local application/library specific ...
Read more >Rule: ordered-imports - Palantir Open Source
Requires that import statements be alphabetized and grouped. Enforce a consistent ordering for ES6 imports: Named imports must be alphabetized (i.e. “import {A, ......
Read more >Sorting your imports correctly in React - DEV Community
Sorting your imports in a JS file has a lot of benefits. First at all makes it easier to see what you imported...
Read more >Golang imports sorting/grouping hell and painless tool to solve it
For a long time of being working as Golang Dev I saw that a lot of my coleagues don't pay attention on right...
Read more >Sort TypeScript import groups from standard to local - vxlabs
Of course you are already making use of tslint's ordered-imports rule, which means your within group ordering is consistent. However, on that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with @mhahn, perhaps because I’ve also spent a lot of time writing Python according to PEP8 standards.
Import ordering matters because:
It’s the same argument for any code style guideline, so simply saying it “doesn’t matter” isn’t really valid. Why does whitespace matter? Why do single versus double quotes matter?
There’s already an eslint rule in our config that prevents dupes, so there’s no need for a human to ever worry about that anymore.