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
[compiler] Surface unused opt out directives in eslint
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: 20df08f
Pull Request resolved: #30721
name: "'use no forget' does not disable eslint rule",
204
+
code: normalizeIndent`
205
+
let count = 0;
206
+
function Component() {
207
+
'use no forget';
208
+
count = count + 1;
209
+
return <div>Hello world {count}</div>
210
+
}
211
+
`,
212
+
errors: [
213
+
{
214
+
message:
215
+
'Unexpected reassignment of a variable which was defined outside of the component. Components and hooks should be pure and side-effect free, but variable reassignment is a form of side-effect. If this variable is used in rendering, use useState instead. (https://react.dev/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render)',
216
+
},
217
+
],
218
+
},
219
+
{
220
+
name: "Unused 'use no forget' directive is reported when no errors are present",
0 commit comments