'typescript arguments are not aligned (align)tslint(1)

I have the code

setTimeout(() => {
    const elementsInput: any = document.querySelectorAll('.Modal__headerEmailInput')
    elementsInput[0].focus()
    elementsInput[0].select()
}, 500

and tslint shows unexpected error arguments are not aligned (align)tslint(1) What is a solution?



Solution 1:[1]

After some time I figured out the non obvious (for me) solution:

setTimeout(
  () => {
    const elementsInput: any = document.querySelectorAll('.Modal__headerEmailInput')
    elementsInput[0].focus()
    elementsInput[0].select()
  },
  500,
)

Solution 2:[2]

You can turn on Auto Fix On Save in your code editor and it will handle such styling errors.

VSCode example

Solution 3:[3]

another possible solution that disables this kind of error is to set the rule in the tslint file

"rules": { "align": true }

Solution 4:[4]

A solution that work for me is to remove the "parameters" option in "align" rule section of the tslint.json file :

{
"extends": "tslint:recommended",
  "rules": {
    "align": {
      "options": [
        "parameters",  <----------- remove this line
        "statements"
      ]
    },
    ...,

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman
Solution 2 flppv
Solution 3
Solution 4 oury.ba