Skip to content

Weird formatting indentation #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
danielpza opened this issue Dec 6, 2017 · 6 comments
Open

Weird formatting indentation #118

danielpza opened this issue Dec 6, 2017 · 6 comments

Comments

@danielpza
Copy link

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": []
}
@vvakame
Copy link
Owner

vvakame commented Dec 17, 2017

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?

@silbinarywolf
Copy link

silbinarywolf commented Jan 11, 2018

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?

@silbinarywolf
Copy link

@vvakame Disregard. Found an issue tracking this on TS.
microsoft/TypeScript#20766

@vvakame
Copy link
Owner

vvakame commented Jan 12, 2018

sorry, I do not have useful information.
tsfmt is just a bridge between API and CLI.

@silbinarywolf
Copy link

All good! I didn't realize the formatter was so coupled to the compiler!

@samal-rasmussen
Copy link

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,
  },
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants