kitajs / ts-html-plugin

🏛️ The Typescript LSP plugin to catch XSS vulnerabilities.
https://github.com/kitajs/html
MIT License
10 stars 2 forks source link

Add support for ternary and or expressions. #7

Closed arthurfiorette closed 1 year ago

arthurfiorette commented 1 year ago

Its common to write components like the following:

<div>{check ? thingA : thingB}</div>

or inside a OR condition

<div>
  {thingA || thingB}
  {thingA ?? thingB}
</div>

Expressions/JSX inside parenthesis should also be "unwrapped"

<div>
  Valid: {(<div></div>)} 
  Valid: {<div></div>} 
  Error: {('<div></div>')}
  Error: {'<div></div>'}
</div>

This plugin should not combine their results and emit errors, instead, it should evaluate both thingA and thingB separately. Emitting errors, if any, for each operation. Multiple ternaries and || should also be supported.