Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

65
Views
Extending `.eslintrc.base.js`, but omit one plugin from parent

I have an .eslintrc.base.js with the following configuration:

module.exports = {
    env: {
        browser: true,
        node: true,
        jest: true
    },
    extends: [
        'eslint:recommended',
        'plugin:react/recommended',
        'prettier'
    ],
    // ...
}

Most sub-packages in my project inherit this and just add to the rules or modify a couple of rules.

For one package though, I'd like to omit plugin:react/recommended, which the base config extends.

Is this possible? Or do I need to create an additional layer of config files, something like this:

  • .eslintrc.base.js: as it is now, but without plugin:react/recommended
  • .eslintrc.base.react.js: extends base config, adding react elements
  • <package>/.eslintrc.js: extends either .eslintrc.base or .eslintrc.base.react
7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

You could have a single ESLint configuration file and specify overrides in it.

{
  "env": {
    "browser": true,
    "node": true,
    "jest": true
  },
  "extends": [
    "plugin:react/recommended",
    "eslint:recommended",
    "prettier"
  ],
  //override "extends" for the package for which you want to omit "plugin:react/recommended"
  "overrides": [
    {
      "files": ["package/that/omits/plugin/react/*"],
      "extends": [
        "eslint:recommended",
        "prettier"
      ]
    }
  ]
}
7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs