Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure ESLint for tabs instead of spaces?

I have a .eslintrc file in my root directory:

{
    "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 }]}
}

I'm getting the following error:

Unexpected tab character eslint(no-tabs)

So I added that rule: "allowIndentationTabs": true

However, I'm still getting that error. I also made sure that my VSCode is configured for tabs instead of spaces. This is kinda driving me crazy. I figured, that rule would overwrite whatever airbnbs rule was but I guess not. What the hell?!

like image 775
user7496931 Avatar asked Jan 05 '19 03:01

user7496931


1 Answers

Looks like airbnb had another rule, so I just overwrote it:

"no-tabs": 0

like image 94
user7496931 Avatar answered Oct 18 '22 20:10

user7496931