From 531220b94a17b5ff6ef0217536dd252640a4da54 Mon Sep 17 00:00:00 2001 From: Sophie Alpert Date: Tue, 4 Apr 2023 15:30:17 -0700 Subject: [PATCH] Remove no-fallthrough lint suppressions The lint rule already understands a normal comment. Also a bunch of these were unnecessary. --- fixtures/devtools/regression/shared.js | 2 +- .../src/client/ReactDOMComponent.js | 12 +++++------- .../src/events/ReactDOMEventListener.js | 12 ++++-------- .../src/server/ReactDOMServerFormatConfig.js | 14 ++------------ packages/react-reconciler/src/ReactFiber.js | 10 +++++----- .../react-reconciler/src/ReactFiberBeginWork.js | 4 ++-- .../src/ReactFiberCommitWork.js | 17 ++++++----------- .../src/ReactFiberCompleteWork.js | 4 ++-- .../react-reconciler/src/ReactFiberThrow.js | 2 +- .../react-reconciler/src/ReactFiberWorkLoop.js | 4 ---- packages/react-server/src/ReactFizzServer.js | 2 -- packages/shared/getComponentNameFromType.js | 3 +-- 12 files changed, 29 insertions(+), 57 deletions(-) diff --git a/fixtures/devtools/regression/shared.js b/fixtures/devtools/regression/shared.js index 0010fd7ebbb58..920bd9d130d6f 100644 --- a/fixtures/devtools/regression/shared.js +++ b/fixtures/devtools/regression/shared.js @@ -1,4 +1,4 @@ -/* eslint-disable no-fallthrough, react/react-in-jsx-scope, react/jsx-no-undef */ +/* eslint-disable react/react-in-jsx-scope, react/jsx-no-undef */ /* global React ReactCache ReactDOM SchedulerTracing ScheduleTracing */ const apps = []; diff --git a/packages/react-dom-bindings/src/client/ReactDOMComponent.js b/packages/react-dom-bindings/src/client/ReactDOMComponent.js index 20395d09ac090..b4a3d9442e432 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMComponent.js +++ b/packages/react-dom-bindings/src/client/ReactDOMComponent.js @@ -350,7 +350,6 @@ function setProp( } } // Fall through to the last case which shouldn't remove empty strings. - // eslint-disable-next-line no-fallthrough case 'formAction': { if ( value == null || @@ -663,7 +662,7 @@ function setProp( if (enableCustomElementPropertySupport) { break; } - // eslint-disable-next-line no-fallthrough + // Fall through default: { if ( key.length > 2 && @@ -761,7 +760,7 @@ function setPropOnCustomElement( if (enableCustomElementPropertySupport) { break; } - // eslint-disable-next-line no-fallthrough + // Fall through default: { if (registrationNameDependencies.hasOwnProperty(key)) { if (__DEV__ && value != null && typeof value !== 'function') { @@ -1010,7 +1009,6 @@ export function setInitialProperties( listenToNonDelegatedEvent('load', domElement); // We fallthrough to the return of the void elements } - // eslint-disable-next-line no-fallthrough case 'area': case 'base': case 'br': @@ -1174,7 +1172,7 @@ export function diffProperties( 'Cannot update the "is" prop after it has been initialized.', ); } - // eslint-disable-next-line no-fallthrough + // Fall through default: { (updatePayload = updatePayload || []).push(propKey, nextProp); } @@ -1790,7 +1788,7 @@ function diffHydratedCustomComponent( } continue; } - // eslint-disable-next-line no-fallthrough + // TODO: this fall through seems wrong case 'className': if (enableCustomElementPropertySupport) { // className is a special cased property on the server to render as an attribute. @@ -1803,7 +1801,7 @@ function diffHydratedCustomComponent( warnForPropDifference('className', serverValue, value); continue; } - // eslint-disable-next-line no-fallthrough + // Fall through default: { let ownNamespaceDev = parentNamespaceDev; if (ownNamespaceDev === HTML_NAMESPACE) { diff --git a/packages/react-dom-bindings/src/events/ReactDOMEventListener.js b/packages/react-dom-bindings/src/events/ReactDOMEventListener.js index 6fa9f1deb90c5..ab814b1b9053a 100644 --- a/packages/react-dom-bindings/src/events/ReactDOMEventListener.js +++ b/packages/react-dom-bindings/src/events/ReactDOMEventListener.js @@ -319,20 +319,17 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority { case 'touchend': case 'touchstart': case 'volumechange': - // Used by polyfills: - // eslint-disable-next-line no-fallthrough + // Used by polyfills: (fall through) case 'change': case 'selectionchange': case 'textInput': case 'compositionstart': case 'compositionend': case 'compositionupdate': - // Only enableCreateEventHandleAPI: - // eslint-disable-next-line no-fallthrough + // Only enableCreateEventHandleAPI: (fall through) case 'beforeblur': case 'afterblur': - // Not used by React but could be by user code: - // eslint-disable-next-line no-fallthrough + // Not used by React but could be by user code: (fall through) case 'beforeinput': case 'blur': case 'fullscreenchange': @@ -357,8 +354,7 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority { case 'toggle': case 'touchmove': case 'wheel': - // Not used by React but could be by user code: - // eslint-disable-next-line no-fallthrough + // Not used by React but could be by user code: (fall through) case 'mouseenter': case 'mouseleave': case 'pointerenter': diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js index 2df5fb332fa1d..9f1aba93a9a21 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js @@ -693,7 +693,6 @@ function pushAttribute( } } // Fall through to the last case which shouldn't remove empty strings. - // eslint-disable-next-line no-fallthrough case 'formAction': { if ( value == null || @@ -1123,11 +1122,9 @@ function pushStartOption( case 'dangerouslySetInnerHTML': innerHTML = propValue; break; - // eslint-disable-next-line-no-fallthrough case 'value': value = propValue; // We intentionally fallthrough to also set the attribute on the node. - // eslint-disable-next-line-no-fallthrough default: pushAttribute(target, propKey, propValue); break; @@ -1248,7 +1245,6 @@ function pushInput( `${'input'} is a self-closing tag and must neither have \`children\` nor ` + 'use `dangerouslySetInnerHTML`.', ); - // eslint-disable-next-line-no-fallthrough case 'defaultChecked': defaultChecked = propValue; break; @@ -1330,7 +1326,6 @@ function pushStartTextArea( throw new Error( '`dangerouslySetInnerHTML` does not make sense on