简体   繁体   English

如何在 Vue 模板文件中配置 eslint prettier 禁用样式?

[英]How to config eslint prettier disable style in Vue template files?

I want to ignore eslint all 'style' tags in .vue files.我想忽略 .vue 文件中的所有“样式”标签。 I have used @vue/prettier with eslint.我在 eslint 中使用了 @vue/prettier。

How to disable only 'style' tags in Vue template files?如何仅禁用 Vue 模板文件中的“样式”标签?

.eslintrc.js .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"
  },
};

prettier and vue just don't mix.更漂亮和 vue 只是不要混合。 It has been a huge undertaking to figure this out.解决这个问题是一项艰巨的任务。 I use VSCode and man does it ruin my workflow.我使用 VSCode,它会破坏我的工作流程。 I had an issue with the ctlf feature that was indiscriminate in the way it determined which lines needed it.我对 ctlf 功能有一个问题,该功能在确定哪些行需要它时不加区分。

Try using Jon Gallants settings from here a link !尝试使用来自此处链接的Jon Gallants 设置!

It totally worked for me!它完全对我有用!

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

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