Skip to content
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

add failing test for check-typecast #85

Merged
merged 1 commit into from
Mar 2, 2017
Merged

Conversation

despairblue
Copy link
Contributor

The formatter add no space after a typecast at the moment, it actually removes it, which is at odds with the tslint:recommended rules.

With some help I can probably fix this my self, I know that something like this needs to be added here

            } else if (value === "check-typecast") {
              formatSettings.insertSpaceAfterTypeCast = true;
            }

But where does the actual formatting happen?

@despairblue
Copy link
Contributor Author

Ok, so this is using the formatter in typescript and there are only a limited amount of options that can be set. So I guess there is no way to do this right now. Am I correct?

@vvakame
Copy link
Owner

vvakame commented Mar 2, 2017

Yes. that's right.
but newest tsc has a insertSpaceAfterTypeAssertion field I found. I'll try it.
https://github.com/Microsoft/TypeScript/blob/e9fd831a9d5904006390c87ed30152335b9edd00/src/services/types.ts#L452

vvakame added a commit that referenced this pull request Mar 2, 2017
refs #85
option name & default values.
baseIndentSize: 0
insertSpaceAfterConstructor: false
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false
insertSpaceAfterTypeAssertion: false
insertSpaceBeforeFunctionParenthesis: false
@vvakame vvakame mentioned this pull request Mar 2, 2017
@vvakame vvakame merged commit faa832e into vvakame:master Mar 2, 2017
@vvakame
Copy link
Owner

vvakame commented Mar 2, 2017

just released v5.1.0. try it out!

@despairblue
Copy link
Contributor Author

@vvakame thanks, you awesome!

It does work if I add the insertSpaceAfterTypeAssertion setting to tsfmt.json or "whitespace": [true, "check-typecast" ] to the my tslint.json, but if I don't it does not pick it up from the recomended rules from the tslint file.

Using this tslint.json the test still fails:

{
  "extends": "tslint:recommended"
}

@vvakame
Copy link
Owner

vvakame commented Mar 3, 2017

oh... extends of tslint does not supported yet...

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

Successfully merging this pull request may close these issues.

2 participants