Code Monkey home page Code Monkey logo

Comments (5)

pingshunhuangalex avatar pingshunhuangalex commented on May 17, 2024 1

I did all the setup to get babel-eslint work in vue file, and I did notice that moving parser: 'babel-eslint', to parserOptions also breaks my normal babel js linting in vue file.

That was a good question, I actually not sure if Atom fully support running eslint on vue files yet. I guess I haven't fully understood the setup here, and I'm just gonna roll back to my previous setup for now. Hopefully there will be an official vue-linting package for vue in the future.

Thanks for the help.

from eslint-plugin-vue.

mysticatea avatar mysticatea commented on May 17, 2024

Thank you for the report.

However, it seems an npm problem.
eslint-plugin-vue is using vue-eslint-parser, but in your environment, npm seems to install an old vue-eslint-parser. So the error message says "Use the latest vue-eslint-parser".

Please try to remove node_modules and package-lock.json then npm install. (and mind that re-start your editor.)

from eslint-plugin-vue.

mysticatea avatar mysticatea commented on May 17, 2024

Ah, no, sorry.

You have parser: "babel-eslint" in your configuration. It overwrites parser: "vue-eslint-parser" of plugin:vue/recommended. It makes that eslint-plugin-vue does not work.

Please move the parser: "babel-eslint" into parserOptions.

  // http://eslint.org/docs/user-guide/configuring

  module.exports = {
    root: true,
-   parser: 'babel-eslint',
    parserOptions: {
+     parser: 'babel-eslint',
      sourceType: 'module'
    },
    env: {
      browser: true,
    },
    // required to lint *.vue files
    plugins: [
      'html',
      'vue'
    ],
    extends: [
      'eslint:recommended',
      'plugin:vue/recommended'
    ],
    // add your custom rules here
    'rules': {
      // allow debugger during development
      'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
      'no-console': ['warn', { allow: ['warn', 'error'] }],
      'no-undef': 'off',
      'quotes': ['warn', 'single', {
        'avoidEscape': true,
        'allowTemplateLiterals': true
      }],
      'semi': ['warn', 'always']
    }
  }

from eslint-plugin-vue.

pingshunhuangalex avatar pingshunhuangalex commented on May 17, 2024

Thanks @mysticatea
The errors do go away now, but it still doesn't quite work in vue files as shown in the screenshot above, as if it's not recognising my vue files. Is there anything else you can see from my settings? Thanks.

from eslint-plugin-vue.

mysticatea avatar mysticatea commented on May 17, 2024

Is your editor configured that it runs eslint on .vue files?
I'm not familiar with Atom, but for example, VSCode does not run eslint on .vue files by default.

from eslint-plugin-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.