首页 > 解决方案 > Javascript 文件由 eslintrc.json 自动更改

问题描述

在 Visual Studio 2015 中,我们有一个包含 c# 和 javascript 文件的解决方案。对于 javascript 文件,我们使用 .eslintrc.json 文件进行代码约定。但是,每次我构建解决方案时,这些文件都会自动更改为此 .eslintrc.json 中的设置(例如将双引号更改为单引号)。有没有办法防止它自动重构everyting,而是给出警告或其他东西?

{
  "extends": [
    "airbnb-base"
  ],
  "rules": {
    "semi": [ "warn", "always" ],
    "max-len": [ "warn", 200 ],
    "arrow-body-style": [ "error", "as-needed" ],
    "indent": [
      "warn",
      2,
      { "SwitchCase": 1 }
    ],
    "no-param-reassign": [
      "error",
      { "props": true }
    ],
    "space-before-function-paren": [
      "error",
      {
        "anonymous": "never",
        "named": "never",
        "asyncArrow": "ignore"
      }
    ],
    "eqeqeq": "warn",
    "no-restricted-syntax": "warn",
    "no-underscore-dangle": 0,
    "class-methods-use-this": 0,
    "no-plusplus": 0,
    "linebreak-style": 0,
    "no-confusing-arrow": 0,
    "no-mixed-operators": 0,
    "func-names": 0,
    "no-console": 0,
    "no-use-before-define": 0,
    "comma-dangle": 0,
    "guard-for-in": 0,
    "no-extend-native": 0,
    "no-empty": 0
  },
  "globals": {
    "Utils": false,
    "location": false,
    "fetch": false,
    "webApi": false,
    "$": false,
    "window": false,
    "document": false,
    "console": false,
    "GeoSettings": false,
    "localStorage": false,
    "sessionStorage": false,
    "BPlanInteractions": false,
    "navigator": false,
    "saveAs": false,
    "HTMLCanvasElement": false,
    "atob": false,
    "Blob": false
  }
}

我想也许它是在“airbnb-base”中定义的,它扩展了,但我也找不到任何东西。

谢谢!

标签: javascriptcoding-stylerefactoringeslintrceslint-config-airbnb

解决方案


推荐阅读