You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
14
14
*[`no-unknown-property`]: support `onResize` on audio/video tags ([#3662][]@caesar1030)
15
15
*[`jsx-wrap-multilines`]: add `never` option to prohibit wrapping parens on multiline JSX ([#3668][]@reedws)
16
16
*[`jsx-filename-extension`]: add `ignoreFilesWithoutCode` option to allow empty files ([#3674][]@burtek)
*[`jsx-no-leaked-render`]: preserve RHS parens for multiline jsx elements while fixing ([#3623][]@akulsr0)
@@ -29,6 +30,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
29
30
*[Docs][`jsx-key`]: fix correct example ([#3656][]@developer-bandi)
Copy file name to clipboardExpand all lines: docs/rules/jsx-boolean-value.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,11 @@ This rule will enforce one or the other to keep consistency in your code.
14
14
15
15
This rule takes two arguments. If the first argument is `"always"` then it warns whenever an attribute is missing its value. If `"never"` then it warns if an attribute has a `true` value. The default value of this option is `"never"`.
16
16
17
-
The second argument is optional: if provided, it must be an object with a `"never"` property (if the first argument is `"always"`), or an `"always"` property (if the first argument is `"never"`). This property’s value must be an array of strings representing prop names.
17
+
The second argument is optional. If provided, it must be an object. These properties are supported:
18
+
19
+
First, the `"never"` and `"always"` properties are one set. The two properties cannot be set together. `"never"` must be used when the first argument is `"always"` and `"always"` must be used when the first argument is `"never"`. This property’s value must be an array of strings representing prop names.
20
+
21
+
When the first argument is `"never"`, a boolean `"assumeUndefinedIsFalse"` may be provided, which defaults to `false`. When `true`, an absent boolean prop will be treated as if it were explicitly set to `false`.
18
22
19
23
Examples of **incorrect** code for this rule, when configured with `"never"`, or with `"always", { "never": ["personal"] }`:
20
24
@@ -40,6 +44,18 @@ Examples of **correct** code for this rule, when configured with `"always"`, or
40
44
var Hello =<Hello personal={true} />;
41
45
```
42
46
47
+
Examples of **incorrect** code for this rule, when configured with `"never", { "assumeUndefinedIsFalse": true }`, or with `"always", { "never": ["personal"], "assumeUndefinedIsFalse": true }`:
48
+
49
+
```jsx
50
+
var Hello =<Hello personal={false} />;
51
+
```
52
+
53
+
Examples of **correct** code for this rule, when configured with `"never", { "assumeUndefinedIsFalse": true }`, or with `"always", { "never": ["personal"], "assumeUndefinedIsFalse": true }`:
54
+
55
+
```jsx
56
+
var Hello =<Hello />;
57
+
```
58
+
43
59
## When Not To Use It
44
60
45
61
If you do not want to enforce any style for boolean attributes, then you can disable this rule.
0 commit comments