No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Eslint not fixing Vue files

    Help
    4
    4
    3334
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mariaczi last edited by

      Hi,
      I have some components made already but definitely decided to move to Quasar.
      I was not writing accordingly to current standards so I need to clean up code now…

      I have cleaned all JS files by runing Eslint fix by PHPStorm but I can’t run for Vue files.
      I was trying to find solution to run fix on Vue files from npm script.
      I did add:
      "lint-fix": "eslint --fix --ext .js,.vue src"
      It is throwing all errors, but not fixing them as it suppose to do.

      I would really appreciate help with that.

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Does this help? https://github.com/vuejs/vue-loader/issues/155

        B 1 Reply Last reply Reply Quote 0
        • B
          bdam @rstoenescu last edited by

          Adding this since it is one of the top search results and the link above doesn’t directly answer the question of how to automatically fix style errors with elint.

          As of Aug 2020, all I had to do was add options: {fix: true,} to the eslint-loader webpack config in quasar.conf.js. Here’s the full section:

          // https://quasar.dev/quasar-cli/handling-webpack
                extendWebpack (cfg) {
                  cfg.module.rules.push({
                    enforce: 'pre',
                    test: /\.(js|vue)$/,
                    loader: 'eslint-loader',
                    exclude: /node_modules/,
                    options: {
                        fix: true,
                      }
                  })
                }
          
          1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel last edited by dobbel

            If you choose prettier with the creation of your Quasar project it will auto fix your code too.( without the need to add the option)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post