Skip to content

Instantly share code, notes, and snippets.

@imShara
Created August 24, 2019 10:36
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imShara/453e31c259659ac81eeec72b6012227c to your computer and use it in GitHub Desktop.
Save imShara/453e31c259659ac81eeec72b6012227c to your computer and use it in GitHub Desktop.
ESlint automatically fix on file save with Nuxt

Old Way

Suggested by lcaprini

// nuxt.config.js
build: {
  extend(config, ctx) {
    if (ctx.dev && ctx.isClient) {
      config.module.rules.push({
        enforce : 'pre',
        test    : /\.(js|vue)$/,
        loader  : 'eslint-loader',
        exclude : /(node_modules)/,
        options : {
            fix : true
        }
      });
    }
  }
}

New Way

Since commit

// nuxt.config.js
buildModules: [
  ['@nuxtjs/eslint-module', {
    fix: true
  }]
]
@ramonsenadev
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment