Eslint-plugin-import: import/order reports different results on Windows vs Linux

Created on 23 Mar 2020  路  8Comments  路  Source: benmosher/eslint-plugin-import

Hello there..

When running eslint on my code (on Windows 10 OS), I was at a point where I didn't have any eslint issue. But when I was running eslint on the same code (without any changes) on a "Linux" platform (in my case, it was "Ubuntu 18.04.3 LTS" through WSL), the result was different only for the rule "import/order". I got something like tens of errors, with the SAME code and without any changes

image

Here is my setup:

_Versions_:
NodeJS: v12.14.1
Platform: Windows 10 + Ubuntu 18.04.3 LTS on WSL
"eslint": "6.8.0",
"eslint-plugin-header": "3.0.0",
"eslint-plugin-import": "2.20.1",
"@typescript-eslint/eslint-plugin": "2.24.0",
"@typescript-eslint/parser": "2.24.0",

Most helpful comment

We had the same problem. It seems to be fixed in master, but not released yet: https://github.com/benmosher/eslint-plugin-import/issues/1643

I downgraded to 2.19.1 to avoid the issue until the next release is out.

All 8 comments

Is there any chance that git is automatically changing the line-ending characters? What are the exact chars in use in that file on each machine?

@ljharb Thanks for your reply..

I've checked the line-ending characters format of files and initially, it was CRLF. I tried to changed it to LF for only 1 file and run again eslint on this file, on both Windows and Linux (WSL) and I have the same result on both platform: No eslint errors on Windows, but got 1 error on Linux, for the rule import/order... Tried on both Windows (With Visual Studio Code Powershell console) and Linux (Through WSL)

image

I'm seeing the same thing except it wants to sort the local paths first in windows and last in linux. I would expect the linux behavior to be the case in both oses. I tried converting the line endings from LF to CRLF or CR and none of them made a difference

We had the same problem. It seems to be fixed in master, but not released yet: https://github.com/benmosher/eslint-plugin-import/issues/1643

I downgraded to 2.19.1 to avoid the issue until the next release is out.

Ah, ok - fixed by #1643 then. Thanks!

I found that there are differences between mac and windows10. Will the latest version solve these problems?

@shx996 it should. if it doesn't, please file a new issue.

Sorry guys!

This hasn't been fixed for macs, importing modules on macs are still inconsistent.

Running on mohave.
nodejs 12.18.2
"eslint": "^7.3.1"
"eslint-plugin-import": "^2.18.2"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johanneswilm picture johanneswilm  路  21Comments

steve-taylor picture steve-taylor  路  24Comments

rhettlivingston picture rhettlivingston  路  31Comments

Robinfr picture Robinfr  路  27Comments

thewilkybarkid picture thewilkybarkid  路  36Comments