renke / import-sort

Sort ES2015 (aka ES6) imports. Both JavaScript and TypeScript are supported.
ISC License
466 stars 69 forks source link

case-insensitive rule in esLintConfig is being ignored (eslint version issue?) #119

Open codefactor opened 4 years ago

codefactor commented 4 years ago

We are using a method to import eslintConfig from another project, which I will demonstrate below, so that all our projects do not need to duplicate the same eslint rules. I will try to simplify the files as much as possible

eslintproject/package.json

{
  "peerDependencies": {
    "eslint": ">= 6.8.0"
  }
}

eslintproject/index.js

module.exports = {
  "rules": {
    "sort-imports": [2, {"ignoreCase": true}]
  }
}

project/package.json

{
  "dependencies": {
    "eslint": "^7.0.0"
  },
  "eslintConfig": {
    "extends": "eslintproject"
  }
}

In the above example, the vs code extension "sort-imports" is not respecting the case insensitive rule and produces the wrong sorting that will break the eslint checks.

Here is a related line: https://github.com/renke/import-sort/blob/master/packages/import-sort-style-eslint/src/index.ts#L28 https://github.com/renke/import-sort/blob/master/packages/import-sort-style/package.json#L27

I think this is based on an older version of eslint that doesn't support the way that it is being extended in the example above and so it doesn't see this particular rule, is it possible to upgrade to a newer version somewhere?

I would really like to use this vs code extension but it is not working for me.