Kayote
Kayote

Reputation: 15627

Eslint - How to Indent Import Export Statements

I just upgraded my Eslint after a long time and all of a sudden, I have a lot of errors. Of note & issues raised below is indentation. Maybe its worth mentioning that I use tabs instead of spaces for my indentation

Problem: My import values are indented as per the eslint indentation terminology "first". "first" basically means, all additional declarations are indented to align with the first property. See this:

enter image description here

Solutions I tried: Here is what my indentation rules look like within '.eslintrc' file:

"indent" : [ 1, "tab", {
    "FunctionExpression": {
        "body": 1,
        "parameters": "first" },
    "VariableDeclarator": {
        "var" : 2,
        "let" : 2,
        "const" : 3
    },
    "MemberExpression": 0,
    "FunctionDeclaration": {
        "parameters": "first" },
    "ObjectExpression" : "first"
}],

Even though I am using tab, not space for indetation, I still had to use the VariableDeclarator rule above to align all the vars/lets/constants etc. However, import & export are still flagged up and I cannot find any rule which resolve these indentations. So, how do I indent import/export statements?

Upvotes: 0

Views: 1346

Answers (1)

Gyandeep
Gyandeep

Reputation: 13548

There has been some work for this enhancement to indent rule. Please follow the conversation here: https://github.com/eslint/eslint/pull/8955

Upvotes: 1

Related Questions