Jackie
Jackie

Reputation: 23527

ESLint not sending warning for console.log

I have the following .eslintrc...

{
  plugins: [
    'markdown',
    'json'
  ],
  parserOptions: {
    'ecmaVersion': 2017,
    'sourceType': 'module',
  },
  extends: [
    'eslint:recommended',
    'plugin:vue/essential'
  ]
}

To test it I add a console statement to test.js and run ./node_modules/.bin/eslint <folder>/test.js. I would expect to see something like...

warning Unexpected console statement
no-console

But instead I see no output. what am I missing?

Upvotes: 0

Views: 523

Answers (2)

Soryn Gitlan
Soryn Gitlan

Reputation: 11

I think it will work for you. Pay attention to extends and plugins. I use this structure in my project and everything is ok. And you added console.log in .js file, eslint:recommended will work.

module.exports = {
  root: true,
  parserOptions: {
    parser: "babel-eslint",
    sourceType: "module"
  },
  env: {
    browser: true
  },
  extends: [
    "eslint:recommended",
    "plugin:vue/recommended"
  ],
  plugins: [
    "vue" // required to lint *.vue files
  ],
  // add your custom rules here
  rules: {
    "arrow-parens": 0,
    "generator-star-spacing": 0,
    "no-debugger": process.env.NODE_ENV === "production" ? 2 : 0
  }
}

Upvotes: 1

Jackie
Jackie

Reputation: 23527

In my case I had another eslintrc further down with this...

extends: [
  'plugin:vue/strongly-recommended',
  'plugin:vue/recommended'
]

I thought this merged the lists for some reason but it actually overrides the list.

Upvotes: 0

Related Questions