palantir / tslint-react

:orange_book: Lint rules related to React & JSX for TSLint.
Apache License 2.0
749 stars 76 forks source link

New rule suggestion: jsx-singleline-no-parens #206

Closed dagerikhl closed 5 years ago

dagerikhl commented 5 years ago

A nice rule to have would be to prevent parantheses around singleline JSX. The inverse rule of jsx-wrap-multiline if you will.

// bad
const component = () => (<div>I should complain, but I don't.</div>);

// good
const component = () => <div>I'm not complaining.</div>;

Hope this would be possible to implement, would be a nifty addition!

adidahiya commented 5 years ago

Might be useful, but we're not really interested in new formatting rules in this repo right now, as per https://github.com/palantir/tslint/issues/4534. Could happily live in a custom ruleset outside this repo.