question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected Import Order

See original GitHub issue

Consider 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:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewwithanmcommented, Dec 23, 2013

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.

0reactions
matthew-deancommented, Dec 23, 2013

Huh. I guess I never had this be problem so I never thought about it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found