Create-nuxt-app: no console.log warnings anymore

Created on 27 Jul 2019  ·  6Comments  ·  Source: nuxt/create-nuxt-app

Hi

Kudos on the new v2.9.0.
I've used it to scaffold a new project using yarn create nuxt-app.
It have the following dependencies in package.json:

 "devDependencies": {
    "@nuxtjs/eslint-config": "^1.0.1",
    "@nuxtjs/eslint-module": "^0.2.1",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.15.1",
    "eslint-plugin-nuxt": ">=0.4.2",
    "eslint-config-prettier": "^4.1.0",
    "eslint-plugin-prettier": "^3.0.1",
    "prettier": "^1.16.4",
    "husky": "^2.6.0",
    "lint-staged": "^8.2.1",
    "nodemon": "^1.18.9"
  }

When I write for example this:

<script>
export default {
  computed: {
    test() {
      console.log('test')
      return 'test'
    }
  }
}
</script>

I don't get any warnings of console.log in my code, not for yarn dev nor for yarn build.
When I used the previous yarn create nuxt-app to scaffold a new project, I did get those warnings for console.log.

Why this change? Or did I miss something?

All 6 comments

I fount it comes from https://github.com/nuxt/eslint-config/pull/2, this rule is only enabled in production now.

@clarkdo Thanks for the reply, that already solves the development part. But I don't get any warnings/errors when I am in production: e.g. running yarn build or yarn generate. Why is that?

I’ll discuss with team and provide a proper solution, for now I think should be prepending “NODE_ENV=production” in lint scripts link.

Or override it in eslintrc.js:

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

@miteyema I made a pr for making it warning level in development mode

@manniL Awesome, thank you so much for this fast response!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itgelo picture itgelo  ·  3Comments

JasonKroll picture JasonKroll  ·  7Comments

artmarydotir picture artmarydotir  ·  4Comments

sandro-git picture sandro-git  ·  4Comments

JuanJuanZhang123 picture JuanJuanZhang123  ·  5Comments