typescript-formatter icon indicating copy to clipboard operation
typescript-formatter copied to clipboard

ignores rules from tslint.json

Open vladgogo opened this issue 8 years ago • 2 comments
trafficstars

I have this tslint.json:

{
  "rules": {
    "semicolon": [true, "always"],
    "no-consecutive-blank-lines": true
  }
}

And this code in example.ts:

if (true)
    var a = 1


var a = 1

I run: node_modules/.bin/tsfmt ./js/*.ts -r --useTslint ./tslint.json

And nothing changes. But I expect semicolons to be added and extra empty lines to be removed.

It follows the rules from tsfmt.json though, related to indentation and whitespaces. I also found that running tsfmt ./js/*.ts -r --useTslint ./tslint.json (without node_modules) produces very weird formatting that does not follow any rules.

vladgogo avatar Mar 30 '17 22:03 vladgogo

I expect semicolons to be added

tsfmt uses compiler api of tsc. this behavior is not supported by tsc. I recommended to use tslint --fix option. https://github.com/palantir/tslint#cli-1

patched welcome!

vvakame avatar Apr 04 '17 03:04 vvakame

@vvakame But update file twice makes no sense. Can't use pipe the output from tslint --fix into tsfmt somehow?

JasCodes avatar Dec 10 '18 22:12 JasCodes