question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Eslint-plugin-vue goes crazy on normal js but not working in vue files

See original GitHub issue

Tell us about your environment

  • ESLint Version: eslint@4.1.1
  • eslint-plugin-vue Version: eslint-plugin-vue@3.5.1
  • Node Version: v6.10.2

Please show your full configuration:

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

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    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']
  }
}

What did you do? Please include the actual source code causing the issue. A bunch of eslint-plugin-vue rules gets triggered in a normal js file, which is actually a mixin file I used for my global object for state management.

import store from './store';

export default {
  data () {
    return {
      //...
    };
  },
  computed: {
    //...
  },
  methods: {
    //...
  }
};

What did you expect to happen? eslint-plugin-vue is only triggered in *.vue files, or just wonder if there is a way to disable just the eslint-plugin-vue rules on normal .js

What actually happened? Please include the actual, raw output from ESLint. Eslint-plugin-vue goes crazy in Atom on normal js image

but not actually working in vue files (note I took the key out of the v-for, and I actually have v-for and v-if in the same component.) image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pingshunhuangalexcommented, Jul 16, 2017

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.

0reactions
mysticateacommented, Jul 16, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint is ignoring .vue files · Issue #327 - GitHub
ESLint is throwing the classic ELIFECYCLE error with the current config. It was linting .js files in the root folder, but I can't...
Read more >
1 - Stack Overflow
This plugin is not designed to work well for split files. ... Answer from Github: https://github.com/vuejs/eslint-plugin-vue/issues/1875.
Read more >
User Guide | eslint-plugin-vue
Official ESLint plugin for Vue.js.
Read more >
How to set up ES Lint for Airbnb, Vue JS, and VS Code
Today, I will show you how to get ES Lint working with Vue JS. If you are using Laravel ... Take careful note...
Read more >
How To Use Vue - Quasar Framework
Quick tutorial about Vue principles and how to use it with Quasar.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found