eslint-plugin

@masknet/jsx/no-logical

Limit the complexity of JSX logic expression

Rule Details

Options

/**
 * @minItems Infinity
 */
export type Options = [
  | number
  | {
      attribute?: number
      element?: number
    },
]

:x: Incorrect

<foo bar={1 || 2 || 3} />
<foo>{1 || 2 || 3}</foo>
<foo>{1 ? 2 : 3}</foo>

:white_check_mark: Correct

const value = 1 || 2 || 3
const bar = <foo bar={value} />
const baz = <foo>{value}</foo>

Attributes