Can't enable no-console using eslint cli

Viewed 120

I'm using eslint, and in my configuration file I have "no-console": "off".

I want to turn it on for my CI system, so I've been using the command line (vue cli syntax):

vue-cli-service lint --rule '"no-console": "error"'

This doesn't work.

However, if I invert things (set error in the configuration, and pass off as a flag) it does work.

Anyone know why?

1 Answers

EDIT: it should probably look like vue-cli-service --rule 'no-console: 2'
PS: "error" may be working too I guess.


You can make a config in a lot of places but the usual one is probably .eslintrc.js in which you can write

module.exports = {
  [...]

  // add your custom rules here
  rules: {
    "no-console": "off",
  },
}

As shown here: https://eslint.org/docs/rules/no-console
This one should work but it always depend on how your project is setup too.

Related