3

I would like to deactivate a babel eslint rule no-unused-vars.

if using to eslint (not babel-eslint) I would add the following

.eslintrc.js

 rules: {
    'no-unused-vars': 'off'
  }

So I tried adding the same code to

babel.config.js

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
 ],
  rules: {
   'no-unused-vars': 'off'
 }
}

but this generates an error

 ERROR  ReferenceError: Unknown option: .rules. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.

I can find no mention of rules in the docs. I tried exclude but that did not work in disabling the rule.

art vanderlay
  • 2,341
  • 4
  • 35
  • 64

1 Answers1

0

I was able to add a "eslintConfig" section to my package.json and it was respected by my linter running on every build.

I might suggest adding your rules there.

You might need to change some plugins or other configs, but I removed those from the snippet to cut down on the size.

"eslintConfig": {
        [... removed for brevity]
        "parser": "@babel/eslint-parser"
        "rules": {
            "no-unused-vars": "off"
        }
    },
TylerSmall19
  • 141
  • 1
  • 4