Skip to content

Commit 5f06848

Browse files
committed
Revert "Remove no-fallthrough lint suppressions (facebook#26553)"
This reverts commit 790ebc9.
1 parent cc958d2 commit 5f06848

File tree

12 files changed

+57
-29
lines changed

12 files changed

+57
-29
lines changed

fixtures/devtools/regression/shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable react/react-in-jsx-scope, react/jsx-no-undef */
1+
/* eslint-disable no-fallthrough, react/react-in-jsx-scope, react/jsx-no-undef */
22
/* global React ReactCache ReactDOM SchedulerTracing ScheduleTracing */
33

44
const apps = [];

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ function setProp(
350350
}
351351
}
352352
// Fall through to the last case which shouldn't remove empty strings.
353+
// eslint-disable-next-line no-fallthrough
353354
case 'formAction': {
354355
if (
355356
value == null ||
@@ -662,7 +663,7 @@ function setProp(
662663
if (enableCustomElementPropertySupport) {
663664
break;
664665
}
665-
// Fall through
666+
// eslint-disable-next-line no-fallthrough
666667
default: {
667668
if (
668669
key.length > 2 &&
@@ -760,7 +761,7 @@ function setPropOnCustomElement(
760761
if (enableCustomElementPropertySupport) {
761762
break;
762763
}
763-
// Fall through
764+
// eslint-disable-next-line no-fallthrough
764765
default: {
765766
if (registrationNameDependencies.hasOwnProperty(key)) {
766767
if (__DEV__ && value != null && typeof value !== 'function') {
@@ -1009,6 +1010,7 @@ export function setInitialProperties(
10091010
listenToNonDelegatedEvent('load', domElement);
10101011
// We fallthrough to the return of the void elements
10111012
}
1013+
// eslint-disable-next-line no-fallthrough
10121014
case 'area':
10131015
case 'base':
10141016
case 'br':
@@ -1172,7 +1174,7 @@ export function diffProperties(
11721174
'Cannot update the "is" prop after it has been initialized.',
11731175
);
11741176
}
1175-
// Fall through
1177+
// eslint-disable-next-line no-fallthrough
11761178
default: {
11771179
(updatePayload = updatePayload || []).push(propKey, nextProp);
11781180
}
@@ -1788,7 +1790,7 @@ function diffHydratedCustomComponent(
17881790
}
17891791
continue;
17901792
}
1791-
// Fall through
1793+
// eslint-disable-next-line no-fallthrough
17921794
case 'className':
17931795
if (enableCustomElementPropertySupport) {
17941796
// className is a special cased property on the server to render as an attribute.
@@ -1801,7 +1803,7 @@ function diffHydratedCustomComponent(
18011803
warnForPropDifference('className', serverValue, value);
18021804
continue;
18031805
}
1804-
// Fall through
1806+
// eslint-disable-next-line no-fallthrough
18051807
default: {
18061808
let ownNamespaceDev = parentNamespaceDev;
18071809
if (ownNamespaceDev === HTML_NAMESPACE) {

packages/react-dom-bindings/src/events/ReactDOMEventListener.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,20 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority {
319319
case 'touchend':
320320
case 'touchstart':
321321
case 'volumechange':
322-
// Used by polyfills: (fall through)
322+
// Used by polyfills:
323+
// eslint-disable-next-line no-fallthrough
323324
case 'change':
324325
case 'selectionchange':
325326
case 'textInput':
326327
case 'compositionstart':
327328
case 'compositionend':
328329
case 'compositionupdate':
329-
// Only enableCreateEventHandleAPI: (fall through)
330+
// Only enableCreateEventHandleAPI:
331+
// eslint-disable-next-line no-fallthrough
330332
case 'beforeblur':
331333
case 'afterblur':
332-
// Not used by React but could be by user code: (fall through)
334+
// Not used by React but could be by user code:
335+
// eslint-disable-next-line no-fallthrough
333336
case 'beforeinput':
334337
case 'blur':
335338
case 'fullscreenchange':
@@ -354,7 +357,8 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority {
354357
case 'toggle':
355358
case 'touchmove':
356359
case 'wheel':
357-
// Not used by React but could be by user code: (fall through)
360+
// Not used by React but could be by user code:
361+
// eslint-disable-next-line no-fallthrough
358362
case 'mouseenter':
359363
case 'mouseleave':
360364
case 'pointerenter':

packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ function pushAttribute(
693693
}
694694
}
695695
// Fall through to the last case which shouldn't remove empty strings.
696+
// eslint-disable-next-line no-fallthrough
696697
case 'formAction': {
697698
if (
698699
value == null ||
@@ -1122,9 +1123,11 @@ function pushStartOption(
11221123
case 'dangerouslySetInnerHTML':
11231124
innerHTML = propValue;
11241125
break;
1126+
// eslint-disable-next-line-no-fallthrough
11251127
case 'value':
11261128
value = propValue;
11271129
// We intentionally fallthrough to also set the attribute on the node.
1130+
// eslint-disable-next-line-no-fallthrough
11281131
default:
11291132
pushAttribute(target, propKey, propValue);
11301133
break;
@@ -1245,6 +1248,7 @@ function pushInput(
12451248
`${'input'} is a self-closing tag and must neither have \`children\` nor ` +
12461249
'use `dangerouslySetInnerHTML`.',
12471250
);
1251+
// eslint-disable-next-line-no-fallthrough
12481252
case 'defaultChecked':
12491253
defaultChecked = propValue;
12501254
break;
@@ -1326,6 +1330,7 @@ function pushStartTextArea(
13261330
throw new Error(
13271331
'`dangerouslySetInnerHTML` does not make sense on <textarea>.',
13281332
);
1333+
// eslint-disable-next-line-no-fallthrough
13291334
default:
13301335
pushAttribute(target, propKey, propValue);
13311336
break;
@@ -1672,6 +1677,7 @@ function pushLinkImpl(
16721677
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
16731678
'use `dangerouslySetInnerHTML`.',
16741679
);
1680+
// eslint-disable-next-line-no-fallthrough
16751681
default:
16761682
pushAttribute(target, propKey, propValue);
16771683
break;
@@ -1900,6 +1906,7 @@ function pushSelfClosing(
19001906
`${tag} is a self-closing tag and must neither have \`children\` nor ` +
19011907
'use `dangerouslySetInnerHTML`.',
19021908
);
1909+
// eslint-disable-next-line-no-fallthrough
19031910
default:
19041911
pushAttribute(target, propKey, propValue);
19051912
break;
@@ -1929,6 +1936,7 @@ function pushStartMenuItem(
19291936
throw new Error(
19301937
'menuitems cannot have `children` nor `dangerouslySetInnerHTML`.',
19311938
);
1939+
// eslint-disable-next-line-no-fallthrough
19321940
default:
19331941
pushAttribute(target, propKey, propValue);
19341942
break;
@@ -2080,6 +2088,7 @@ function pushStartTitle(
20802088
throw new Error(
20812089
'`dangerouslySetInnerHTML` does not make sense on <title>.',
20822090
);
2091+
// eslint-disable-next-line-no-fallthrough
20832092
default:
20842093
pushAttribute(target, propKey, propValue);
20852094
break;
@@ -2778,12 +2787,11 @@ export function pushEndInstance(
27782787
if (!enableFloat) {
27792788
break;
27802789
}
2781-
// Fall through
27822790
}
2783-
27842791
// Omitted close tags
27852792
// TODO: Instead of repeating this switch we could try to pass a flag from above.
27862793
// That would require returning a tuple. Which might be ok if it gets inlined.
2794+
// eslint-disable-next-line-no-fallthrough
27872795
case 'area':
27882796
case 'base':
27892797
case 'br':
@@ -4036,6 +4044,7 @@ function writeStyleResourceDependencyInJS(
40364044
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
40374045
'use `dangerouslySetInnerHTML`.',
40384046
);
4047+
// eslint-disable-next-line-no-fallthrough
40394048
default:
40404049
writeStyleResourceAttributeInJS(destination, propKey, propValue);
40414050
break;
@@ -4231,6 +4240,7 @@ function writeStyleResourceDependencyInAttr(
42314240
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
42324241
'use `dangerouslySetInnerHTML`.',
42334242
);
4243+
// eslint-disable-next-line-no-fallthrough
42344244
default:
42354245
writeStyleResourceAttributeInAttr(destination, propKey, propValue);
42364246
break;

packages/react-reconciler/src/ReactFiber.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,29 +550,29 @@ export function createFiberFromTypeAndProps(
550550
if (enableLegacyHidden) {
551551
return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
552552
}
553-
// Fall through
553+
// eslint-disable-next-line no-fallthrough
554554
case REACT_SCOPE_TYPE:
555555
if (enableScopeAPI) {
556556
return createFiberFromScope(type, pendingProps, mode, lanes, key);
557557
}
558-
// Fall through
558+
// eslint-disable-next-line no-fallthrough
559559
case REACT_CACHE_TYPE:
560560
if (enableCache) {
561561
return createFiberFromCache(pendingProps, mode, lanes, key);
562562
}
563-
// Fall through
563+
// eslint-disable-next-line no-fallthrough
564564
case REACT_TRACING_MARKER_TYPE:
565565
if (enableTransitionTracing) {
566566
return createFiberFromTracingMarker(pendingProps, mode, lanes, key);
567567
}
568-
// Fall through
568+
// eslint-disable-next-line no-fallthrough
569569
case REACT_DEBUG_TRACING_MODE_TYPE:
570570
if (enableDebugTracing) {
571571
fiberTag = Mode;
572572
mode |= DebugTracingMode;
573573
break;
574574
}
575-
// Fall through
575+
// eslint-disable-next-line no-fallthrough
576576
default: {
577577
if (typeof type === 'object' && type !== null) {
578578
switch (type.$$typeof) {

packages/react-reconciler/src/ReactFiberBeginWork.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4096,12 +4096,12 @@ function beginWork(
40964096
if (enableFloat && supportsResources) {
40974097
return updateHostHoistable(current, workInProgress, renderLanes);
40984098
}
4099-
// Fall through
4099+
// eslint-disable-next-line no-fallthrough
41004100
case HostSingleton:
41014101
if (enableHostSingletons && supportsSingletons) {
41024102
return updateHostSingleton(current, workInProgress, renderLanes);
41034103
}
4104-
// Fall through
4104+
// eslint-disable-next-line no-fallthrough
41054105
case HostComponent:
41064106
return updateHostComponent(current, workInProgress, renderLanes);
41074107
case HostText:

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ function commitLayoutEffectOnFiber(
11291129
}
11301130
break;
11311131
}
1132-
// Fall through
11331132
}
1133+
// eslint-disable-next-line-no-fallthrough
11341134
case HostSingleton:
11351135
case HostComponent: {
11361136
recursivelyTraverseLayoutEffects(
@@ -1827,8 +1827,8 @@ function commitPlacement(finishedWork: Fiber): void {
18271827
insertOrAppendPlacementNode(finishedWork, before, parent);
18281828
break;
18291829
}
1830-
// Fall through
18311830
}
1831+
// eslint-disable-next-line no-fallthrough
18321832
case HostComponent: {
18331833
const parent: Instance = parentFiber.stateNode;
18341834
if (parentFiber.flags & ContentReset) {
@@ -1851,6 +1851,7 @@ function commitPlacement(finishedWork: Fiber): void {
18511851
insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
18521852
break;
18531853
}
1854+
// eslint-disable-next-line-no-fallthrough
18541855
default:
18551856
throw new Error(
18561857
'Invalid host parent fiber. This error is likely caused by a bug ' +
@@ -2041,8 +2042,8 @@ function commitDeletionEffectsOnFiber(
20412042
}
20422043
return;
20432044
}
2044-
// Fall through
20452045
}
2046+
// eslint-disable-next-line no-fallthrough
20462047
case HostSingleton: {
20472048
if (enableHostSingletons && supportsSingletons) {
20482049
if (!offscreenSubtreeWasHidden) {
@@ -2070,14 +2071,15 @@ function commitDeletionEffectsOnFiber(
20702071

20712072
return;
20722073
}
2073-
// Fall through
20742074
}
2075+
// eslint-disable-next-line no-fallthrough
20752076
case HostComponent: {
20762077
if (!offscreenSubtreeWasHidden) {
20772078
safelyDetachRef(deletedFiber, nearestMountedAncestor);
20782079
}
20792080
// Intentional fallthrough to next branch
20802081
}
2082+
// eslint-disable-next-line-no-fallthrough
20812083
case HostText: {
20822084
// We only need to remove the nearest host child. Set the host parent
20832085
// to `null` on the stack to indicate that nested children don't
@@ -2705,8 +2707,8 @@ function commitMutationEffectsOnFiber(
27052707
}
27062708
return;
27072709
}
2708-
// Fall through
27092710
}
2711+
// eslint-disable-next-line-no-fallthrough
27102712
case HostSingleton: {
27112713
if (enableHostSingletons && supportsSingletons) {
27122714
if (flags & Update) {
@@ -2725,8 +2727,8 @@ function commitMutationEffectsOnFiber(
27252727
}
27262728
}
27272729
}
2728-
// Fall through
27292730
}
2731+
// eslint-disable-next-line-no-fallthrough
27302732
case HostComponent: {
27312733
recursivelyTraverseMutationEffects(root, finishedWork, lanes);
27322734
commitReconciliationEffects(finishedWork);
@@ -3770,6 +3772,7 @@ function commitPassiveMountOnFiber(
37703772
}
37713773
// Intentional fallthrough to next branch
37723774
}
3775+
// eslint-disable-next-line-no-fallthrough
37733776
default: {
37743777
recursivelyTraversePassiveMountEffects(
37753778
finishedRoot,
@@ -3963,6 +3966,7 @@ export function reconnectPassiveEffects(
39633966
}
39643967
// Intentional fallthrough to next branch
39653968
}
3969+
// eslint-disable-next-line-no-fallthrough
39663970
default: {
39673971
recursivelyTraverseReconnectPassiveEffects(
39683972
finishedRoot,
@@ -4043,6 +4047,7 @@ function commitAtomicPassiveEffects(
40434047
}
40444048
break;
40454049
}
4050+
// eslint-disable-next-line-no-fallthrough
40464051
default: {
40474052
recursivelyTraverseAtomicPassiveEffects(
40484053
finishedRoot,

packages/react-reconciler/src/ReactFiberCompleteWork.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ function completeWork(
11721172
}
11731173
}
11741174
}
1175-
// Fall through
11761175
}
1176+
// eslint-disable-next-line-no-fallthrough
11771177
case HostSingleton: {
11781178
if (enableHostSingletons && supportsSingletons) {
11791179
popHostContext(workInProgress);
@@ -1234,8 +1234,8 @@ function completeWork(
12341234
bubbleProperties(workInProgress);
12351235
return null;
12361236
}
1237-
// Fall through
12381237
}
1238+
// eslint-disable-next-line-no-fallthrough
12391239
case HostComponent: {
12401240
popHostContext(workInProgress);
12411241
const type = workInProgress.type;

packages/react-reconciler/src/ReactFiberThrow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ function throwException(
465465
}
466466
break;
467467
}
468-
// Fall through
469468
}
469+
// eslint-disable-next-line no-fallthrough
470470
default: {
471471
throw new Error(
472472
`Unexpected Suspense handler tag (${suspenseBoundary.tag}). This ` +

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,9 @@ function finishConcurrentRender(
11221122
case RootFatalErrored: {
11231123
throw new Error('Root did not complete. This is a bug in React.');
11241124
}
1125+
// Flow knows about invariant, so it complains if I add a break
1126+
// statement, but eslint doesn't know about invariant, so it complains
1127+
// if I do. eslint-disable-next-line no-fallthrough
11251128
case RootErrored: {
11261129
// We should have already attempted to retry this tree. If we reached
11271130
// this point, it errored again. Commit it.
@@ -2378,6 +2381,7 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
23782381
unitOfWork.tag = FunctionComponent;
23792382
// Fallthrough to the next branch.
23802383
}
2384+
// eslint-disable-next-line no-fallthrough
23812385
case SimpleMemoComponent:
23822386
case FunctionComponent: {
23832387
// Resolve `defaultProps`. This logic is copied from `beginWork`.

0 commit comments

Comments
 (0)