lint: enable reportUnusedDisableDirectives and remove unused suppressions (#28721)
This enables linting against unused suppressions and removes the ones that were unused.
Jan Kassens committed
Jun 21, 2024 at 12:24 UTC
b565373afd0cc1988497e1107106e851e8cfb261
66 files changed
+44
-148
.eslintrc.js
+2
@@ -17,6 +17,8 @@ module.exports = {
17
// Stop ESLint from looking for a configuration file in parent folders
18
root: true,
19
20
+ reportUnusedDisableDirectives: true,
21
+
22
plugins: [
23
'babel',
24
'ft-flow',
packages/react-client/src/ReactFlightClient.js
-2
@@ -1839,7 +1839,6 @@ function resolveHint<Code: HintCode>(
1839
dispatchHint(code, hintModel);
1840
}
1841
1842
-// eslint-disable-next-line react-internal/no-production-logging
1842
const supportsCreateTask =
1843
__DEV__ && enableOwnerStacks && !!(console: any).createTask;
1844
@@ -1977,7 +1976,6 @@ function initializeFakeTask(
1976
? null
1977
: initializeFakeTask(response, componentInfo.owner);
1978
1980
- // eslint-disable-next-line react-internal/no-production-logging
1979
const createTaskFn = (console: any).createTask.bind(
1980
console,
1981
getServerComponentTaskName(componentInfo),
packages/react-client/src/ReactFlightReplyClient.js
-11
@@ -227,14 +227,11 @@ export function processReply(
227
function progress(entry: {done: boolean, value: ReactServerValue, ...}) {
228
if (entry.done) {
229
const blobId = nextPartId++;
230
- // eslint-disable-next-line react-internal/safe-string-coercion
230
data.append(formFieldPrefix + blobId, new Blob(buffer));
232
- // eslint-disable-next-line react-internal/safe-string-coercion
231
data.append(
232
formFieldPrefix + streamId,
233
'"$o' + blobId.toString(16) + '"',
234
);
237
- // eslint-disable-next-line react-internal/safe-string-coercion
235
data.append(formFieldPrefix + streamId, 'C'); // Close signal
236
pendingParts--;
237
if (pendingParts === 0) {
@@ -262,7 +259,6 @@ export function processReply(
259
260
function progress(entry: {done: boolean, value: ReactServerValue, ...}) {
261
if (entry.done) {
265
- // eslint-disable-next-line react-internal/safe-string-coercion
262
data.append(formFieldPrefix + streamId, 'C'); // Close signal
263
pendingParts--;
264
if (pendingParts === 0) {
@@ -272,7 +268,6 @@ export function processReply(
268
try {
269
// $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here.
270
const partJSON: string = JSON.stringify(entry.value, resolveToJSON);
275
- // eslint-disable-next-line react-internal/safe-string-coercion
271
data.append(formFieldPrefix + streamId, partJSON);
272
reader.read().then(progress, reject);
273
} catch (x) {
@@ -326,7 +321,6 @@ export function processReply(
321
) {
322
if (entry.done) {
323
if (entry.value === undefined) {
329
- // eslint-disable-next-line react-internal/safe-string-coercion
324
data.append(formFieldPrefix + streamId, 'C'); // Close signal
325
} else {
326
// Unlike streams, the last value may not be undefined. If it's not
@@ -348,7 +342,6 @@ export function processReply(
342
try {
343
// $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here.
344
const partJSON: string = JSON.stringify(entry.value, resolveToJSON);
351
- // eslint-disable-next-line react-internal/safe-string-coercion
345
data.append(formFieldPrefix + streamId, partJSON);
346
iterator.next().then(progress, reject);
347
} catch (x) {
@@ -441,7 +434,6 @@ export function processReply(
434
const partJSON = serializeModel(resolvedModel, lazyId);
435
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
436
const data: FormData = formData;
444
- // eslint-disable-next-line react-internal/safe-string-coercion
437
data.append(formFieldPrefix + lazyId, partJSON);
438
return serializeByValueID(lazyId);
439
} catch (x) {
@@ -461,7 +453,6 @@ export function processReply(
453
const partJSON = serializeModel(value, lazyId);
454
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
455
const data: FormData = formData;
464
- // eslint-disable-next-line react-internal/safe-string-coercion
456
data.append(formFieldPrefix + lazyId, partJSON);
457
pendingParts--;
458
if (pendingParts === 0) {
@@ -502,7 +493,6 @@ export function processReply(
493
const partJSON = serializeModel(partValue, promiseId);
494
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
495
const data: FormData = formData;
505
- // eslint-disable-next-line react-internal/safe-string-coercion
496
data.append(formFieldPrefix + promiseId, partJSON);
497
pendingParts--;
498
if (pendingParts === 0) {
@@ -784,7 +774,6 @@ export function processReply(
774
}
775
// The reference to this function came from the same client so we can pass it back.
776
const refId = nextPartId++;
787
- // eslint-disable-next-line react-internal/safe-string-coercion
777
formData.set(formFieldPrefix + refId, metaDataJSON);
778
return serializeServerReferenceID(refId);
779
}
packages/react-client/src/forks/ReactFlightClientConfig.custom.js
+1
-1
@@ -42,7 +42,7 @@ export const usedWithSSR = true;
42
43
export opaque type Source = mixed;
44
45
-export opaque type StringDecoder = mixed; // eslint-disable-line no-undef
45
+export opaque type StringDecoder = mixed;
46
47
export const createStringDecoder = $$$config.createStringDecoder;
48
export const readPartialStringChunk = $$$config.readPartialStringChunk;
packages/react-devtools-extensions/flow-typed/jest.js
-5
@@ -146,13 +146,11 @@ type JestPromiseType = {
146
* Use rejects to unwrap the reason of a rejected promise so any other
147
* matcher can be chained. If the promise is fulfilled the assertion fails.
148
*/
149
- // eslint-disable-next-line no-use-before-define
149
rejects: JestExpectType,
150
/**
151
* Use resolves to unwrap the value of a fulfilled promise so any other
152
* matcher can be chained. If the promise is rejected the assertion fails.
153
*/
155
- // eslint-disable-next-line no-use-before-define
154
resolves: JestExpectType,
155
};
156
@@ -1098,10 +1096,8 @@ type JestPrettyFormatColors = {
1096
};
1097
1098
type JestPrettyFormatIndent = string => string;
1101
-// eslint-disable-next-line no-unused-vars
1099
type JestPrettyFormatRefs = Array<any>;
1100
type JestPrettyFormatPrint = any => string;
1104
-// eslint-disable-next-line no-unused-vars
1101
type JestPrettyFormatStringOrNull = string | null;
1102
1103
type JestPrettyFormatOptions = {
@@ -1112,7 +1108,6 @@ type JestPrettyFormatOptions = {
1108
indent: number,
1109
maxDepth: number,
1110
min: boolean,
1115
- // eslint-disable-next-line no-use-before-define
1111
plugins: JestPrettyFormatPlugins,
1112
printFunctionName: boolean,
1113
spacing: string,
packages/react-devtools-extensions/flow-typed/npm/react-test-renderer_v16.x.x.js
-1
@@ -52,7 +52,6 @@ type TestRendererOptions = {
52
};
53
54
declare module 'react-test-renderer' {
55
- // eslint-disable-next-line no-inner-declarations
55
declare export type ReactTestRenderer = {
56
toJSON(): null | ReactTestRendererJSON,
57
toTree(): null | ReactTestRendererTree,
packages/react-devtools-inline/__tests__/__e2e__/utils.js
-1
@@ -7,7 +7,6 @@ const config = require('../../playwright.config');
7
const {test} = require('@playwright/test');
8
9
function runOnlyForReactRange(range) {
10
- // eslint-disable-next-line jest/no-disabled-tests
10
test.skip(
11
!semver.satisfies(config.use.react_version, range),
12
`This test requires a React version of ${range} to run. ` +
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+1
-2
@@ -665,7 +665,6 @@ describe('InspectedElement', () => {
665
anonymous_fn={instance.anonymousFunction}
666
array_buffer={arrayBuffer}
667
array_of_arrays={arrayOfArrays}
668
- // eslint-disable-next-line no-undef
668
big_int={BigInt(123)}
669
bound_fn={exampleFunction.bind(this)}
670
data_view={dataView}
@@ -1876,7 +1875,7 @@ describe('InspectedElement', () => {
1875
xyz: 1,
1876
},
1877
});
1879
- const bigInt = BigInt(123); // eslint-disable-line no-undef
1878
+ const bigInt = BigInt(123);
1879
1880
await utils.actAsync(() =>
1881
render(
packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js
+1
-2
@@ -185,7 +185,6 @@ describe('InspectedElementContext', () => {
185
anonymous_fn: instance.anonymousFunction,
186
array_buffer: arrayBuffer,
187
array_of_arrays: arrayOfArrays,
188
- // eslint-disable-next-line no-undef
188
big_int: BigInt(123),
189
bound_fn: exampleFunction.bind(this),
190
data_view: dataView,
@@ -888,7 +887,7 @@ describe('InspectedElementContext', () => {
887
xyz: 1,
888
},
889
});
891
- const bigInt = BigInt(123); // eslint-disable-line no-undef
890
+ const bigInt = BigInt(123);
891
892
act(() =>
893
ReactDOM.render(
packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js
-2
@@ -30,7 +30,6 @@ disabledLog.__reactDisabledLog = true;
30
31
export function disableLogs(): void {
32
if (disabledDepth === 0) {
33
- /* eslint-disable react-internal/no-production-logging */
33
prevLog = console.log;
34
prevInfo = console.info;
35
prevWarn = console.warn;
@@ -63,7 +62,6 @@ export function disableLogs(): void {
62
export function reenableLogs(): void {
63
disabledDepth--;
64
if (disabledDepth === 0) {
66
- /* eslint-disable react-internal/no-production-logging */
65
const props = {
66
configurable: true,
67
enumerable: true,
packages/react-devtools-shared/src/backend/renderer.js
-1
@@ -1604,7 +1604,6 @@ export function attach(
1604
return changedKeys;
1605
}
1606
1607
- // eslint-disable-next-line no-unused-vars
1607
function didFiberRender(prevFiber: Fiber, nextFiber: Fiber): boolean {
1608
switch (nextFiber.tag) {
1609
case ClassComponent:
packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js
+1
-1
@@ -31,7 +31,7 @@ const immutable = Immutable.fromJS({
31
xyz: 1,
32
},
33
});
34
-const bigInt = BigInt(123); // eslint-disable-line no-undef
34
+const bigInt = BigInt(123);
35
36
class Foo {
37
flag = false;
packages/react-devtools/app.js
+1
-1
@@ -46,7 +46,7 @@ app.on('ready', function () {
46
});
47
48
// and load the index.html of the app.
49
- mainWindow.loadURL('file://' + __dirname + '/app.html'); // eslint-disable-line no-path-concat
49
+ mainWindow.loadURL('file://' + __dirname + '/app.html');
50
// $FlowFixMe[incompatible-use] found when upgrading Flow
51
mainWindow.webContents.executeJavaScript(
52
// We use this so that RN can keep relative JSX __source filenames
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
+2
-2
@@ -30,7 +30,7 @@ export function getValueForAttribute(
30
// shouldRemoveAttribute
31
switch (typeof expected) {
32
case 'function':
33
- case 'symbol': // eslint-disable-line
33
+ case 'symbol':
34
return expected;
35
case 'boolean': {
36
const prefix = name.toLowerCase().slice(0, 5);
@@ -109,7 +109,7 @@ export function setValueForAttribute(
109
switch (typeof value) {
110
case 'undefined':
111
case 'function':
112
- case 'symbol': // eslint-disable-line
112
+ case 'symbol':
113
node.removeAttribute(name);
114
return;
115
case 'boolean': {
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
+1
-1
@@ -443,7 +443,7 @@ export function createInstance(
443
didWarnScriptTags = true;
444
}
445
}
446
- div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
446
+ div.innerHTML = '<script><' + '/script>';
447
// This is guaranteed to yield a script element.
448
const firstChild = ((div.firstChild: any): HTMLScriptElement);
449
domElement = div.removeChild(firstChild);
packages/react-dom-bindings/src/client/validateDOMNesting.js
-1
@@ -516,7 +516,6 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
516
return true;
517
}
518
519
- // eslint-disable-next-line react-internal/safe-string-coercion
519
const warnKey = '#text|' + parentTag;
520
if (didWarn[warnKey]) {
521
return false;
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
+1
-3
@@ -1464,7 +1464,7 @@ function pushAttribute(
1464
// shouldRemoveAttribute
1465
switch (typeof value) {
1466
case 'function':
1467
- case 'symbol': // eslint-disable-line
1467
+ case 'symbol':
1468
return;
1469
case 'boolean': {
1470
const prefix = attributeName.toLowerCase().slice(0, 5);
@@ -2808,7 +2808,6 @@ function pushStyleImpl(
2808
child !== null &&
2809
child !== undefined
2810
) {
2811
- // eslint-disable-next-line react-internal/safe-string-coercion
2811
target.push(stringToChunk(escapeStyleTextContent(child)));
2812
}
2813
pushInnerHTML(target, innerHTML, children);
@@ -2850,7 +2849,6 @@ function pushStyleContents(
2849
child !== null &&
2850
child !== undefined
2851
) {
2853
- // eslint-disable-next-line react-internal/safe-string-coercion
2852
target.push(stringToChunk(escapeStyleTextContent(child)));
2853
}
2854
pushInnerHTML(target, innerHTML, children);
packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js
+1
-1
@@ -271,7 +271,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
271
}
272
}
273
case 'function':
274
- case 'symbol': // eslint-disable-line
274
+ case 'symbol':
275
// Warn when a known attribute is a bad type
276
warnedProperties[name] = true;
277
return false;
packages/react-dom-bindings/src/shared/isAttributeNameSafe.js
-2
@@ -9,10 +9,8 @@
9
10
import hasOwnProperty from 'shared/hasOwnProperty';
11
12
-/* eslint-disable max-len */
12
const ATTRIBUTE_NAME_START_CHAR =
13
':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
15
-/* eslint-enable max-len */
14
export const ATTRIBUTE_NAME_CHAR: string =
15
ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
16
packages/react-dom-bindings/src/shared/sanitizeURL.js
-1
@@ -16,7 +16,6 @@
16
// INFORMATION SEPARATOR ONE, inclusive:
17
// https://infra.spec.whatwg.org/#c0-control-or-space
18
19
-/* eslint-disable max-len */
19
const isJavaScriptProtocol =
20
/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
21
packages/react-dom/src/__tests__/ReactComponent-test.js
-2
@@ -468,7 +468,6 @@ describe('ReactComponent', () => {
468
root.unmount();
469
});
470
471
- /* eslint-disable indent */
471
expect(log).toEqual([
472
'start mount',
473
'inner 1 render',
@@ -497,7 +496,6 @@ describe('ReactComponent', () => {
496
'ref 2 got null',
497
'inner 2 componentWillUnmount',
498
]);
500
- /* eslint-enable indent */
499
});
500
501
// @gate !disableLegacyMode
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
-2
@@ -1503,7 +1503,6 @@ describe('ReactComponentLifeCycle', () => {
1503
});
1504
}).toWarnDev(
1505
[
1506
- /* eslint-disable max-len */
1506
`componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1507
1508
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -1523,7 +1522,6 @@ Please update the following components: MyComponent`,
1522
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1523
1524
Please update the following components: MyComponent`,
1526
- /* eslint-enable max-len */
1525
],
1526
{withoutStack: true},
1527
);
packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js
+1
-1
@@ -744,7 +744,7 @@ describe('ReactDOMServerIntegration', () => {
744
'a div with a single child surrounded by whitespace',
745
async render => {
746
// prettier-ignore
747
- const e = await render(<div id="parent"> <div id="child" /> </div>); // eslint-disable-line no-multi-spaces
747
+ const e = await render(<div id="parent"> <div id="child" /> </div>);
748
expect(e.childNodes.length).toBe(3);
749
const textNode1 = e.childNodes[0];
750
const child = e.childNodes[1];
packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js
+3
-3
@@ -310,13 +310,13 @@ describe('ReactDOMServerIntegration', () => {
310
<div id="child2" />
311
</div>,
312
// prettier-ignore
313
- <div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
313
+ <div id="parent"><div id="child1" /> <div id="child2" /></div>,
314
));
315
316
it('should error reconnecting a div with children separated by different whitespace on the server', () =>
317
expectMarkupMismatch(
318
// prettier-ignore
319
- <div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
319
+ <div id="parent"><div id="child1" /> <div id="child2" /></div>,
320
<div id="parent">
321
<div id="child1" />
322
<div id="child2" />
@@ -329,7 +329,7 @@ describe('ReactDOMServerIntegration', () => {
329
<div id="child1" /> <div id="child2" />
330
</div>,
331
// prettier-ignore
332
- <div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
332
+ <div id="parent"><div id="child1" /> <div id="child2" /></div>,
333
));
334
335
it('can distinguish an empty component from a dom node', () =>
packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
-2
@@ -652,7 +652,6 @@ describe('ReactLegacyUpdates', () => {
652
});
653
});
654
655
- /* eslint-disable indent */
655
expect(updates).toEqual([
656
'Outer-render-0',
657
'Inner-render-0-0',
@@ -681,7 +680,6 @@ describe('ReactLegacyUpdates', () => {
680
'Inner-didUpdate-2-2',
681
'Inner-callback-2',
682
]);
684
- /* eslint-enable indent */
683
});
684
685
// @gate !disableLegacyMode
packages/react-dom/src/__tests__/ReactUpdates-test.js
-2
@@ -760,7 +760,6 @@ describe('ReactUpdates', () => {
760
});
761
});
762
763
- /* eslint-disable indent */
763
expect(updates).toEqual([
764
'Outer-render-0',
765
'Inner-render-0-0',
@@ -789,7 +788,6 @@ describe('ReactUpdates', () => {
788
'Inner-didUpdate-2-2',
789
'Inner-callback-2',
790
]);
792
- /* eslint-enable indent */
791
});
792
793
it('should flush updates in the correct order across roots', async () => {
packages/react-dom/src/client/ReactDOMClientFB.js
-2
@@ -90,9 +90,7 @@ function createPortal(
90
// Overload the definition to the two valid signatures.
91
// Warning, this opts-out of checking the function body.
92
declare function flushSyncFromReconciler<R>(fn: () => R): R;
93
-// eslint-disable-next-line no-redeclare
93
declare function flushSyncFromReconciler(): void;
95
-// eslint-disable-next-line no-redeclare
94
function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
95
if (__DEV__) {
96
if (isAlreadyRendering()) {
packages/react-native-renderer/index.js
-1
@@ -10,7 +10,6 @@
10
import type {ReactNativeType} from './src/ReactNativeTypes';
11
import * as ReactNative from './src/ReactNativeRenderer';
12
// Assert that the exports line up with the type we're going to expose.
13
-// eslint-disable-next-line ft-flow/no-unused-expressions
13
(ReactNative: ReactNativeType);
14
15
export * from './src/ReactNativeRenderer';
packages/react-noop-renderer/src/createReactNoop.js
-1
@@ -971,7 +971,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
971
972
function onRecoverableError(error) {
973
// TODO: Turn this on once tests are fixed
974
- // eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args
974
// console.error(error);
975
}
976
packages/react-reconciler/src/ReactFiber.js
+2
-2
@@ -125,10 +125,10 @@ if (__DEV__) {
125
hasBadMapPolyfill = false;
126
try {
127
const nonExtensibleObject = Object.preventExtensions({});
128
- /* eslint-disable no-new */
128
+ // eslint-disable-next-line no-new
129
new Map([[nonExtensibleObject, null]]);
130
+ // eslint-disable-next-line no-new
131
new Set([nonExtensibleObject]);
131
- /* eslint-enable no-new */
132
} catch (e) {
133
// TODO: Consider warning about bad polyfills
134
hasBadMapPolyfill = true;
packages/react-reconciler/src/ReactFiberClassComponent.js
+1
-1
@@ -619,7 +619,7 @@ function constructClassInstance(
619
) {
620
setIsStrictModeForDevtools(true);
621
try {
622
- instance = new ctor(props, context); // eslint-disable-line no-new
622
+ instance = new ctor(props, context);
623
} finally {
624
setIsStrictModeForDevtools(false);
625
}
packages/react-reconciler/src/ReactFiberWorkLoop.js
-3
@@ -1507,11 +1507,8 @@ export function discreteUpdates<A, B, C, D, R>(
1507
1508
// Overload the definition to the two valid signatures.
1509
// Warning, this opts-out of checking the function body.
1510
-// eslint-disable-next-line no-unused-vars
1510
declare function flushSyncFromReconciler<R>(fn: () => R): R;
1512
-// eslint-disable-next-line no-redeclare
1511
declare function flushSyncFromReconciler(void): void;
1514
-// eslint-disable-next-line no-redeclare
1512
export function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
1513
// In legacy mode, we flush pending passive effects at the beginning of the
1514
// next event, not at the end of the previous one.
packages/react-reconciler/src/__tests__/ReactEffectOrdering-test.js
-2
@@ -8,8 +8,6 @@
8
* @jest-environment node
9
*/
10
11
-/* eslint-disable no-func-assign */
12
-
11
'use strict';
12
13
let React;
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
-10
@@ -1563,7 +1563,6 @@ describe('ReactHooks', () => {
1563
1564
it(`warns on using differently ordered hooks (${hookNameA}, ${hookNameB}) on subsequent renders`, async () => {
1565
function App(props) {
1566
- /* eslint-disable no-unused-vars */
1566
if (props.update) {
1567
secondHelper();
1568
firstHelper();
@@ -1574,7 +1573,6 @@ describe('ReactHooks', () => {
1573
// This should not appear in the warning message because it occurs after the first mismatch
1574
useRefHelper();
1575
return null;
1577
- /* eslint-enable no-unused-vars */
1576
}
1577
let root;
1578
await act(() => {
@@ -1616,7 +1614,6 @@ describe('ReactHooks', () => {
1614
1615
it(`warns when more hooks (${hookNameA}, ${hookNameB}) are used during update than mount`, async () => {
1616
function App(props) {
1619
- /* eslint-disable no-unused-vars */
1617
if (props.update) {
1618
firstHelper();
1619
secondHelper();
@@ -1624,7 +1621,6 @@ describe('ReactHooks', () => {
1621
firstHelper();
1622
}
1623
return null;
1627
- /* eslint-enable no-unused-vars */
1624
}
1625
let root;
1626
await act(() => {
@@ -1671,7 +1667,6 @@ describe('ReactHooks', () => {
1667
1668
it(`warns when fewer hooks (${hookNameA}, ${hookNameB}) are used during update than mount`, async () => {
1669
function App(props) {
1674
- /* eslint-disable no-unused-vars */
1670
if (props.update) {
1671
firstHelper();
1672
} else {
@@ -1679,7 +1674,6 @@ describe('ReactHooks', () => {
1674
secondHelper();
1675
}
1676
return null;
1682
- /* eslint-enable no-unused-vars */
1677
}
1678
let root;
1679
await act(() => {
@@ -1701,7 +1695,6 @@ describe('ReactHooks', () => {
1695
'(useImperativeHandleHelper, useMemoHelper) on subsequent renders',
1696
async () => {
1697
function App(props) {
1704
- /* eslint-disable no-unused-vars */
1698
if (props.update) {
1699
useMemoHelper();
1700
useImperativeHandleHelper();
@@ -1712,7 +1705,6 @@ describe('ReactHooks', () => {
1705
// This should not appear in the warning message because it occurs after the first mismatch
1706
useRefHelper();
1707
return null;
1715
- /* eslint-enable no-unused-vars */
1708
}
1709
let root;
1710
await act(() => {
@@ -1753,7 +1745,6 @@ describe('ReactHooks', () => {
1745
useState(0);
1746
}
1747
function App(props) {
1756
- /* eslint-disable no-unused-vars */
1748
if (props.update) {
1749
useCustomHook();
1750
useReducer((s, a) => a, 0);
@@ -1763,7 +1754,6 @@ describe('ReactHooks', () => {
1754
useCustomHook();
1755
}
1756
return null;
1766
- /* eslint-enable no-unused-vars */
1757
}
1758
let root;
1759
await act(() => {
packages/react-reconciler/src/__tests__/useEffectEvent-test.js
-2
@@ -8,8 +8,6 @@
8
* @jest-environment node
9
*/
10
11
-/* eslint-disable no-func-assign */
12
-
11
'use strict';
12
13
import {useInsertionEffect} from 'react';
packages/react-reconciler/src/__tests__/useRef-test.internal.js
-2
@@ -8,8 +8,6 @@
8
* @jest-environment node
9
*/
10
11
-/* eslint-disable no-func-assign */
12
-
11
'use strict';
12
13
describe('useRef', () => {
packages/react-reconciler/src/forks/ReactFiberConfig.custom.js
+17
-17
@@ -24,22 +24,22 @@
24
// really an argument to a top-level wrapping function.
25
26
declare const $$$config: any;
27
-export opaque type Type = mixed; // eslint-disable-line no-undef
28
-export opaque type Props = mixed; // eslint-disable-line no-undef
29
-export opaque type Container = mixed; // eslint-disable-line no-undef
30
-export opaque type Instance = mixed; // eslint-disable-line no-undef
31
-export opaque type TextInstance = mixed; // eslint-disable-line no-undef
32
-export opaque type SuspenseInstance = mixed; // eslint-disable-line no-undef
33
-export opaque type HydratableInstance = mixed; // eslint-disable-line no-undef
34
-export opaque type PublicInstance = mixed; // eslint-disable-line no-undef
35
-export opaque type HostContext = mixed; // eslint-disable-line no-undef
36
-export opaque type UpdatePayload = mixed; // eslint-disable-line no-undef
37
-export opaque type ChildSet = mixed; // eslint-disable-line no-undef
38
-export opaque type TimeoutHandle = mixed; // eslint-disable-line no-undef
39
-export opaque type NoTimeout = mixed; // eslint-disable-line no-undef
40
-export opaque type RendererInspectionConfig = mixed; // eslint-disable-line no-undef
41
-export opaque type TransitionStatus = mixed; // eslint-disable-line no-undef
42
-export opaque type FormInstance = mixed; // eslint-disable-line no-undef
27
+export opaque type Type = mixed;
28
+export opaque type Props = mixed;
29
+export opaque type Container = mixed;
30
+export opaque type Instance = mixed;
31
+export opaque type TextInstance = mixed;
32
+export opaque type SuspenseInstance = mixed;
33
+export opaque type HydratableInstance = mixed;
34
+export opaque type PublicInstance = mixed;
35
+export opaque type HostContext = mixed;
36
+export opaque type UpdatePayload = mixed;
37
+export opaque type ChildSet = mixed;
38
+export opaque type TimeoutHandle = mixed;
39
+export opaque type NoTimeout = mixed;
40
+export opaque type RendererInspectionConfig = mixed;
41
+export opaque type TransitionStatus = mixed;
42
+export opaque type FormInstance = mixed;
43
export type EventResponder = any;
44
45
export const getPublicInstance = $$$config.getPublicInstance;
@@ -183,7 +183,7 @@ export const validateHydratableTextInstance =
183
// (optional)
184
// -------------------
185
export type HoistableRoot = mixed;
186
-export type Resource = mixed; // eslint-disable-line no-undef
186
+export type Resource = mixed;
187
export const supportsResources = $$$config.supportsResources;
188
export const isHostHoistableType = $$$config.isHostHoistableType;
189
export const getHoistableRoot = $$$config.getHoistableRoot;
packages/react-refresh/src/__tests__/ReactFresh-test.js
-2
@@ -7,8 +7,6 @@
7
* @emails react-core
8
*/
9
10
-/* eslint-disable no-for-of-loops/no-for-of-loops */
11
-
10
'use strict';
11
12
let React;
packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
-2
@@ -7,8 +7,6 @@
7
* @emails react-core
8
*/
9
10
-/* eslint-disable no-for-of-loops/no-for-of-loops */
11
-
10
'use strict';
11
12
let React;
packages/react-server-dom-esm/src/ReactFlightDOMServerNode.js
-1
@@ -60,7 +60,6 @@ function createDrainHandler(destination: Destination, request: Request) {
60
function createCancelHandler(request: Request, reason: string) {
61
return () => {
62
stopFlowing(request);
63
- // eslint-disable-next-line react-internal/prod-error-codes
63
abort(request, new Error(reason));
64
};
65
}
packages/react-server-dom-turbopack/src/ReactFlightDOMServerNode.js
-1
@@ -61,7 +61,6 @@ function createDrainHandler(destination: Destination, request: Request) {
61
function createCancelHandler(request: Request, reason: string) {
62
return () => {
63
stopFlowing(request);
64
- // eslint-disable-next-line react-internal/prod-error-codes
64
abort(request, new Error(reason));
65
};
66
}
packages/react-server-dom-turbopack/src/ReactFlightTurbopackNodeRegister.js
-1
@@ -43,7 +43,6 @@ module.exports = function register() {
43
sourceType: 'source',
44
}).body;
45
} catch (x) {
46
- // eslint-disable-next-line react-internal/no-production-logging
46
console['error']('Error parsing %s %s', url, x.message);
47
return originalCompile.apply(this, arguments);
48
}
packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js
-1
@@ -61,7 +61,6 @@ function createDrainHandler(destination: Destination, request: Request) {
61
function createCancelHandler(request: Request, reason: string) {
62
return () => {
63
stopFlowing(request);
64
- // eslint-disable-next-line react-internal/prod-error-codes
64
abort(request, new Error(reason));
65
};
66
}
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js
-1
@@ -43,7 +43,6 @@ module.exports = function register() {
43
sourceType: 'source',
44
}).body;
45
} catch (x) {
46
- // eslint-disable-next-line react-internal/no-production-logging
46
console['error']('Error parsing %s %s', url, x.message);
47
return originalCompile.apply(this, arguments);
48
}
packages/react-server/src/ReactFlightServerTemporaryReferences.js
-1
@@ -89,7 +89,6 @@ export function createTemporaryReference<T>(
89
const reference: TemporaryReference<any> = Object.defineProperties(
90
(function () {
91
throw new Error(
92
- // eslint-disable-next-line react-internal/safe-string-coercion
92
`Attempted to call a temporary Client Reference from the server but it is on the client. ` +
93
`It's not possible to invoke a client function from the server, it can ` +
94
`only be rendered as a Component or passed to props of a Client Component.`,
packages/react-server/src/forks/ReactFizzConfig.custom.js
+1
-1
@@ -27,7 +27,7 @@ import type {Request} from 'react-server/src/ReactFizzServer';
27
import type {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
28
29
declare const $$$config: any;
30
-export opaque type Destination = mixed; // eslint-disable-line no-undef
30
+export opaque type Destination = mixed;
31
export opaque type RenderState = mixed;
32
export opaque type HoistableState = mixed;
33
export opaque type ResumableState = mixed;
packages/react-server/src/forks/ReactServerStreamConfig.custom.js
+4
-4
@@ -24,11 +24,11 @@
24
// really an argument to a top-level wrapping function.
25
26
declare const $$$config: any;
27
-export opaque type Destination = mixed; // eslint-disable-line no-undef
27
+export opaque type Destination = mixed;
28
29
-export opaque type PrecomputedChunk = mixed; // eslint-disable-line no-undef
30
-export opaque type Chunk = mixed; // eslint-disable-line no-undef
31
-export opaque type BinaryChunk = mixed; // eslint-disable-line no-undef
29
+export opaque type PrecomputedChunk = mixed;
30
+export opaque type Chunk = mixed;
31
+export opaque type BinaryChunk = mixed;
32
33
export const scheduleWork = $$$config.scheduleWork;
34
export const scheduleMicrotask = $$$config.scheduleMicrotask;
packages/react-test-renderer/src/ReactTestRenderer.js
-3
@@ -107,11 +107,9 @@ function toJSON(inst: Instance | TextInstance): ReactTestRendererNode | null {
107
case 'TEXT':
108
return inst.text;
109
case 'INSTANCE': {
110
- /* eslint-disable no-unused-vars */
110
// We don't include the `children` prop in JSON.
111
// Instead, we will include the actual rendered children.
112
const {children, ...props} = inst.props;
114
- /* eslint-enable */
113
let renderedChildren = null;
114
if (inst.children && inst.children.length) {
115
for (let i = 0; i < inst.children.length; i++) {
@@ -656,7 +654,6 @@ injectIntoDevTools({
654
export {
655
Scheduler as _Scheduler,
656
create,
659
- /* eslint-disable-next-line camelcase */
657
batchedUpdates as unstable_batchedUpdates,
658
act,
659
};
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
-1
@@ -43,7 +43,6 @@ function cleanNodeOrArray(node) {
43
node.instance = null;
44
}
45
if (node && node.props && node.props.children) {
46
- // eslint-disable-next-line no-unused-vars
46
const {children, ...props} = node.props;
47
node.props = props;
48
}
packages/react/src/__tests__/ReactStrictMode-test.js
-6
@@ -625,7 +625,6 @@ describe('Concurrent Mode', () => {
625
async () => await act(() => root.render(<StrictRoot />)),
626
).toErrorDev(
627
[
628
- /* eslint-disable max-len */
628
`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
629
630
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -642,7 +641,6 @@ Please update the following components: Bar, Foo`,
641
* Move data fetching code or side effects to componentDidUpdate.
642
643
Please update the following components: App`,
645
- /* eslint-enable max-len */
644
],
645
{withoutStack: true},
646
);
@@ -689,7 +687,6 @@ Please update the following components: App`,
687
async () => await act(() => root.render(<StrictRoot />)),
688
).toErrorDev(
689
[
692
- /* eslint-disable max-len */
690
`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
691
692
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -706,13 +703,11 @@ Please update the following components: Child`,
703
* Move data fetching code or side effects to componentDidUpdate.
704
705
Please update the following components: App`,
709
- /* eslint-enable max-len */
706
],
707
{withoutStack: true},
708
);
709
}).toWarnDev(
710
[
715
- /* eslint-disable max-len */
711
`componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
712
713
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -732,7 +727,6 @@ Please update the following components: Parent`,
727
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
728
729
Please update the following components: Parent`,
735
- /* eslint-enable max-len */
730
],
731
{withoutStack: true},
732
);
packages/scheduler/npm/umd/scheduler.development.js
-2
@@ -7,8 +7,6 @@
7
* LICENSE file in the root directory of this source tree.
8
*/
9
10
-/* eslint-disable max-len */
11
-
10
'use strict';
11
12
(function (global, factory) {
packages/scheduler/npm/umd/scheduler.production.min.js
-2
@@ -7,8 +7,6 @@
7
* LICENSE file in the root directory of this source tree.
8
*/
9
10
-/* eslint-disable max-len */
11
-
10
'use strict';
11
12
(function (global, factory) {
packages/scheduler/npm/umd/scheduler.profiling.min.js
-2
@@ -7,8 +7,6 @@
7
* LICENSE file in the root directory of this source tree.
8
*/
9
10
-/* eslint-disable max-len */
11
-
10
'use strict';
11
12
(function (global, factory) {
packages/scheduler/src/__tests__/Scheduler-test.js
-2
@@ -8,8 +8,6 @@
8
* @jest-environment node
9
*/
10
11
-/* eslint-disable no-for-of-loops/no-for-of-loops */
12
-
11
'use strict';
12
13
let Scheduler;
packages/scheduler/src/__tests__/SchedulerSetImmediate-test.js
-2
@@ -8,8 +8,6 @@
8
* @jest-environment node
9
*/
10
11
-/* eslint-disable no-for-of-loops/no-for-of-loops */
12
-
11
'use strict';
12
13
let Scheduler;
packages/shared/ConsolePatchingDev.js
-3
@@ -52,7 +52,6 @@ export function disableLogs(): void {
52
groupCollapsed: props,
53
groupEnd: props,
54
});
55
- /* eslint-enable react-internal/no-production-logging */
55
}
56
disabledDepth++;
57
}
@@ -62,7 +61,6 @@ export function reenableLogs(): void {
61
if (__DEV__) {
62
disabledDepth--;
63
if (disabledDepth === 0) {
65
- /* eslint-disable react-internal/no-production-logging */
64
const props = {
65
configurable: true,
66
enumerable: true,
@@ -78,7 +76,6 @@ export function reenableLogs(): void {
76
groupCollapsed: {...props, value: prevGroupCollapsed},
77
groupEnd: {...props, value: prevGroupEnd},
78
});
81
- /* eslint-enable react-internal/no-production-logging */
79
}
80
if (disabledDepth < 0) {
81
console.error(
packages/shared/isArray.js
-1
@@ -11,7 +11,6 @@ declare function isArray(a: mixed): boolean %checks(Array.isArray(a));
11
12
const isArrayImpl = Array.isArray;
13
14
-// eslint-disable-next-line no-redeclare
14
function isArray(a: mixed): boolean {
15
return isArrayImpl(a);
16
}
packages/shared/reportGlobalError.js
-1
@@ -45,7 +45,6 @@ const reportGlobalError: (error: mixed) => void =
45
process.emit('uncaughtException', error);
46
return;
47
}
48
- // eslint-disable-next-line react-internal/no-production-logging
48
console['error'](error);
49
};
50
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js
-2
@@ -33,9 +33,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
33
// React 17.
34
jest.mock('react', () => {
35
const {
36
- // eslint-disable-next-line no-unused-vars
36
startTransition: _,
38
- // eslint-disable-next-line no-unused-vars
37
useSyncExternalStore: __,
38
...otherExports
39
} = jest.requireActual('react');
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShimServer-test.js
-2
@@ -32,9 +32,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
32
// React 17.
33
jest.mock('react', () => {
34
const {
35
- // eslint-disable-next-line no-unused-vars
35
startTransition: _,
37
- // eslint-disable-next-line no-unused-vars
36
useSyncExternalStore: __,
37
...otherExports
38
} = jest.requireActual('react');
scripts/babel/transform-react-version-pragma.js
-2
@@ -1,7 +1,5 @@
1
'use strict';
2
3
-/* eslint-disable no-for-of-loops/no-for-of-loops */
4
-
3
const getComments = require('./getComments');
4
5
const GATE_VERSION_STR = '@reactVersion ';
scripts/error-codes/__tests__/transform-error-messages.js
+1
-1
@@ -4,7 +4,7 @@
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
*/
7
-/* eslint-disable quotes */
7
+
8
'use strict';
9
10
let babel = require('@babel/core');
scripts/flow/react-native-host-hooks.js
+2
-2
@@ -7,8 +7,6 @@
7
* @flow
8
*/
9
10
-/* eslint-disable */
11
-
10
// libdefs cannot actually import. These are supposed to be the types imported
11
// from 'react-native-renderer/src/ReactNativeTypes'
12
type __MeasureOnSuccessCallback = any;
@@ -167,10 +165,12 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
165
declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore' {
166
}
167
168
+// eslint-disable-next-line no-unused-vars
169
declare const RN$enableMicrotasksInReact: boolean;
170
171
// This is needed for a short term solution.
172
// See https://github.com/facebook/react/pull/15490 for more info
173
+// eslint-disable-next-line no-unused-vars
174
declare const nativeFabricUIManager: {
175
createNode: (
176
reactTag: number,
scripts/jest/devtools/setupEnv.js
-1
@@ -29,7 +29,6 @@ global._test_react_version_focus = (range, testName, callback) => {
29
const shouldPass = semver.satisfies(ReactVersionTestingAgainst, range);
30
31
if (shouldPass) {
32
- // eslint-disable-next-line jest/no-focused-tests
32
test.only(testName, callback);
33
} else {
34
test.skip(testName, callback);
scripts/tasks/eslint.js
-1
@@ -17,7 +17,6 @@ async function main() {
17
console.log('Hint: run `yarn linc` to only lint changed files.');
18
}
19
20
- // eslint-disable-next-line no-unused-vars
20
const {_, ...cliOptions} = minimist(process.argv.slice(2));
21
22
if (await runESLint({onlyChanged: false, ...cliOptions})) {
scripts/tasks/linc.js
-1
@@ -13,7 +13,6 @@ const runESLint = require('../eslint');
13
async function main() {
14
console.log('Linting changed files...');
15
16
- // eslint-disable-next-line no-unused-vars
16
const {_, ...cliOptions} = minimist(process.argv.slice(2));
17
18
if (await runESLint({onlyChanged: true, ...cliOptions})) {