typescript-formatter
typescript-formatter copied to clipboard
ignores rules from tslint.json
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.
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 But update file twice makes no sense. Can't use pipe the output from tslint --fix into tsfmt somehow?