potentially fixable with the `--fix` option

Ricardo Moreira picture Ricardo Moreira · Jan 13, 2019 · Viewed 40.7k times · Source

I am creating a app with nuxt.js but everytime I launch the app, gives me the error of eslint and saying "potentially fixable with the --fix option."

I did the command npm run lint -- --fix and it works but then If I do another change in any vue file it comes again the same error and I have to do it again

Any idea of how to fix that?

Answer

Md Mahamudul Hasan picture Md Mahamudul Hasan · Jan 16, 2019

Use the configuration below into nuxt config file:

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

Important part is:

options: {
  fix: true
}