если не соблюдаешь правила для vue / * - PullRequest
0 голосов
/ 13 марта 2020

, поэтому у меня есть это в моем .eslintrc.js

module.exports = {
    root: true,

    env: {
        browser: true,
        node: true,
    },

    parser: 'vue-eslint-parser',

    parserOptions: {
        ecmaVersion: 2020,
        parser: 'babel-eslint',
    },

    extends: [
        '@nuxtjs',
        '@vue/airbnb',
        'plugin:nuxt/recommended',
        'plugin:vue/recommended',
    ],

    // add your custom rules here
    rules: {
        'vue/script-indent': ['error', 4, {
            baseIndent: 1,
            switchCase: 0,
            ignores: [],
        }],
        'vue/html-indent': ['error', 4, {
            attribute: 1,
            baseIndent: 1,
            closeBracket: 0,
            alignAttributesVertically: true,
            ignores: [],
        }],

        ....

    },

    overrides: [
        {
            files: [
                './**/*.vue',
            ],
            env: {
                jest: true,
            },
            rules: {
                indent: 'off',
                'no-unused-expressions': 'off',
            },
        },
    ],
}

в моем package.json, у меня есть это, чтобы помочь

    "scripts": {
        "dev": "nuxt",
        "build": "nuxt build",
        "start": "nuxt start",
        "generate": "nuxt generate",
        "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix ."
    },

, поэтому я просто запускаю npm run lint, чтобы исправить надоедливое форматирование верно? но это не очень хорошая работа. Я получаю эти ошибки

2:1 error Expected indentation of 2 spaces but found 4 spaces vue/html-indent

поэтому, глядя на мой default.vue в строке 2 я вижу

<template>
    <v-app dark> <! <-- this has 4 spaces, which is what I have im my .eslintrc.js for vue/html-indent -->
        <v-navigation-drawer
            v-model="drawer"
            :mini-variant="miniVariant"
            :clipped="clipped"
            fixed
            app
        >

что мне не хватает ???

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...