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

Brace style #280

Closed
stief510 opened this issue Feb 27, 2019 · 5 comments
Closed

Brace style #280

stief510 opened this issue Feb 27, 2019 · 5 comments
Labels

Comments

@stief510
Copy link

Hi,

I am trying to use brace style’s stroustrup rule within my tslint.json’s rules object. The error shows in the linter but then Prettier overrides it and defaults back to 1tbs style

@ikatyang
Copy link
Member

Hi, this package is used for disabling rules that may conflict with Prettier via extends field, so we are not able to override rules in rules field since it takes precedence over extends.

Since Prettier always formats them with 1tbs style, I'd suggest you to remove this rule in rules field.

@stief510
Copy link
Author

My understanding is that this package allows you to turn off some of prettier's rules that conflict with tslint's rules. brace-style is one of the rules listed in tslint-eslint-rules that I am trying to extend

@ikatyang
Copy link
Member

This package is actually turning off some TSLint rules that may conflict with Prettier.

Do you want to use TSLint and Prettier without conflicts? tslint-config-prettier disables all conflicting rules that may cause such problems. Prettier takes care of the formatting whereas tslint takes care of all the other things.

@stief510
Copy link
Author

Ok but then tslint-config-prettier is not turning off the brace-style rule because when I make it different, tslint gives me an error but Prettier keeps the formatting that way

For example, if I have the following:

if () {
...
} else {
...
}

tslint complains. If I move else to the next line, Prettier will then move it back

@ikatyang
Copy link
Member

Since this package is desinged to be used in the extends field, there are only two possible way to solve your issue:

  • remove brace-style from your rules field (in tslint.json). We are not able to override rules in rules field since it takes precedence over extends field.

     // tslint.json
     {
       "rules": {
    -    "brace-style": [true, "stroustrup"]
       }
     }
  • create a new tslint.json that extends the original tslint.json and tslint-config-prettier:

    // tslint.json
    {
      "extends": ["./path/to/original/tslint.json", "tslint-config-prettier"]
    }

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

No branches or pull requests

2 participants