Skip to content

Commit 74c9a8d

Browse files
committed
docs(no-pass-data-to-parent): elaborate on best way to handle passing refs TODOs
#22 #37
1 parent 5a33c9e commit 74c9a8d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/no-pass-data-to-parent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ export default {
4646
(ref) =>
4747
!isState(context, ref) &&
4848
!isProp(context, ref) &&
49-
// TODO: Should warn to use `forwardRef` instead?
49+
// TODO: Should advise to use `forwardRef` instead?
50+
// Not always the best solution, but usually, and outliers can silence the warning.
51+
// Could possibly check for refs on the "path" to this callback too.
5052
// https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect/issues/22
53+
// https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect/issues/37
5154
!isRef(context, ref),
5255
)
5356
) {

test/no-pass-data-to-parent.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ new MyRuleTester().run("no-pass-data-to-parent", rule, {
138138
{
139139
// https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect/issues/37
140140
// Alternate solutions exist, but this is arguably the most readable.
141-
// TODO: There is probably a more granular opportunity here...
142141
name: "Pass cleanup function that depends on ref",
143142
code: js`
144143
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";

0 commit comments

Comments
 (0)