简体   繁体   English

Eslint Vue 插件

[英]Eslint Vue Plugin

My project is also using the eslint vue plugin.我的项目也在使用 eslint vue 插件。 My rules are as follows.我的规则如下。

"rules": {
        "vue/html-closing-bracket-newline": ["error", {
            "singleline": "never",
            "multiline": "always"
        }],
        "vue/html-closing-bracket-spacing": "error",
        "vue/max-attributes-per-line": ["error", {
            "singleline": 5,
            "multiline": {
                "max": 1,
                "allowFirstLine": false
            }
        }],
        "quotes": ["error", "single"],
        "eqeqeq": ["error", "always"],
        "no-else-return": ["error", { allowElseIf: false }],
        "no-eval": "error",
        "no-script-url": "error",
        "no-useless-return": "error",
        "no-multiple-empty-lines": ["error", { max: 1 }],
        "arrow-body-style": ["error", "as-needed"],
        "no-var": "error",
        "object-shorthand": "error",
        "prefer-arrow-callback": "error",
        "object-curly-spacing": ["error", "always"],
        "vue/no-use-v-if-with-v-for": "warn",
        "vue/padding-line-between-blocks": ["error", "always"],
        "vue/require-direct-export": "error",
        "vue/require-name-property": "warn",
        "vue/v-on-function-call": ["error", "never"],
    }

When I run lint-fix according to these rules当我根据这些规则运行 lint-fix

在此处输入图像描述

this gives errors.这会产生错误。 But I have corrected both of these problems within my components.但是我已经在我的组件中纠正了这两个问题。 What is the reason it still gives these errors?它仍然给出这些错误的原因是什么?

Those are not eslint issues, those are "no rule found" issue, which is more likely something related to a package not being installed or used.这些不是 eslint 问题,而是“未找到规则”问题,这更有可能与未安装或使用 package 相关。

In your eslint config, you should have something on these lines:在你的 eslint 配置中,你应该在这些行上有一些东西:

module.exports = {
  extends: [
    'plugin:vue/recommended',
    '@vue/standard'
  ],
  rules: {
    // examples of vue rule
    'vue/keyword-spacing': 'warn',
  }
}

Make sure you have确保你有

"@vue/eslint-config-standard": "^5.1.0",
"eslint-plugin-vue": "^6.2.2"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM