microsoft / vscode-eslint

VSCode extension to integrate eslint into VSCode
MIT License
1.69k stars 323 forks source link

Errors differ from command line for import ordering #1819

Closed markedwards closed 2 months ago

markedwards commented 2 months ago

I'm seeing incorrect errors from the extension, which do not agree with command line output or with the actions taken by --fix.

The relevant .eslintrc.json rules are:

"import/order": [
  "error",
  {
    "alphabetize": {
      "caseInsensitive": true,
      "order": "asc"
    },
    "groups": ["builtin", "external", "internal"],
    "pathGroups": [{
        "pattern": "react",
        "group": "external",
        "position": "before"
      }
    ],
    "pathGroupsExcludedImportTypes": ["react"],
    "newlines-between": "always",
    "warnOnUnassignedImports": true
  }
],
"sort-imports": [
  "error",
  {
    "ignoreDeclarationSort": true
  }
]

The disagreement is around newlines-between and the ordering of groups. The command line is delivering the correct results, but the extension is behaving as if groups and newlines-between are default.

Looking for some clue as to how to debug this after a few hours of chasing it.

markedwards commented 2 months ago

This turned out to be an issue with a project in a subdirectory, which was resolved by setting "eslint.workingDirectories": [{ "mode": "auto" }].