【问题标题】:Eslint won't respect custom settings of .eslintrc.jsonEslint 不会尊重 .eslintrc.json 的自定义设置
【发布时间】:2018-07-06 08:26:40
【问题描述】:

我想在 eslint 中使用 Airbnb 设置时使用制表符缩进而不是空格。我在项目的根目录中使用 eslint --init 创建了 .eslintrc.json 文件

问题是 eslint 不会尊重此文件的自定义设置。

我仍然收到错误:

[eslint] Unexpected tab character. (no-tabs)

在 VS Code、Vim、Sublime 中的错误是一样的。

我在这里缺少什么?根据我阅读的内容,这个新的 .eslintrc.json 文件应该适用于我的自定义设置。

.eslintrc.json 文件:

   {
        "extends": "airbnb-base",
        "env": {
            "browser": true,
            "node": true
        },
        "rules": {
            "comma-dangle": "off",
            "indent": ["error", "tab"],
            "no-console": "off"
        }
    }

我首先在全局和本地安装了 eslint

【问题讨论】:

    标签: json node.js visual-studio-code eslint


    【解决方案1】:
    {
        "extends": "airbnb",
        "env": {
            "browser": true,
            "node": true
        },
        "rules": {
            "comma-dangle": "off",
            "indent": ["error", "tab"],
            "no-tabs": 0,
            "no-console": "off"
        }
    }
    

    需要无标签:0

    【讨论】:

      猜你喜欢
      • 2021-12-09
      • 2020-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多