typescript-formatter
typescript-formatter copied to clipboard
Weird formatting indentation
actual:
const schema = new Schema({
}, {
id: false,
});
expected:
const schema = new Schema({
}, {
id: false,
});
tslint:
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"align": false,
"no-empty-interface": false,
"no-unused-expression": false,
"object-literal-sort-keys": false,
"no-namespace": false,
"no-irregular-whitespace": true,
"curly": true,
"no-bitwise": true,
"label-position": true,
"no-construct": true,
"no-eval": true,
"no-duplicate-super": true,
"no-duplicate-variable": true,
"no-invalid-template-strings": true,
"no-sparse-arrays": true,
"no-string-literal": true,
"triple-equals": true,
"eofline": true,
"indent": [true, "spaces", 4],
"no-consecutive-blank-lines": true,
"space-before-function-paren": [true, {"anonymous": "always", "named": "never", "asyncArrow": "always"}],
"max-file-line-count": [true, 150]
},
"rulesDirectory": []
}
sorry for late response. typescript-formatter uses TypeScript's Compiler API. https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API Could you report this issue to TypeScript repo?
I'm getting this annoying issue too. TypeScript Version: 2.6 TypeScript Formatter Version: 7.0.1 (from yarn.lock)
@vvakame Can you provide additional information on this bug? If it's a regression on the TypeScript compiler, on what previous version did this work fine on?
I just can't imagine how the issue is on their end?
@vvakame Disregard. Found an issue tracking this on TS. https://github.com/Microsoft/TypeScript/issues/20766
sorry, I do not have useful information. tsfmt is just a bridge between API and CLI.
All good! I didn't realize the formatter was so coupled to the compiler!
I'd say it would be more consistent if parameters were always put on newlines, so expected should be like this:
const schema = new Schema(
{
},
{
id: false,
},
);