sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

Wrong 'brace-style' (non-standard) #43

Closed mesqueeb closed 5 years ago

mesqueeb commented 6 years ago

I have a problem with the following:

if (!id) { return }

get's fixed to:

if (!id) {
  return
}

However, I don't think this rule is written anywhere in the standard ruleset. And I'd like prettier-standard to not touch these lines...

Any idea how to fix this?

sheerun commented 6 years ago

this is what prettier enforces. if you don't like prettier rules, you can just use standard --fix

sheerun commented 6 years ago

or make a PR to prettier that fixes this behavior

mesqueeb commented 6 years ago

@sheerun Oh I see! I thought that only the rules of Standard were applied, but the instant formatting functionality of Prettier.

Does Prettier have a ruleset itself which also gets applied, other from the max. 90 char line length?

Best regards.

mesqueeb commented 6 years ago

@sheerun After more research I found out that:

The brace-style of standard is 1tbs. Together with "allowSingleLine": true.

However, the brace-style prettier-standard uses is stroustrup. Together with "allowSingleLine": false.

See here ESlint for more details on these differences.

Can you please change the repository to 1tbs. Together with "allowSingleLine": true?

mesqueeb commented 6 years ago

Dear @sheerun I took a look further into this repository. It seems like you correctly import the standard-ruleset from here: https://github.com/sheerun/eslint-config-standard/blob/master/eslintrc.json

This in turn does have the correct brace-style.

So I think there is something else that's messing with the brace-style option inside your app, I'm not sure where yet.

mesqueeb commented 6 years ago

@sheerun Any ideas what could be changing the brace-style behaviour of "brace-style": ["error", "1tbs", { "allowSingleLine": true }],?

Because you correctly pull the settings from eslintrc, yet prettier-standard is using { "allowSingleLine": false }...

rafaelrinaldi commented 6 years ago

This tool seems to be ignoring the .eslintrc file. Overriding rules doesn't work.

sheerun commented 5 years ago

prettier-standard 9.0.0 now directly uses prettierx for formatting, so if you'd like to customize formatting you need to contribute there: https://github.com/brodybits/prettierx

then you'll be able to customize formatting in your repository by creating custom .prettierrc file