-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into useless-fragment
- Loading branch information
Showing
111 changed files
with
1,907 additions
and
207 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Checks that a `<button>` JSX element has a valid `type` attribute. The default | ||
value is `"submit"` which is often not the desired behavior. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
<button /> | ||
<button type="foo" /> | ||
<button type={condition ? "foo" : "bar"} /> | ||
<button type={foo} /> | ||
<button type={2} /> | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
<button type="submit" /> | ||
<button type="button" /> | ||
<button type="reset" /> | ||
<button type={condition ? "button" : "submit"} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Enforce a consistent JSX boolean value style. Passing `true` as the boolean | ||
value can be omitted with the shorthand syntax. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
const foo = <Foo isFoo={true} />; | ||
const foo = <Foo isFoo={false} />; | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
const foo = <Foo isFoo />; | ||
const foo = <Foo isFoo={false} />; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Ensure consistent use of curly braces around JSX expressions. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
const foo = <Foo foo=<div /> />; | ||
const foo = <Foo str={"foo"} />; | ||
const foo = <div>{"foo"}</div>; | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
const foo = <Foo foo={<div />} />; | ||
const foo = <Foo str="foo" />; | ||
const foo = <div>foo</div>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Pass children as JSX children instead of as an attribute. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
<div children="foo" /> | ||
<div children={[<Foo />, <Bar />]} /> | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
<div>foo</div> | ||
<div><Foo /><Bar /></div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Disallow duplicated JSX props. Later props will always overwrite earlier props | ||
often leading to unexpected results. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
<div id="1" id="2" />; | ||
<App a a />; | ||
<App a {...b} a />; | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
<div id="1" /> | ||
<App a /> | ||
<App a {...b} /> | ||
<App {...b} b /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Spreading the same expression twice is typically a mistake and causes | ||
unnecessary computations. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
<div {...foo} {...foo} /> | ||
<div {...foo} a {...foo} /> | ||
<Foo {...foo.bar} {...foo.bar} /> | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
<div {...foo} /> | ||
<div {...foo.bar} a /> | ||
<Foo {...foo.bar} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Ensure that void elements in HTML don't have any children as that is not valid | ||
HTML. See | ||
[`Void element` article on MDN](https://developer.mozilla.org/en-US/docs/Glossary/Void_element) | ||
for more information. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
<br>foo</br> | ||
<img src="a.jpg">foo</img> | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
<br /> | ||
<img src="a.jpg" /> | ||
``` |
Oops, something went wrong.