43

I'm using ESLint with the Airbnb plugin (eslint-config-airbnb) and Babel parser. I've just added the extra rule of using Tab characters for indentation instead of spaces.

Here is my .eslintrc:

{
    "parser": "babel-eslint",
    "extends": "airbnb",
    "plugins": [
        "react",
        "jsx-a11y",
        "import"
    ],
    "rules":{
        "indent": [2, "tab"]
    }
}

Now I get this error at every indentation:

Error: Unexpected tab character

Just in case it helps, I'm using Atom IDE with the autolinter plugins linter and linter-eslint.

TylerH
  • 20,799
  • 66
  • 75
  • 101
R01010010
  • 5,670
  • 11
  • 47
  • 77
  • Is there a stack trace that accompanies that error? It doesn't look to be a normal linter error, though it could be coming from the parser. – btmills Nov 30 '16 at 21:49
  • The error was being showed by atom, yes, it said something about no-tabs rule ;) – R01010010 Dec 04 '16 at 21:09

2 Answers2

111

I answer myself, it was because Airbnb has set the rule no-tabs to 2 or error, I just disabled it.

{
    "parser": "babel-eslint",
    "extends": "airbnb",
    "plugins": [
        "react",
        "jsx-a11y",
        "import"
    ],
    "rules":{
        "indent": [2, "tab"],
        "no-tabs": 0
    }
}
R01010010
  • 5,670
  • 11
  • 47
  • 77
1

"no-tabs" rule looks for tabs anywhere inside a file: code, comments or anything else. It may be a another answer.

...
"rules": {
    ...
    "no-tabs": ["error", { "allowIndentationTabs": true }]
    ...
}
...
F.E
  • 688
  • 6
  • 10