-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[compiler] Surface unused opt out directives in eslint #30721
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. Additionally, the opt out directive would effectively disable our eslint plugin from running on the opted out component/hook, which increases the chances of said function accruing more rules of React violations or other anti-patterns. ghstack-source-id: 7446d1732605a5efda0904e6bfe29d6359a01be7 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. Additionally, the opt out directive would effectively disable our eslint plugin from running on the opted out component/hook, which increases the chances of said function accruing more rules of React violations or other anti-patterns. ghstack-source-id: 33b2662431164a23f4c19cf4b0e0dffa922ed646 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. Additionally, the opt out directive would effectively disable our eslint plugin from running on the opted out component/hook, which increases the chances of said function accruing more rules of React violations or other anti-patterns. ghstack-source-id: cf7458b04395290a79397b94905eaf0477717bb1 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: e288fff57efb31c4e16ad5d74a0cc1d72bbf78db Pull Request resolved: #30721
FunctionDeclaration(fnDecl) { | ||
for (const stmt of fnDecl.body.body) { | ||
reportUnusedOptOutDirective(stmt); | ||
} | ||
}, | ||
ArrowFunctionExpression(fnExpr) { | ||
if (fnExpr.body.type === 'BlockStatement') { | ||
for (const stmt of fnExpr.body.body) { | ||
reportUnusedOptOutDirective(stmt); | ||
} | ||
} | ||
}, | ||
FunctionExpression(fnExpr) { | ||
for (const stmt of fnExpr.body.body) { | ||
reportUnusedOptOutDirective(stmt); | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't necessarily match 1:1 with functions that the compiler attempted to compile, in particular it might find more functions. But I guess that's okay, if you have a "use no memo" in a component that isn't being recognized as a component/hook that's also an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesomesauce
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: 20df08f227d03da57ca8d48eb779ec8866981d7c Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: 20df08f227d03da57ca8d48eb779ec8866981d7c Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: 38718f8fd2e6bae189e3b283871f183449326f53 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: 8182bdcfe1229fedd67b92eaa802a87c72697346 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: eca25236a63eba2c6515e70c8efe4ce36c44be45 Pull Request resolved: #30721
This PR updates the eslint plugin to report unused opt out directives. One of the downsides of the opt out directive is that it opts the component/hook out of compilation forever, even if the underlying issue was fixed in product code or fixed in the compiler. ghstack-source-id: 81deb5c11b7c57f07f6ab13266066cd73b2f3729 Pull Request resolved: #30721
**breaking change for canary users: Bumps peer dependency of React from `19.0.0-rc-1eaccd82-20240816` to `19.0.0-rc-eb3ad065-20240822`** No changes required in Next.js it seems. [diff facebook/react@1eaccd82...eb3ad065](facebook/react@1eaccd8...eb3ad06) <details> <summary>React upstream changes</summary> - facebook/react#30761 - facebook/react#30779 - facebook/react#30775 - facebook/react#30770 - facebook/react#30756 - facebook/react#30755 - facebook/react#30768 - facebook/react#30760 - facebook/react#30732 - facebook/react#30757 - facebook/react#30750 - facebook/react#30751 - facebook/react#30753 - facebook/react#30740 - facebook/react#30748 - facebook/react#30746 - facebook/react#30747 - facebook/react#30731 - facebook/react#30725 - facebook/react#30741 - facebook/react#30730 - facebook/react#30726 - facebook/react#30717 - facebook/react#30729 - facebook/react#30721 - facebook/react#30720 - facebook/react#30705 </details>
Stack from ghstack (oldest at bottom):
This PR updates the eslint plugin to report unused opt out directives.
One of the downsides of the opt out directive is that it opts the
component/hook out of compilation forever, even if the underlying issue
was fixed in product code or fixed in the compiler.