【问题标题】:How to config eslint prettier disable style in Vue template files?如何在 Vue 模板文件中配置 eslint prettier 禁用样式?
【发布时间】:2020-05-14 13:58:58
【问题描述】:

我想忽略 .vue 文件中的所有 'style' 标签。 我在 eslint 中使用过 @vue/prettier。

如何在 Vue 模板文件中只禁用“样式”标签?

.eslintrc.js

module.exports = {
  root: true,
  env: {
    browser: true,
    jquery: true,
    node: true
  },
  plugins: [
    "vue"
  ],
  extends: ["plugin:vue/essential", "@vue/prettier"],
  rules: {
    "prettier/prettier": "error",
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
    "new-cap": [
      2,
      {
        newIsCap: false,
        capIsNew: false
      }
    ],
    "no-useless-escape": 0
  },
  parserOptions: {
    parser: "babel-eslint",
    sourceType: "module"
  },
};

【问题讨论】:

标签: vue.js eslint prettier


【解决方案1】:

prettier 和 vue 不能混用。弄清楚这一点是一项艰巨的任务。我使用 VSCode 并且它破坏了我的工作流程。我对 ctlf 功能有一个问题,它在确定哪些行需要它时不加选择。

尝试使用此处 a link 的 Jon Gallants 设置!

它完全适合我!

【讨论】:

  • “你不应该这样做”不是问题的答案。我正在使用更漂亮的 eslint,以便我可以在我们团队中使用的所有不同 IDE 中进行一致的 linting 和格式化。
猜你喜欢
  • 2020-10-05
  • 2019-06-01
  • 2020-02-28
  • 2019-12-12
  • 2018-02-22
  • 2021-10-22
  • 2019-06-21
  • 2021-10-07
  • 2019-09-05
相关资源
最近更新 更多