import-js/eslint-plugin-import

import/order named option causes eslint error

jschroeter opened this issue · 2 comments

When adding the named option as described in the docs, I get the following error:

Error: .eslintrc.cjs:
        Configuration for rule "import/order" is invalid:
        Value {"alphabetize":{"order":"asc"},"named":true,"distinctGroup":true,"warnOnUnassignedImports":false} should NOT have additional properties.

    at ConfigValidator.validateRuleOptions (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2048:23)
    at eval (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2103:18)
    at ConfigValidator.validateRules (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2100:34)
    at ConfigValidator.validateConfigArray (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2226:18)
    at CascadingConfigArrayFactory._finalizeConfigArray (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3985:23)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/home/projects/vitejs-vite-qclkzf/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3791:21)
    at FileEnumerator._iterateFilesRecursive (/home/projects/vitejs-vite-qclkzf/node_modules/eslint/lib/cli-engine/file-enumerator.js:450:49)
    at FileEnumerator.iterateFiles (/home/projects/vitejs-vite-qclkzf/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:49)

Demo: https://stackblitz.com/edit/eslint-import-order?file=.eslintrc.cjs,src%2Fmain.js,package.json&terminal=dev
Run: npm run lint

Am I missing something?

I worked around this by using

    "sort-imports": [
      "error",
      {
        ignoreDeclarationSort: true,
      },
    ],

but I'm wondering why I can't use the named option of import/order.

Because that option isn't released yet. Everywhere on github, you can't look at the docs on the default branch - you need to look at them on the tagged version you're using.

That makes sense, totally missed that. Thanks!