jsx-no-duplicate-props
NOTE: this rule is included the following rule sets:
recommended
react
jsx
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-no-duplicate-props"], "exclude": ["jsx-no-duplicate-props"] } } }
不允许重复的 JSX 属性。后面的属性将始终覆盖前面的属性,这常常会导致意想不到的结果。
无效:
<div id="1" id="2" />;
<App a a />;
<App a {...b} a />;
有效:
<div id="1" />
<App a />
<App a {...b} />
<App {...b} b />