blakeembrey / tslint-config-standard

A TSLint config for JavaScript Standard Style
Other
358 stars 43 forks source link

Braces may be omitted for single line if statements #2

Closed Alexendoo closed 7 years ago

Alexendoo commented 8 years ago

e.g. if (...) return

Currently it throws a warning

blakeembrey commented 8 years ago

Do you know what rule that is? Most likely it hasn't been implemented for TSLint.

Alexendoo commented 8 years ago

Seems to be from the tslint curly rule

Doesn't look like there's a way to do it like eslint as it stands unfortunately, there's a request for it though https://github.com/palantir/tslint/issues/822

I just disable curly for now in my tslint.json

blakeembrey commented 8 years ago

Thanks, I see it now. Yeah, TSLint only has the one option (https://palantir.github.io/tslint/rules/curly/) while ESLint has multiple (http://eslint.org/docs/rules/curly). Rule in StandardJS (https://github.com/feross/eslint-config-standard/blob/c879dfb71e03739a45e980687f9a28c94b4a95d2/eslintrc.json#L37).

cdaringe commented 7 years ago

this bit me too. i feel like the more tolerant ruling here is more accommodating? that is, can we disable https://github.com/blakeembrey/tslint-config-standard/blob/master/tslint.js#L46?

blakeembrey commented 7 years ago

I won't be disabling it as it's more likely to catch issues with missing braces, and that's the goal of linting.

cdaringe commented 7 years ago

sure, but the goal of this project is to apply standardjs linting, however this rule declares my valid standardjs formatted code as invalid.

blakeembrey commented 7 years ago

Just disable it in your own tslint.json then. I won't disable it here, which I just said. It is applying StandardJS linting as close as it can get - it just can't apply this rule as it doesn't exist, and deleting it would mean projects deviate even further away from StandardJS. It's likely there's other rules that cause deviation (e.g. indent) that I would enable if it got me 90% parity with ESLint.

blakeembrey commented 7 years ago

This is supported with https://github.com/blakeembrey/tslint-config-standard/releases/tag/v5.0.0.