'ESLint: Parsing Error: Unexpected token ':'

I'm trying to use ESLint with Flow, but when I test it out in my file ESLint doesn't detect that I'm using static types.

var str: number = 'hello world';

What can I install or how can I make my linter ignore this? The colon, specifically.



Solution 1:[1]

Use babel-eslint as parser in .eslintrc:

"parser": "babel-eslint",

Solution 2:[2]

You don't need babel, you can just use typescript-eslint.

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 Wietse Venema
Solution 2 serg06