Unexpected Import Order
See original GitHub issueConsider the following three files:
main.less
@import 'component';
@import 'base';
base.less
.base {
color: red;
}
component.less
@import 'base';
.component:extend(.base) {
color: blue;
}
Compiling main gives the following:
.component {
color: blue;
}
.base,
.component {
color: red;
}
I think I understand why this is happening: the compiler is scanning main.less and seeing “component” before “base.” However, I would expect that importing “base” in “component.less” would be sufficient to tell the compiler that “base” is a dependency of “component” and therefore should be included first. The fact that the locally defined dependency isn’t necessarily inserted first means that the importing file can easily screw up your order, creating subtle bugs. Worse, it may be very difficult to address because, by the time you realize it, you may have written other rules that depend on the (in my opinion) incorrect order.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Unexpected behavior import order. · Issue #1236 · pinterest/ktlint
I have upgraded from version 0.36.0 to 0.42.1 . Now the ktlint on my import order issues the message: "Imports must be ordered...
Read more >ESLINT Unexpected top-level property "import/order" error
I have a suspicion your issue is that you don't have an extends property that includes the import rules. Here's my eslint config:...
Read more >wrong-import-order / C0411 - Pylint 2.16.0-dev documentation
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports). Problematic code:.
Read more >Troubleshoot Store Import Errors - ShipStation Help
Follow the troubleshooting steps below when a store or marketplace receives an error message while attempting to import orders into ...
Read more >FA: SCM: OM: Importing Orders Using FBDI Fails With ...
FA: SCM: OM: Importing Orders Using FBDI Fails With: Unexpected exception caught: java.lang.NullPointerException (Doc ID 2680479.1).
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
Sorry, I don’t mean to beat a dead horse but I want to make sure I was being clear. I wasn’t talking about extends dependencies but rather file dependencies. The thing that seems strange to me is that it’s possible for a file to come before its dependencies in the compiled output.
Huh. I guess I never had this be problem so I never thought about it.