Skip to content
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

Unable to easily customize recommended config due to overrides #165

Open
jaydenseric opened this issue May 13, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@jaydenseric
Copy link

commented May 13, 2019

It is difficult to override rules causing errors in .mjs (and presumably .cjs) files in projects, due to the use of overrides in the recommended config having a high specificity:

https://github.com/mysticatea/eslint-plugin-node/blob/v9.0.1/lib/configs/recommended.js#L13

This ESLint config will not work:

{
  "plugins": ["node"],
  "extends": ["plugin:node/recommended"],
  "rules": {
    "node/no-missing-import": "off"
  }
}

You must use matching overrides for .mjs:

{
  "plugins": ["node"],
  "extends": ["plugin:node/recommended"],
  "overrides": [
    {
      "files": ["*.mjs", ".*.mjs"],
      "rules": {
        "node/no-missing-import": "off"
      }
    }
  ]
}
@mysticatea

This comment has been minimized.

Copy link
Owner

commented May 13, 2019

Thank you for the report.

This is a bug of ESLint (eslint/eslint#11510) and has been fixed on master (eslint/eslint#11546).

For now, please use one of workarounds:

  • Use plugin:node/recommended-script or plugin:node/recommended-module.
  • Use overrides in your config.
  • Use eslint@next (6.0.0-alpha.1)

@mysticatea mysticatea added the question label May 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.