-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue-3686
- Loading branch information
Showing
63 changed files
with
1,946 additions
and
282 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -38,6 +38,64 @@ jobs: | |
- 10 | ||
- 9 | ||
- 8 | ||
typescript-eslint: | ||
- 5 | ||
- 6 | ||
- 7 | ||
- 8 | ||
exclude: | ||
- eslint: 3 | ||
babel-eslint: 10 | ||
- eslint: 3 | ||
typescript-eslint: 5 | ||
- eslint: 4 | ||
typescript-eslint: 5 | ||
- eslint: 4.14 | ||
typescript-eslint: 5 | ||
- eslint: 5 | ||
typescript-eslint: 5 | ||
- eslint: 3 | ||
typescript-eslint: 6 | ||
- eslint: 4 | ||
typescript-eslint: 6 | ||
- eslint: 4.14 | ||
typescript-eslint: 6 | ||
- eslint: 5 | ||
typescript-eslint: 6 | ||
- eslint: 6 | ||
typescript-eslint: 6 | ||
- eslint: 9 | ||
typescript-eslint: 6 | ||
- eslint: 3 | ||
typescript-eslint: 7 | ||
- eslint: 4 | ||
typescript-eslint: 7 | ||
- eslint: 4.14 | ||
typescript-eslint: 7 | ||
- eslint: 5 | ||
typescript-eslint: 7 | ||
- eslint: 6 | ||
typescript-eslint: 7 | ||
- eslint: 7 | ||
typescript-eslint: 7 | ||
- eslint: 9 | ||
typescript-eslint: 7 | ||
- eslint: 3 | ||
typescript-eslint: 8 | ||
- eslint: 4 | ||
typescript-eslint: 8 | ||
- eslint: 4.14 | ||
typescript-eslint: 8 | ||
- eslint: 5 | ||
typescript-eslint: 8 | ||
- eslint: 6 | ||
typescript-eslint: 8 | ||
- eslint: 7 | ||
typescript-eslint: 8 | ||
- eslint: 9 | ||
typescript-eslint: 5 | ||
- node-version: 19 | ||
typescript-eslint: 7 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -46,9 +104,9 @@ jobs: | |
with: | ||
node-version: ${{ matrix.node-version }} | ||
after_install: | | ||
npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@5" "babel-eslint@${{ matrix.babel-eslint }}" | ||
npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.typescript-eslint }}" "babel-eslint@${{ matrix.babel-eslint }}" | ||
env: | ||
NPM_CONFIG_LEGACY_PEER_DEPS: true | ||
NPM_CONFIG_LEGACY_PEER_DEPS: "${{ matrix.typescript-eslint >= 6 && 'false' || 'true' }}" | ||
- run: npx ls-engines | ||
- run: npm run unit-test | ||
- uses: codecov/[email protected] | ||
|
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
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,45 @@ | ||
# Require all forwardRef components include a ref parameter (`react/forward-ref-uses-ref`) | ||
|
||
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). | ||
|
||
<!-- end auto-generated rule header --> | ||
|
||
Requires that components wrapped with `forwardRef` must have a `ref` parameter. Omitting the `ref` argument is usually a bug, and components not using `ref` don't need to be wrapped by `forwardRef`. | ||
|
||
See <https://react.dev/reference/react/forwardRef> | ||
|
||
## Rule Details | ||
|
||
This rule checks all React components using `forwardRef` and verifies that there is a second parameter. | ||
|
||
The following patterns are considered warnings: | ||
|
||
```jsx | ||
var React = require('react'); | ||
|
||
var Component = React.forwardRef((props) => ( | ||
<div /> | ||
)); | ||
``` | ||
|
||
The following patterns are **not** considered warnings: | ||
|
||
```jsx | ||
var React = require('react'); | ||
|
||
var Component = React.forwardRef((props, ref) => ( | ||
<div ref={ref} /> | ||
)); | ||
|
||
var Component = React.forwardRef((props, ref) => ( | ||
<div /> | ||
)); | ||
|
||
function Component(props) { | ||
return <div />; | ||
}; | ||
``` | ||
|
||
## When not to use | ||
|
||
If you don't want to enforce that components using `forwardRef` utilize the forwarded ref. |
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
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
Oops, something went wrong.