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.

.vue files are not linted

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.9.0
  • eslint-plugin-vue Version: 3.13.17
  • Node Version: 6.11.3

Please show your full configuration:

module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends": ["eslint:recommended", "plugin:vue/recommended"],
    // required to lint *.vue files
    plugins: [
        "vue"
    ],
    "parserOptions": {
        "parser": "babel-eslint",
        "ecmaVersion": 2017,
        /*
        "ecmaFeatures": {
            "classes": true,
            "experimentalObjectRestSpread": true,
            "jsx": true
        }, */
        "sourceType": "module"
    },
    "rules": {
        "indent": ["error", 4, { "SwitchCase": 1 } ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "warn",
            "single"
        ],
        "semi": [
            "warn",
            "always"
        ],
        "no-console": "warn",
        "no-unused-vars": "warn",
        'vue/valid-v-if': 'error'
    }
};

What did you do? Please include the actual source code causing the issue.

<template>
     <div v-bind:id='id' class='alert alert-primary' style='margin: 5px;'>
         <p><b>{{ title }}:</b></p>
         <p>{{ thisRecord.name }} only ({{ current.length }}):</p>
         <p>
             <ul class='bio-tags btsmall'>
                 <li v-bind:class=\"tagtype\" v-for='item in current'>
                     <a :href=\"searchLink(link, item)\" target='_blank'>
                         <span class='bio-icon-tag' style='padding-right: 5px'></span>
                         {{ item }}
                     </a>
                 </li>
             </ul>
             <div class='clearfix'></div>
         </p>
         <p><a v-bind:href=\"href\" target='_blank'>{{ otherRecord['name'] }}</a>
         only ({{ other.length }}):</p>
         <p>
             <ul class='bio-tags btsmall'>
                 <li v-bind:class=\"tagtype\" v-for='item in other'>
                     <a v-bind:href=\"searchLink(link, item)\" target='_blank'>
                         <span class='bio-icon-tag' style='padding-right: 5px'></span>
                         {{ item }}
                     </a>
                 </li>
             </ul>
             <div class='clearfix'></div>
         </p>
         <p>Shared ({{ both.length }})</span>:</p>
         <p>
             <ul class='bio-tags btsmall'>
                 <li v-bind:class=\"tagtype\" v-for='item in both'>
                     <a :href=\"searchLink(link, item)\" target='_blank'>
                         <span class='bio-icon-tag' style='padding-right: 5px'></span>
                         {{ item }}
                     </a>
                 </li>
             </ul>
             <div class='clearfix'></div>
         </p>
     </div>
     <div class='clearfix'></div>`
</template>

<script>
import Vue from 'vue';
import axios from 'axios';
import * as d3 from 'd3';
import * as venn from 'venn.js';

export default {
    delimiters: ['[[', ']]'],
    props: ['current', 'other', 'both', 'title', 'tagtype', 'count', 'id', 'href', 'link'],
    el: '#comparison-area',
    method: {
        searchLink: function (url, item) {
            const self = this;
            if (url.includes('taxonomies') || url.includes('domains')) {
                return '/search?q=&selected_facets=' + url + ':' + item
            } else {
                return '/' + self.recordIds[item];
            }
        }
    }

};
</script>

What did you expect to happen? .vue file to be linted

What actually happened? Please include the actual, raw output from ESLint. .vue files are ignored by the linter, only .js files are linted. What am I doing wrong? Do I need to modify the configuration? Is the plugins:[“vue”] instruction needed? Nothing changes with or without it.

Thanks a lot for any suggestion

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
mysticateacommented, Oct 24, 2017

How do you do to lint the file?

If you are using CLI, eslint command checks only .js files by default. You have to specify the additional extension:

$ eslint "src/**/*.{js,vue}"
# or
$ eslint src --ext .vue

If you are using editor integrations, most editors check only .js files by default. You have to specify the additional extension. For example, VSCode needs to configure like:

// .vscode/settings.json
{
    "eslint.validate": [
        "javascript",
        {"autoFix": true, "language": "vue"}
    ]
}
4reactions
mitarcommented, Jan 11, 2018

This should really be included somewhere in the README.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint is ignoring .vue files · Issue #327 - GitHub
With this config, ESLint is linting only .js files on every save and that's my wanted behavior but also with .vue files in...
Read more >
ESLint: linting is not enabled in .vue files : WEB-27868
I see. Currently, we run eslint in vue files only if user specified vue plugin in eslint config file (in json format), or...
Read more >
1 - Stack Overflow
Linting not working eslint-plugin-vue for .vue with <script src="./TheAloha.js"> · javascript · vue.js · webpack · eslint · eslint-plugin-vue.
Read more >
Linting - Vue Loader
The official eslint-plugin-vue supports linting both the template and script parts of Vue single file components. Make sure to use the plugin's included ......
Read more >
How To Configure ESLint and Prettier for Vue.js - DigitalOcean
Learn how to add default Prettier linting to your Vue.js projects. ... due to a lack of support for Single-File Components ( .vue...
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