You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Docs] order: Add a quick note on how unbound imports and --fix
Having unbound imports mixed among the bound ones causes unexpected and incorrect seeming results. I spent several hours trying to fix this problem only to find it was well known!
Copy file name to clipboardExpand all lines: docs/rules/order.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,25 @@ import foo from './foo';
77
77
var path =require('path');
78
78
```
79
79
80
+
## Limitations of `--fix`
81
+
82
+
Unbound imports are assumed to have side effects, and will never be moved/reordered. This can cause other imports to get "stuck" around them, and the fix to fail.
83
+
84
+
```javascript
85
+
importbfrom'b'
86
+
import'format.css'; // This will prevent --fix from working.
87
+
importafrom'a'
88
+
```
89
+
90
+
As a workaround, move unbound imports to be entirely above or below bound ones.
0 commit comments