How to allow console.info()/warn()/error() and disable everything else in eslint config file?

566 views Asked by At

I had .eslintrc file without "no-console" rules, and it by default errored on all console.*() calls.

I need to allow console.info(), console.warn() and console.error(), so I added no-console rule to my .eslintrc:

{
  "root": true,
  "no-console": [
    "error",
    {
      "allow": ["info", "warn", "error"]
    }
  ],
  "parser": "babel-eslint",
  "extends": ["eslint:recommended"],
  "env": {
    "browser": true,
    "node": true
  }
}

Now eslint doesn't complain on "info", "warn", "error", but it doesn't complain on "log" either.

What am I missing?

1

There are 1 answers

0
Allan Chain On BEST ANSWER

Your config is invalid, so ESLint is not working properly. Use no-console in rules:

{
    "rules": {
        "no-console": [ ... ]
    }
}