Tslint: Unexpected token ?

Created on 6 Nov 2015  ·  3Comments  ·  Source: palantir/tslint

Hi there,

I'm running on Windows 10 with tslint version 2.5.1 and when trying to lint a file I get the following error

undefined:1
?{
^

SyntaxError: Unexpected token ?
    at Object.parse (native)
    at Object.findConfiguration (C:\...\node_modules\tslint\bin\tslint-cli.js:50424:29)
    at processFile (C:\...\recorder\node_modules\tslint\bin\tslint-cli.js:50885:48)
    at Lint (C:\...\node_modules\tslint\bin\tslint-cli.js:50906:9)
    at Object.<anonymous> (C:\...\node_modules\tslint\bin\tslint-cli.js:50908:3)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

any idea what could cause this?

Question

Most helpful comment

@adidahiya I've saved the example file from this repository using UTF-8 encoding which resulted in tslint failing with the mentioned error. Saving it with a different encoding, like ISO-8859-1, fixed it.

Thanks for the hint

All 3 comments

might be a JSON syntax error when parsing your tslint.json

Good catch, will check that on monday.

@adidahiya I've saved the example file from this repository using UTF-8 encoding which resulted in tslint failing with the mentioned error. Saving it with a different encoding, like ISO-8859-1, fixed it.

Thanks for the hint

Was this page helpful?
0 / 5 - 0 ratings