簡體   English   中英

如何為制表符而不是空格配置ESLint?

[英]How to configure ESLint for tabs instead of spaces?

我的根目錄中有一個.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 }]}
}

我收到以下錯誤:

意外的制表符附加(無制表符)

所以我添加了以下規則: "allowIndentationTabs": true

但是,我仍然遇到該錯誤。 我還確保將VSCode配置為使用制表符而不是空格。 這有點讓我發瘋。 我認為,該規則將覆蓋任何airbnbs規則,但我想不會。 我勒個去?!

看來airbnb還有另一條規則,所以我改寫了一下:

"no-tabs": 0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM