【问题标题】:How to configure ESLint for tabs instead of spaces?如何为制表符而不是空格配置 ESLint?
【发布时间】:2019-05-31 14:23:19
【问题描述】:

我的根目录中有一个 .eslintrc 文件:

{
    "extends": "airbnb",
    "env": {
        "browser": true,
        "node": true,
        "jquery": true
},

    "rules": {
    "no-unused-vars": [0,{"argsIgnorePartern": "res|next|~err"}],
    "arrow-body-style": ["error", "as-needed"],
    "no-param-reassign": 0,
    "eqeqeq": [
        "error",
        "smart"
    ],
    "no-shadow": "off",
    "allowIndentationTabs": true,
    "import/newline-after-import": ["error", { "count": 0 }],
    "no-console": 0,
    "import": 0,
    "func-names": 0,
    "space-before-function-paren": 0,
    "comma-dangle": 0,
    "max-len": 0,
    "no-underscore-dangle": 0,
    "react/prefer-es6-class": 0,
    "radix": 0,
    "indent": [1, "tab"],
    "react/jsx-indent": ["error", 4],
    "arrow-parens": [2, "as-needed"],
    "function-paren-newline": ["error", "consistent"],
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "react/prefer-stateless-function": "off",
    "no-use-before-define": ["error",{ "functions": false, "variables": false }],
    "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]}
}

我收到以下错误:

意外的制表符 eslint(no-tabs)

所以我添加了这条规则:"allowIndentationTabs": true

但是,我仍然收到该错误。我还确保我的 VSCode 配置为制表符而不是空格。这有点让我发疯。我想,该规则会覆盖任何 airbnbs 规则,但我想不会。什么鬼?!

【问题讨论】:

标签: javascript tabs eslint spaces


【解决方案1】:

好像airbnb还有一条规则,所以我直接改写了:

"no-tabs": 0

【讨论】:

    猜你喜欢
    • 2012-01-02
    • 2010-12-29
    • 2018-02-23
    • 2021-10-24
    • 2018-08-28
    • 2014-03-14
    • 1970-01-01
    • 2011-09-12
    • 2011-07-06
    相关资源
    最近更新 更多