-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import/order Issue: Inconsistency of sorting, presumably because of different operating systems #2988
Comments
Same error |
Yes, I am having the same issue where I am getting Looks like it an operation system or architecture behaviour different for sorting. I only couldn't figure out anything obvious in |
I also have a problem where my config is: "import/order": [
"error",
{
"alphabetize": {
"order": "asc"
},
"groups": [["builtin", "external"], "internal", "parent", "sibling", "index"]
}
], and then after running eslint --fix the resulting imports are: import { ThemeService } from '@shared/utils';
import { SliderColorClass } from '@ui-library/enums/slider-color-class.enum';
import { differenceWith, isEqual } from 'lodash-es';
import { BehaviorSubject, Subject, combineLatest, map } from 'rxjs';
import { startWith } from 'rxjs/operators';
import { CriteriaMetricTypeEnum } from '../enums/criteria-metric-type.enum';
import { CriteriaTypeEnum } from '../enums/criteria-type.enum';
import {
criteriaListToSimpleCriteriaList,
isMetricCriteria,
plainCriteriaToCriteria,
} from '../functions/criteria-utils'; In my workspace all the @UI-library and @shared/ are both libs within my nx project. (but lodash-es, rxjs are both external modules) So, as I said. The config above is the one I get after running eslint. But when my IDE automatically runs eslint, it still shows me errors like So it seems like normally @shared/utils seems to be recognized as something external(?). Any idea how to fix this? |
@LeLunZ if it's working on the command line, then it's an issue with your IDE or your IDE configuration. |
Node version: 18.19.1
npm version: 9.6.6
Local ESLint version: v8.57.0
Global ESLint version: v8.57.0
Operating System: Windows 10.0.22631 Build 22631 and Ubuntu 22.04.4 (LTS)
.eslintrc.cjs
package.json
The issue refers to an inconsistency of the sorting of the "import/order" rule, presumably because of different operating systems. It is a svelte project in typescript.
This is a minimal example:
We expected the imports to be sorted like this (using
eslint --fix
):This works on the Github Runner (Ubuntu) that runs the linting on every commit (
npm ci && npm run lint
). The problem is that on my machine (Windows), the linter reports an error that the imports are sorted incorrectly:error `./edit-dialog.svelte` import should occur before import of `$lib/validators` import/order
After running
eslint --fix
on my windows machine, the imports are sorted like this:When making a commit with this import order, the linting on github fails with the error:
./edit-dialog.svelte` import should occur after import of `$lib/validators
Is there something wrong with my configuration?
Thank you in advance!
The text was updated successfully, but these errors were encountered: