Thursday, 21 February 2019

eslint - vue/script-indent to ignore object fields

So I have the following rule setup:

"vue/script-indent": [
    "error",
    4,
    {
        "baseIndent": 1,
        "switchCase": 1,
        "ignores":
        [
            "[init.type=\"ObjectExpression\"]",
            "[init.type=\"ArrayExpression\"]"
        ]
    }
]

However, I would like the indentation to be ignored for the following case (where an object key's value is another object):

this:

{
    example:
        {
            test: 
                "test"
        }
}

should be this:

{
    example:
    {
        test: 
            "test"
    }
}

So it should be an Object that's inside an Object that should be ignored. I would also like to have Arrays inside Objects to be ignored as well (hence why my ignores have Object and Array)



from eslint - vue/script-indent to ignore object fields

No comments:

Post a Comment