Skip to content

Commit

Permalink
[Fix] jsx-no-constructed-context-values, jsx-no-useless-fragment:…
Browse files Browse the repository at this point in the history
… add a rule schema
  • Loading branch information
ljharb committed Jan 18, 2023
1 parent d2194a5 commit 4523e73
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

### Fixed
* configs: restore `parserOptions` in legacy configs ([#3523][] @ljharb)
* [`jsx-no-constructed-context-values`], [`jsx-no-useless-fragment`]: add a rule schema (@ljharb)

[#3520]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3523

Expand Down
2 changes: 2 additions & 0 deletions docs/rules/jsx-no-useless-fragment.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const cat = <>meow</>
{showFullName ? fullName : firstName}
```

## Rule Options

### `allowExpressions`

When `true` single expressions in a fragment will be allowed. This is useful in
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-constructed-context-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ module.exports = {
url: docsUrl('jsx-no-constructed-context-values'),
},
messages,
schema: {},
},

// eslint-disable-next-line arrow-body-style
Expand Down
8 changes: 8 additions & 0 deletions lib/rules/jsx-no-useless-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ module.exports = {
url: docsUrl('jsx-no-useless-fragment'),
},
messages,
schema: [{
type: 'object',
properties: {
allowExpressions: {
type: 'boolean',
},
},
}],
},

create(context) {
Expand Down

0 comments on commit 4523e73

Please sign in to comment.