简中文档

jsx-curly-braces

NOTE: this rule is included the following rule sets:recommendedreactjsx
Enable full set in deno.json:
{
  "lint": {
    "rules": {
      "tags": ["recommended"] // ...or "react", "jsx"
    }
  }
}
Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
# or ...
deno lint --rules-tags=react
# or ...
deno lint --rules-tags=jsx
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the include or exclude array in deno.json:
{
  "lint": {
    "rules": {
      "include": ["jsx-curly-braces"],
      "exclude": ["jsx-curly-braces"]
    }
  }
}

确保在 JSX 表达式周围一致使用花括号。

无效:

const foo = <Foo foo=<div /> />;
const foo = <Foo str={"foo"} />;
const foo = <div>{"foo"}</div>;

有效:

const foo = <Foo foo={<div />} />;
const foo = <Foo str="foo" />;
const foo = <div>foo</div>;

你找到了你需要的东西吗?

编辑此页面
隐私政策