palantir / tslint-react

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

JSX in switch/case statement #170

Closed ghost closed 4 years ago

ghost commented 6 years ago

I have found that

switch(someCondition) {
  case A: return <A />;
  case B: return <B />;
  default: <div />;
}

warns nothing for standalone JSX statement. is there a rule for this?

adidahiya commented 5 years ago

What warning are you expecting?

ghost commented 5 years ago

At that time, I thought that It should return value in default case. But It looks okay because It could return value somewhere else or return undefined.

Maybe floating JSX (which React.createElement('...') is not assigned or returned) should be warned. Can I propose new rule?

adidahiya commented 4 years ago

Closing due to deprecation, see #210