Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 861 Bytes

File metadata and controls

36 lines (29 loc) · 861 Bytes

Disallow Undeclared Variables. (react-directives/no-undef)

This rule is almost the same as no-undef, and optimize some cases for babel-plugin-react-directives

Rule Details

Undefined variables are ignored under directive x-for

Examples of correct code for this rule:

function Foo() {
  const list = [1, 2, 3];
  return (
    <ul>
      <li x-for={(item, index) in list} key={item}>
        <span>{item}</span>
      </li>
    </ul>
  )
}

Examples of incorrect code for this rule:

function Foo() {
  const list = [1, 2, 3];
  return (
    <ul>
      <li x-for={(item, index) in list}></li>
      {item}
    </ul>
  )
}