lint: enable reportUnusedDisableDirectives and remove unused suppressions (#28721)

This enables linting against unused suppressions and removes the ones
that were unused.
This commit is contained in:
Jan Kassens
2024-06-21 12:24:32 -04:00
committed by GitHub
parent adeab68a88
commit 1e7da759a8
66 changed files with 44 additions and 148 deletions
+2
View File
@@ -17,6 +17,8 @@ module.exports = {
// Stop ESLint from looking for a configuration file in parent folders
root: true,
reportUnusedDisableDirectives: true,
plugins: [
'babel',
'ft-flow',
-2
View File
@@ -1839,7 +1839,6 @@ function resolveHint<Code: HintCode>(
dispatchHint(code, hintModel);
}
// eslint-disable-next-line react-internal/no-production-logging
const supportsCreateTask =
__DEV__ && enableOwnerStacks && !!(console: any).createTask;
@@ -1977,7 +1976,6 @@ function initializeFakeTask(
? null
: initializeFakeTask(response, componentInfo.owner);
// eslint-disable-next-line react-internal/no-production-logging
const createTaskFn = (console: any).createTask.bind(
console,
getServerComponentTaskName(componentInfo),
-11
View File
@@ -227,14 +227,11 @@ export function processReply(
function progress(entry: {done: boolean, value: ReactServerValue, ...}) {
if (entry.done) {
const blobId = nextPartId++;
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + blobId, new Blob(buffer));
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(
formFieldPrefix + streamId,
'"$o' + blobId.toString(16) + '"',
);
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + streamId, 'C'); // Close signal
pendingParts--;
if (pendingParts === 0) {
@@ -262,7 +259,6 @@ export function processReply(
function progress(entry: {done: boolean, value: ReactServerValue, ...}) {
if (entry.done) {
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + streamId, 'C'); // Close signal
pendingParts--;
if (pendingParts === 0) {
@@ -272,7 +268,6 @@ export function processReply(
try {
// $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here.
const partJSON: string = JSON.stringify(entry.value, resolveToJSON);
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + streamId, partJSON);
reader.read().then(progress, reject);
} catch (x) {
@@ -326,7 +321,6 @@ export function processReply(
) {
if (entry.done) {
if (entry.value === undefined) {
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + streamId, 'C'); // Close signal
} else {
// Unlike streams, the last value may not be undefined. If it's not
@@ -348,7 +342,6 @@ export function processReply(
try {
// $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here.
const partJSON: string = JSON.stringify(entry.value, resolveToJSON);
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + streamId, partJSON);
iterator.next().then(progress, reject);
} catch (x) {
@@ -441,7 +434,6 @@ export function processReply(
const partJSON = serializeModel(resolvedModel, lazyId);
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
const data: FormData = formData;
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + lazyId, partJSON);
return serializeByValueID(lazyId);
} catch (x) {
@@ -461,7 +453,6 @@ export function processReply(
const partJSON = serializeModel(value, lazyId);
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
const data: FormData = formData;
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + lazyId, partJSON);
pendingParts--;
if (pendingParts === 0) {
@@ -502,7 +493,6 @@ export function processReply(
const partJSON = serializeModel(partValue, promiseId);
// $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
const data: FormData = formData;
// eslint-disable-next-line react-internal/safe-string-coercion
data.append(formFieldPrefix + promiseId, partJSON);
pendingParts--;
if (pendingParts === 0) {
@@ -784,7 +774,6 @@ export function processReply(
}
// The reference to this function came from the same client so we can pass it back.
const refId = nextPartId++;
// eslint-disable-next-line react-internal/safe-string-coercion
formData.set(formFieldPrefix + refId, metaDataJSON);
return serializeServerReferenceID(refId);
}
@@ -42,7 +42,7 @@ export const usedWithSSR = true;
export opaque type Source = mixed;
export opaque type StringDecoder = mixed; // eslint-disable-line no-undef
export opaque type StringDecoder = mixed;
export const createStringDecoder = $$$config.createStringDecoder;
export const readPartialStringChunk = $$$config.readPartialStringChunk;
-5
View File
@@ -146,13 +146,11 @@ type JestPromiseType = {
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
// eslint-disable-next-line no-use-before-define
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
// eslint-disable-next-line no-use-before-define
resolves: JestExpectType,
};
@@ -1098,10 +1096,8 @@ type JestPrettyFormatColors = {
};
type JestPrettyFormatIndent = string => string;
// eslint-disable-next-line no-unused-vars
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = any => string;
// eslint-disable-next-line no-unused-vars
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {
@@ -1112,7 +1108,6 @@ type JestPrettyFormatOptions = {
indent: number,
maxDepth: number,
min: boolean,
// eslint-disable-next-line no-use-before-define
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
@@ -52,7 +52,6 @@ type TestRendererOptions = {
};
declare module 'react-test-renderer' {
// eslint-disable-next-line no-inner-declarations
declare export type ReactTestRenderer = {
toJSON(): null | ReactTestRendererJSON,
toTree(): null | ReactTestRendererTree,
@@ -7,7 +7,6 @@ const config = require('../../playwright.config');
const {test} = require('@playwright/test');
function runOnlyForReactRange(range) {
// eslint-disable-next-line jest/no-disabled-tests
test.skip(
!semver.satisfies(config.use.react_version, range),
`This test requires a React version of ${range} to run. ` +
@@ -665,7 +665,6 @@ describe('InspectedElement', () => {
anonymous_fn={instance.anonymousFunction}
array_buffer={arrayBuffer}
array_of_arrays={arrayOfArrays}
// eslint-disable-next-line no-undef
big_int={BigInt(123)}
bound_fn={exampleFunction.bind(this)}
data_view={dataView}
@@ -1876,7 +1875,7 @@ describe('InspectedElement', () => {
xyz: 1,
},
});
const bigInt = BigInt(123); // eslint-disable-line no-undef
const bigInt = BigInt(123);
await utils.actAsync(() =>
render(
@@ -185,7 +185,6 @@ describe('InspectedElementContext', () => {
anonymous_fn: instance.anonymousFunction,
array_buffer: arrayBuffer,
array_of_arrays: arrayOfArrays,
// eslint-disable-next-line no-undef
big_int: BigInt(123),
bound_fn: exampleFunction.bind(this),
data_view: dataView,
@@ -888,7 +887,7 @@ describe('InspectedElementContext', () => {
xyz: 1,
},
});
const bigInt = BigInt(123); // eslint-disable-line no-undef
const bigInt = BigInt(123);
act(() =>
ReactDOM.render(
@@ -30,7 +30,6 @@ disabledLog.__reactDisabledLog = true;
export function disableLogs(): void {
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
prevLog = console.log;
prevInfo = console.info;
prevWarn = console.warn;
@@ -63,7 +62,6 @@ export function disableLogs(): void {
export function reenableLogs(): void {
disabledDepth--;
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
const props = {
configurable: true,
enumerable: true,
@@ -1604,7 +1604,6 @@ export function attach(
return changedKeys;
}
// eslint-disable-next-line no-unused-vars
function didFiberRender(prevFiber: Fiber, nextFiber: Fiber): boolean {
switch (nextFiber.tag) {
case ClassComponent:
@@ -31,7 +31,7 @@ const immutable = Immutable.fromJS({
xyz: 1,
},
});
const bigInt = BigInt(123); // eslint-disable-line no-undef
const bigInt = BigInt(123);
class Foo {
flag = false;
+1 -1
View File
@@ -46,7 +46,7 @@ app.on('ready', function () {
});
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/app.html'); // eslint-disable-line no-path-concat
mainWindow.loadURL('file://' + __dirname + '/app.html');
// $FlowFixMe[incompatible-use] found when upgrading Flow
mainWindow.webContents.executeJavaScript(
// We use this so that RN can keep relative JSX __source filenames
@@ -30,7 +30,7 @@ export function getValueForAttribute(
// shouldRemoveAttribute
switch (typeof expected) {
case 'function':
case 'symbol': // eslint-disable-line
case 'symbol':
return expected;
case 'boolean': {
const prefix = name.toLowerCase().slice(0, 5);
@@ -109,7 +109,7 @@ export function setValueForAttribute(
switch (typeof value) {
case 'undefined':
case 'function':
case 'symbol': // eslint-disable-line
case 'symbol':
node.removeAttribute(name);
return;
case 'boolean': {
@@ -443,7 +443,7 @@ export function createInstance(
didWarnScriptTags = true;
}
}
div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
div.innerHTML = '<script><' + '/script>';
// This is guaranteed to yield a script element.
const firstChild = ((div.firstChild: any): HTMLScriptElement);
domElement = div.removeChild(firstChild);
@@ -516,7 +516,6 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
return true;
}
// eslint-disable-next-line react-internal/safe-string-coercion
const warnKey = '#text|' + parentTag;
if (didWarn[warnKey]) {
return false;
@@ -1464,7 +1464,7 @@ function pushAttribute(
// shouldRemoveAttribute
switch (typeof value) {
case 'function':
case 'symbol': // eslint-disable-line
case 'symbol':
return;
case 'boolean': {
const prefix = attributeName.toLowerCase().slice(0, 5);
@@ -2808,7 +2808,6 @@ function pushStyleImpl(
child !== null &&
child !== undefined
) {
// eslint-disable-next-line react-internal/safe-string-coercion
target.push(stringToChunk(escapeStyleTextContent(child)));
}
pushInnerHTML(target, innerHTML, children);
@@ -2850,7 +2849,6 @@ function pushStyleContents(
child !== null &&
child !== undefined
) {
// eslint-disable-next-line react-internal/safe-string-coercion
target.push(stringToChunk(escapeStyleTextContent(child)));
}
pushInnerHTML(target, innerHTML, children);
@@ -271,7 +271,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
}
}
case 'function':
case 'symbol': // eslint-disable-line
case 'symbol':
// Warn when a known attribute is a bad type
warnedProperties[name] = true;
return false;
@@ -9,10 +9,8 @@
import hasOwnProperty from 'shared/hasOwnProperty';
/* eslint-disable max-len */
const ATTRIBUTE_NAME_START_CHAR =
':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';
/* eslint-enable max-len */
export const ATTRIBUTE_NAME_CHAR: string =
ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
-1
View File
@@ -16,7 +16,6 @@
// INFORMATION SEPARATOR ONE, inclusive:
// https://infra.spec.whatwg.org/#c0-control-or-space
/* eslint-disable max-len */
const isJavaScriptProtocol =
/^[\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;
@@ -468,7 +468,6 @@ describe('ReactComponent', () => {
root.unmount();
});
/* eslint-disable indent */
expect(log).toEqual([
'start mount',
'inner 1 render',
@@ -497,7 +496,6 @@ describe('ReactComponent', () => {
'ref 2 got null',
'inner 2 componentWillUnmount',
]);
/* eslint-enable indent */
});
// @gate !disableLegacyMode
@@ -1503,7 +1503,6 @@ describe('ReactComponentLifeCycle', () => {
});
}).toWarnDev(
[
/* eslint-disable max-len */
`componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -1523,7 +1522,6 @@ Please update the following components: MyComponent`,
* 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.
Please update the following components: MyComponent`,
/* eslint-enable max-len */
],
{withoutStack: true},
);
@@ -744,7 +744,7 @@ describe('ReactDOMServerIntegration', () => {
'a div with a single child surrounded by whitespace',
async render => {
// prettier-ignore
const e = await render(<div id="parent"> <div id="child" /> </div>); // eslint-disable-line no-multi-spaces
const e = await render(<div id="parent"> <div id="child" /> </div>);
expect(e.childNodes.length).toBe(3);
const textNode1 = e.childNodes[0];
const child = e.childNodes[1];
@@ -310,13 +310,13 @@ describe('ReactDOMServerIntegration', () => {
<div id="child2" />
</div>,
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
));
it('should error reconnecting a div with children separated by different whitespace on the server', () =>
expectMarkupMismatch(
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
<div id="parent">
<div id="child1" />
<div id="child2" />
@@ -329,7 +329,7 @@ describe('ReactDOMServerIntegration', () => {
<div id="child1" /> <div id="child2" />
</div>,
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
));
it('can distinguish an empty component from a dom node', () =>
@@ -652,7 +652,6 @@ describe('ReactLegacyUpdates', () => {
});
});
/* eslint-disable indent */
expect(updates).toEqual([
'Outer-render-0',
'Inner-render-0-0',
@@ -681,7 +680,6 @@ describe('ReactLegacyUpdates', () => {
'Inner-didUpdate-2-2',
'Inner-callback-2',
]);
/* eslint-enable indent */
});
// @gate !disableLegacyMode
-2
View File
@@ -760,7 +760,6 @@ describe('ReactUpdates', () => {
});
});
/* eslint-disable indent */
expect(updates).toEqual([
'Outer-render-0',
'Inner-render-0-0',
@@ -789,7 +788,6 @@ describe('ReactUpdates', () => {
'Inner-didUpdate-2-2',
'Inner-callback-2',
]);
/* eslint-enable indent */
});
it('should flush updates in the correct order across roots', async () => {
-2
View File
@@ -90,9 +90,7 @@ function createPortal(
// Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
declare function flushSyncFromReconciler<R>(fn: () => R): R;
// eslint-disable-next-line no-redeclare
declare function flushSyncFromReconciler(): void;
// eslint-disable-next-line no-redeclare
function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
if (__DEV__) {
if (isAlreadyRendering()) {
-1
View File
@@ -10,7 +10,6 @@
import type {ReactNativeType} from './src/ReactNativeTypes';
import * as ReactNative from './src/ReactNativeRenderer';
// Assert that the exports line up with the type we're going to expose.
// eslint-disable-next-line ft-flow/no-unused-expressions
(ReactNative: ReactNativeType);
export * from './src/ReactNativeRenderer';
-1
View File
@@ -971,7 +971,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
function onRecoverableError(error) {
// TODO: Turn this on once tests are fixed
// eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args
// console.error(error);
}
+2 -2
View File
@@ -125,10 +125,10 @@ if (__DEV__) {
hasBadMapPolyfill = false;
try {
const nonExtensibleObject = Object.preventExtensions({});
/* eslint-disable no-new */
// eslint-disable-next-line no-new
new Map([[nonExtensibleObject, null]]);
// eslint-disable-next-line no-new
new Set([nonExtensibleObject]);
/* eslint-enable no-new */
} catch (e) {
// TODO: Consider warning about bad polyfills
hasBadMapPolyfill = true;
+1 -1
View File
@@ -619,7 +619,7 @@ function constructClassInstance(
) {
setIsStrictModeForDevtools(true);
try {
instance = new ctor(props, context); // eslint-disable-line no-new
instance = new ctor(props, context);
} finally {
setIsStrictModeForDevtools(false);
}
-3
View File
@@ -1507,11 +1507,8 @@ export function discreteUpdates<A, B, C, D, R>(
// Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars
declare function flushSyncFromReconciler<R>(fn: () => R): R;
// eslint-disable-next-line no-redeclare
declare function flushSyncFromReconciler(void): void;
// eslint-disable-next-line no-redeclare
export function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
// In legacy mode, we flush pending passive effects at the beginning of the
// next event, not at the end of the previous one.
@@ -8,8 +8,6 @@
* @jest-environment node
*/
/* eslint-disable no-func-assign */
'use strict';
let React;
@@ -1563,7 +1563,6 @@ describe('ReactHooks', () => {
it(`warns on using differently ordered hooks (${hookNameA}, ${hookNameB}) on subsequent renders`, async () => {
function App(props) {
/* eslint-disable no-unused-vars */
if (props.update) {
secondHelper();
firstHelper();
@@ -1574,7 +1573,6 @@ describe('ReactHooks', () => {
// This should not appear in the warning message because it occurs after the first mismatch
useRefHelper();
return null;
/* eslint-enable no-unused-vars */
}
let root;
await act(() => {
@@ -1616,7 +1614,6 @@ describe('ReactHooks', () => {
it(`warns when more hooks (${hookNameA}, ${hookNameB}) are used during update than mount`, async () => {
function App(props) {
/* eslint-disable no-unused-vars */
if (props.update) {
firstHelper();
secondHelper();
@@ -1624,7 +1621,6 @@ describe('ReactHooks', () => {
firstHelper();
}
return null;
/* eslint-enable no-unused-vars */
}
let root;
await act(() => {
@@ -1671,7 +1667,6 @@ describe('ReactHooks', () => {
it(`warns when fewer hooks (${hookNameA}, ${hookNameB}) are used during update than mount`, async () => {
function App(props) {
/* eslint-disable no-unused-vars */
if (props.update) {
firstHelper();
} else {
@@ -1679,7 +1674,6 @@ describe('ReactHooks', () => {
secondHelper();
}
return null;
/* eslint-enable no-unused-vars */
}
let root;
await act(() => {
@@ -1701,7 +1695,6 @@ describe('ReactHooks', () => {
'(useImperativeHandleHelper, useMemoHelper) on subsequent renders',
async () => {
function App(props) {
/* eslint-disable no-unused-vars */
if (props.update) {
useMemoHelper();
useImperativeHandleHelper();
@@ -1712,7 +1705,6 @@ describe('ReactHooks', () => {
// This should not appear in the warning message because it occurs after the first mismatch
useRefHelper();
return null;
/* eslint-enable no-unused-vars */
}
let root;
await act(() => {
@@ -1753,7 +1745,6 @@ describe('ReactHooks', () => {
useState(0);
}
function App(props) {
/* eslint-disable no-unused-vars */
if (props.update) {
useCustomHook();
useReducer((s, a) => a, 0);
@@ -1763,7 +1754,6 @@ describe('ReactHooks', () => {
useCustomHook();
}
return null;
/* eslint-enable no-unused-vars */
}
let root;
await act(() => {
@@ -8,8 +8,6 @@
* @jest-environment node
*/
/* eslint-disable no-func-assign */
'use strict';
import {useInsertionEffect} from 'react';
@@ -8,8 +8,6 @@
* @jest-environment node
*/
/* eslint-disable no-func-assign */
'use strict';
describe('useRef', () => {
@@ -24,22 +24,22 @@
// really an argument to a top-level wrapping function.
declare const $$$config: any;
export opaque type Type = mixed; // eslint-disable-line no-undef
export opaque type Props = mixed; // eslint-disable-line no-undef
export opaque type Container = mixed; // eslint-disable-line no-undef
export opaque type Instance = mixed; // eslint-disable-line no-undef
export opaque type TextInstance = mixed; // eslint-disable-line no-undef
export opaque type SuspenseInstance = mixed; // eslint-disable-line no-undef
export opaque type HydratableInstance = mixed; // eslint-disable-line no-undef
export opaque type PublicInstance = mixed; // eslint-disable-line no-undef
export opaque type HostContext = mixed; // eslint-disable-line no-undef
export opaque type UpdatePayload = mixed; // eslint-disable-line no-undef
export opaque type ChildSet = mixed; // eslint-disable-line no-undef
export opaque type TimeoutHandle = mixed; // eslint-disable-line no-undef
export opaque type NoTimeout = mixed; // eslint-disable-line no-undef
export opaque type RendererInspectionConfig = mixed; // eslint-disable-line no-undef
export opaque type TransitionStatus = mixed; // eslint-disable-line no-undef
export opaque type FormInstance = mixed; // eslint-disable-line no-undef
export opaque type Type = mixed;
export opaque type Props = mixed;
export opaque type Container = mixed;
export opaque type Instance = mixed;
export opaque type TextInstance = mixed;
export opaque type SuspenseInstance = mixed;
export opaque type HydratableInstance = mixed;
export opaque type PublicInstance = mixed;
export opaque type HostContext = mixed;
export opaque type UpdatePayload = mixed;
export opaque type ChildSet = mixed;
export opaque type TimeoutHandle = mixed;
export opaque type NoTimeout = mixed;
export opaque type RendererInspectionConfig = mixed;
export opaque type TransitionStatus = mixed;
export opaque type FormInstance = mixed;
export type EventResponder = any;
export const getPublicInstance = $$$config.getPublicInstance;
@@ -183,7 +183,7 @@ export const validateHydratableTextInstance =
// (optional)
// -------------------
export type HoistableRoot = mixed;
export type Resource = mixed; // eslint-disable-line no-undef
export type Resource = mixed;
export const supportsResources = $$$config.supportsResources;
export const isHostHoistableType = $$$config.isHostHoistableType;
export const getHoistableRoot = $$$config.getHoistableRoot;
@@ -7,8 +7,6 @@
* @emails react-core
*/
/* eslint-disable no-for-of-loops/no-for-of-loops */
'use strict';
let React;
@@ -7,8 +7,6 @@
* @emails react-core
*/
/* eslint-disable no-for-of-loops/no-for-of-loops */
'use strict';
let React;
@@ -60,7 +60,6 @@ function createDrainHandler(destination: Destination, request: Request) {
function createCancelHandler(request: Request, reason: string) {
return () => {
stopFlowing(request);
// eslint-disable-next-line react-internal/prod-error-codes
abort(request, new Error(reason));
};
}
@@ -61,7 +61,6 @@ function createDrainHandler(destination: Destination, request: Request) {
function createCancelHandler(request: Request, reason: string) {
return () => {
stopFlowing(request);
// eslint-disable-next-line react-internal/prod-error-codes
abort(request, new Error(reason));
};
}
@@ -43,7 +43,6 @@ module.exports = function register() {
sourceType: 'source',
}).body;
} catch (x) {
// eslint-disable-next-line react-internal/no-production-logging
console['error']('Error parsing %s %s', url, x.message);
return originalCompile.apply(this, arguments);
}
@@ -61,7 +61,6 @@ function createDrainHandler(destination: Destination, request: Request) {
function createCancelHandler(request: Request, reason: string) {
return () => {
stopFlowing(request);
// eslint-disable-next-line react-internal/prod-error-codes
abort(request, new Error(reason));
};
}
@@ -43,7 +43,6 @@ module.exports = function register() {
sourceType: 'source',
}).body;
} catch (x) {
// eslint-disable-next-line react-internal/no-production-logging
console['error']('Error parsing %s %s', url, x.message);
return originalCompile.apply(this, arguments);
}
@@ -89,7 +89,6 @@ export function createTemporaryReference<T>(
const reference: TemporaryReference<any> = Object.defineProperties(
(function () {
throw new Error(
// eslint-disable-next-line react-internal/safe-string-coercion
`Attempted to call a temporary Client Reference from the server but it is on the client. ` +
`It's not possible to invoke a client function from the server, it can ` +
`only be rendered as a Component or passed to props of a Client Component.`,
@@ -27,7 +27,7 @@ import type {Request} from 'react-server/src/ReactFizzServer';
import type {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
declare const $$$config: any;
export opaque type Destination = mixed; // eslint-disable-line no-undef
export opaque type Destination = mixed;
export opaque type RenderState = mixed;
export opaque type HoistableState = mixed;
export opaque type ResumableState = mixed;
@@ -24,11 +24,11 @@
// really an argument to a top-level wrapping function.
declare const $$$config: any;
export opaque type Destination = mixed; // eslint-disable-line no-undef
export opaque type Destination = mixed;
export opaque type PrecomputedChunk = mixed; // eslint-disable-line no-undef
export opaque type Chunk = mixed; // eslint-disable-line no-undef
export opaque type BinaryChunk = mixed; // eslint-disable-line no-undef
export opaque type PrecomputedChunk = mixed;
export opaque type Chunk = mixed;
export opaque type BinaryChunk = mixed;
export const scheduleWork = $$$config.scheduleWork;
export const scheduleMicrotask = $$$config.scheduleMicrotask;
-3
View File
@@ -107,11 +107,9 @@ function toJSON(inst: Instance | TextInstance): ReactTestRendererNode | null {
case 'TEXT':
return inst.text;
case 'INSTANCE': {
/* eslint-disable no-unused-vars */
// We don't include the `children` prop in JSON.
// Instead, we will include the actual rendered children.
const {children, ...props} = inst.props;
/* eslint-enable */
let renderedChildren = null;
if (inst.children && inst.children.length) {
for (let i = 0; i < inst.children.length; i++) {
@@ -656,7 +654,6 @@ injectIntoDevTools({
export {
Scheduler as _Scheduler,
create,
/* eslint-disable-next-line camelcase */
batchedUpdates as unstable_batchedUpdates,
act,
};
@@ -43,7 +43,6 @@ function cleanNodeOrArray(node) {
node.instance = null;
}
if (node && node.props && node.props.children) {
// eslint-disable-next-line no-unused-vars
const {children, ...props} = node.props;
node.props = props;
}
@@ -625,7 +625,6 @@ describe('Concurrent Mode', () => {
async () => await act(() => root.render(<StrictRoot />)),
).toErrorDev(
[
/* eslint-disable max-len */
`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.
* 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`,
* Move data fetching code or side effects to componentDidUpdate.
Please update the following components: App`,
/* eslint-enable max-len */
],
{withoutStack: true},
);
@@ -689,7 +687,6 @@ Please update the following components: App`,
async () => await act(() => root.render(<StrictRoot />)),
).toErrorDev(
[
/* eslint-disable max-len */
`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.
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -706,13 +703,11 @@ Please update the following components: Child`,
* Move data fetching code or side effects to componentDidUpdate.
Please update the following components: App`,
/* eslint-enable max-len */
],
{withoutStack: true},
);
}).toWarnDev(
[
/* eslint-disable max-len */
`componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor.
@@ -732,7 +727,6 @@ Please update the following components: Parent`,
* 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.
Please update the following components: Parent`,
/* eslint-enable max-len */
],
{withoutStack: true},
);
@@ -7,8 +7,6 @@
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable max-len */
'use strict';
(function (global, factory) {
@@ -7,8 +7,6 @@
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable max-len */
'use strict';
(function (global, factory) {
-2
View File
@@ -7,8 +7,6 @@
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable max-len */
'use strict';
(function (global, factory) {
@@ -8,8 +8,6 @@
* @jest-environment node
*/
/* eslint-disable no-for-of-loops/no-for-of-loops */
'use strict';
let Scheduler;
@@ -8,8 +8,6 @@
* @jest-environment node
*/
/* eslint-disable no-for-of-loops/no-for-of-loops */
'use strict';
let Scheduler;
-3
View File
@@ -52,7 +52,6 @@ export function disableLogs(): void {
groupCollapsed: props,
groupEnd: props,
});
/* eslint-enable react-internal/no-production-logging */
}
disabledDepth++;
}
@@ -62,7 +61,6 @@ export function reenableLogs(): void {
if (__DEV__) {
disabledDepth--;
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
const props = {
configurable: true,
enumerable: true,
@@ -78,7 +76,6 @@ export function reenableLogs(): void {
groupCollapsed: {...props, value: prevGroupCollapsed},
groupEnd: {...props, value: prevGroupEnd},
});
/* eslint-enable react-internal/no-production-logging */
}
if (disabledDepth < 0) {
console.error(
-1
View File
@@ -11,7 +11,6 @@ declare function isArray(a: mixed): boolean %checks(Array.isArray(a));
const isArrayImpl = Array.isArray;
// eslint-disable-next-line no-redeclare
function isArray(a: mixed): boolean {
return isArrayImpl(a);
}
-1
View File
@@ -45,7 +45,6 @@ const reportGlobalError: (error: mixed) => void =
process.emit('uncaughtException', error);
return;
}
// eslint-disable-next-line react-internal/no-production-logging
console['error'](error);
};
@@ -33,9 +33,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
// React 17.
jest.mock('react', () => {
const {
// eslint-disable-next-line no-unused-vars
startTransition: _,
// eslint-disable-next-line no-unused-vars
useSyncExternalStore: __,
...otherExports
} = jest.requireActual('react');
@@ -32,9 +32,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
// React 17.
jest.mock('react', () => {
const {
// eslint-disable-next-line no-unused-vars
startTransition: _,
// eslint-disable-next-line no-unused-vars
useSyncExternalStore: __,
...otherExports
} = jest.requireActual('react');
@@ -1,7 +1,5 @@
'use strict';
/* eslint-disable no-for-of-loops/no-for-of-loops */
const getComments = require('./getComments');
const GATE_VERSION_STR = '@reactVersion ';
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable quotes */
'use strict';
let babel = require('@babel/core');
+2 -2
View File
@@ -7,8 +7,6 @@
* @flow
*/
/* eslint-disable */
// libdefs cannot actually import. These are supposed to be the types imported
// from 'react-native-renderer/src/ReactNativeTypes'
type __MeasureOnSuccessCallback = any;
@@ -167,10 +165,12 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore' {
}
// eslint-disable-next-line no-unused-vars
declare const RN$enableMicrotasksInReact: boolean;
// This is needed for a short term solution.
// See https://github.com/facebook/react/pull/15490 for more info
// eslint-disable-next-line no-unused-vars
declare const nativeFabricUIManager: {
createNode: (
reactTag: number,
-1
View File
@@ -29,7 +29,6 @@ global._test_react_version_focus = (range, testName, callback) => {
const shouldPass = semver.satisfies(ReactVersionTestingAgainst, range);
if (shouldPass) {
// eslint-disable-next-line jest/no-focused-tests
test.only(testName, callback);
} else {
test.skip(testName, callback);
-1
View File
@@ -17,7 +17,6 @@ async function main() {
console.log('Hint: run `yarn linc` to only lint changed files.');
}
// eslint-disable-next-line no-unused-vars
const {_, ...cliOptions} = minimist(process.argv.slice(2));
if (await runESLint({onlyChanged: false, ...cliOptions})) {
-1
View File
@@ -13,7 +13,6 @@ const runESLint = require('../eslint');
async function main() {
console.log('Linting changed files...');
// eslint-disable-next-line no-unused-vars
const {_, ...cliOptions} = minimist(process.argv.slice(2));
if (await runESLint({onlyChanged: true, ...cliOptions})) {