Skip to content

Commit 790ebc9

Browse files
authored
Remove no-fallthrough lint suppressions (#26553)
The lint rule already understands a normal comment. Also a bunch of these were unnecessary.
1 parent c155796 commit 790ebc9

File tree

12 files changed

+29
-57
lines changed

12 files changed

+29
-57
lines changed

fixtures/devtools/regression/shared.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-fallthrough, react/react-in-jsx-scope, react/jsx-no-undef */
1+
/* eslint-disable 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

+5-7
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ function setProp(
350350
}
351351
}
352352
// Fall through to the last case which shouldn't remove empty strings.
353-
// eslint-disable-next-line no-fallthrough
354353
case 'formAction': {
355354
if (
356355
value == null ||
@@ -663,7 +662,7 @@ function setProp(
663662
if (enableCustomElementPropertySupport) {
664663
break;
665664
}
666-
// eslint-disable-next-line no-fallthrough
665+
// Fall through
667666
default: {
668667
if (
669668
key.length > 2 &&
@@ -761,7 +760,7 @@ function setPropOnCustomElement(
761760
if (enableCustomElementPropertySupport) {
762761
break;
763762
}
764-
// eslint-disable-next-line no-fallthrough
763+
// Fall through
765764
default: {
766765
if (registrationNameDependencies.hasOwnProperty(key)) {
767766
if (__DEV__ && value != null && typeof value !== 'function') {
@@ -1010,7 +1009,6 @@ export function setInitialProperties(
10101009
listenToNonDelegatedEvent('load', domElement);
10111010
// We fallthrough to the return of the void elements
10121011
}
1013-
// eslint-disable-next-line no-fallthrough
10141012
case 'area':
10151013
case 'base':
10161014
case 'br':
@@ -1174,7 +1172,7 @@ export function diffProperties(
11741172
'Cannot update the "is" prop after it has been initialized.',
11751173
);
11761174
}
1177-
// eslint-disable-next-line no-fallthrough
1175+
// Fall through
11781176
default: {
11791177
(updatePayload = updatePayload || []).push(propKey, nextProp);
11801178
}
@@ -1790,7 +1788,7 @@ function diffHydratedCustomComponent(
17901788
}
17911789
continue;
17921790
}
1793-
// eslint-disable-next-line no-fallthrough
1791+
// Fall through
17941792
case 'className':
17951793
if (enableCustomElementPropertySupport) {
17961794
// className is a special cased property on the server to render as an attribute.
@@ -1803,7 +1801,7 @@ function diffHydratedCustomComponent(
18031801
warnForPropDifference('className', serverValue, value);
18041802
continue;
18051803
}
1806-
// eslint-disable-next-line no-fallthrough
1804+
// Fall through
18071805
default: {
18081806
let ownNamespaceDev = parentNamespaceDev;
18091807
if (ownNamespaceDev === HTML_NAMESPACE) {

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -319,20 +319,17 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority {
319319
case 'touchend':
320320
case 'touchstart':
321321
case 'volumechange':
322-
// Used by polyfills:
323-
// eslint-disable-next-line no-fallthrough
322+
// Used by polyfills: (fall through)
324323
case 'change':
325324
case 'selectionchange':
326325
case 'textInput':
327326
case 'compositionstart':
328327
case 'compositionend':
329328
case 'compositionupdate':
330-
// Only enableCreateEventHandleAPI:
331-
// eslint-disable-next-line no-fallthrough
329+
// Only enableCreateEventHandleAPI: (fall through)
332330
case 'beforeblur':
333331
case 'afterblur':
334-
// Not used by React but could be by user code:
335-
// eslint-disable-next-line no-fallthrough
332+
// Not used by React but could be by user code: (fall through)
336333
case 'beforeinput':
337334
case 'blur':
338335
case 'fullscreenchange':
@@ -357,8 +354,7 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority {
357354
case 'toggle':
358355
case 'touchmove':
359356
case 'wheel':
360-
// Not used by React but could be by user code:
361-
// eslint-disable-next-line no-fallthrough
357+
// Not used by React but could be by user code: (fall through)
362358
case 'mouseenter':
363359
case 'mouseleave':
364360
case 'pointerenter':

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

+2-12
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ function pushAttribute(
693693
}
694694
}
695695
// Fall through to the last case which shouldn't remove empty strings.
696-
// eslint-disable-next-line no-fallthrough
697696
case 'formAction': {
698697
if (
699698
value == null ||
@@ -1123,11 +1122,9 @@ function pushStartOption(
11231122
case 'dangerouslySetInnerHTML':
11241123
innerHTML = propValue;
11251124
break;
1126-
// eslint-disable-next-line-no-fallthrough
11271125
case 'value':
11281126
value = propValue;
11291127
// We intentionally fallthrough to also set the attribute on the node.
1130-
// eslint-disable-next-line-no-fallthrough
11311128
default:
11321129
pushAttribute(target, propKey, propValue);
11331130
break;
@@ -1248,7 +1245,6 @@ function pushInput(
12481245
`${'input'} is a self-closing tag and must neither have \`children\` nor ` +
12491246
'use `dangerouslySetInnerHTML`.',
12501247
);
1251-
// eslint-disable-next-line-no-fallthrough
12521248
case 'defaultChecked':
12531249
defaultChecked = propValue;
12541250
break;
@@ -1330,7 +1326,6 @@ function pushStartTextArea(
13301326
throw new Error(
13311327
'`dangerouslySetInnerHTML` does not make sense on <textarea>.',
13321328
);
1333-
// eslint-disable-next-line-no-fallthrough
13341329
default:
13351330
pushAttribute(target, propKey, propValue);
13361331
break;
@@ -1677,7 +1672,6 @@ function pushLinkImpl(
16771672
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
16781673
'use `dangerouslySetInnerHTML`.',
16791674
);
1680-
// eslint-disable-next-line-no-fallthrough
16811675
default:
16821676
pushAttribute(target, propKey, propValue);
16831677
break;
@@ -1906,7 +1900,6 @@ function pushSelfClosing(
19061900
`${tag} is a self-closing tag and must neither have \`children\` nor ` +
19071901
'use `dangerouslySetInnerHTML`.',
19081902
);
1909-
// eslint-disable-next-line-no-fallthrough
19101903
default:
19111904
pushAttribute(target, propKey, propValue);
19121905
break;
@@ -1936,7 +1929,6 @@ function pushStartMenuItem(
19361929
throw new Error(
19371930
'menuitems cannot have `children` nor `dangerouslySetInnerHTML`.',
19381931
);
1939-
// eslint-disable-next-line-no-fallthrough
19401932
default:
19411933
pushAttribute(target, propKey, propValue);
19421934
break;
@@ -2088,7 +2080,6 @@ function pushStartTitle(
20882080
throw new Error(
20892081
'`dangerouslySetInnerHTML` does not make sense on <title>.',
20902082
);
2091-
// eslint-disable-next-line-no-fallthrough
20922083
default:
20932084
pushAttribute(target, propKey, propValue);
20942085
break;
@@ -2787,11 +2778,12 @@ export function pushEndInstance(
27872778
if (!enableFloat) {
27882779
break;
27892780
}
2781+
// Fall through
27902782
}
2783+
27912784
// Omitted close tags
27922785
// TODO: Instead of repeating this switch we could try to pass a flag from above.
27932786
// That would require returning a tuple. Which might be ok if it gets inlined.
2794-
// eslint-disable-next-line-no-fallthrough
27952787
case 'area':
27962788
case 'base':
27972789
case 'br':
@@ -4044,7 +4036,6 @@ function writeStyleResourceDependencyInJS(
40444036
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
40454037
'use `dangerouslySetInnerHTML`.',
40464038
);
4047-
// eslint-disable-next-line-no-fallthrough
40484039
default:
40494040
writeStyleResourceAttributeInJS(destination, propKey, propValue);
40504041
break;
@@ -4240,7 +4231,6 @@ function writeStyleResourceDependencyInAttr(
42404231
`${'link'} is a self-closing tag and must neither have \`children\` nor ` +
42414232
'use `dangerouslySetInnerHTML`.',
42424233
);
4243-
// eslint-disable-next-line-no-fallthrough
42444234
default:
42454235
writeStyleResourceAttributeInAttr(destination, propKey, propValue);
42464236
break;

packages/react-reconciler/src/ReactFiber.js

+5-5
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-
// eslint-disable-next-line no-fallthrough
553+
// Fall through
554554
case REACT_SCOPE_TYPE:
555555
if (enableScopeAPI) {
556556
return createFiberFromScope(type, pendingProps, mode, lanes, key);
557557
}
558-
// eslint-disable-next-line no-fallthrough
558+
// Fall through
559559
case REACT_CACHE_TYPE:
560560
if (enableCache) {
561561
return createFiberFromCache(pendingProps, mode, lanes, key);
562562
}
563-
// eslint-disable-next-line no-fallthrough
563+
// Fall through
564564
case REACT_TRACING_MARKER_TYPE:
565565
if (enableTransitionTracing) {
566566
return createFiberFromTracingMarker(pendingProps, mode, lanes, key);
567567
}
568-
// eslint-disable-next-line no-fallthrough
568+
// Fall through
569569
case REACT_DEBUG_TRACING_MODE_TYPE:
570570
if (enableDebugTracing) {
571571
fiberTag = Mode;
572572
mode |= DebugTracingMode;
573573
break;
574574
}
575-
// eslint-disable-next-line no-fallthrough
575+
// Fall through
576576
default: {
577577
if (typeof type === 'object' && type !== null) {
578578
switch (type.$$typeof) {

packages/react-reconciler/src/ReactFiberBeginWork.js

+2-2
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-
// eslint-disable-next-line no-fallthrough
4099+
// Fall through
41004100
case HostSingleton:
41014101
if (enableHostSingletons && supportsSingletons) {
41024102
return updateHostSingleton(current, workInProgress, renderLanes);
41034103
}
4104-
// eslint-disable-next-line no-fallthrough
4104+
// Fall through
41054105
case HostComponent:
41064106
return updateHostComponent(current, workInProgress, renderLanes);
41074107
case HostText:

packages/react-reconciler/src/ReactFiberCommitWork.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ function commitLayoutEffectOnFiber(
11291129
}
11301130
break;
11311131
}
1132+
// Fall through
11321133
}
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
18301831
}
1831-
// eslint-disable-next-line no-fallthrough
18321832
case HostComponent: {
18331833
const parent: Instance = parentFiber.stateNode;
18341834
if (parentFiber.flags & ContentReset) {
@@ -1851,7 +1851,6 @@ function commitPlacement(finishedWork: Fiber): void {
18511851
insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
18521852
break;
18531853
}
1854-
// eslint-disable-next-line-no-fallthrough
18551854
default:
18561855
throw new Error(
18571856
'Invalid host parent fiber. This error is likely caused by a bug ' +
@@ -2042,8 +2041,8 @@ function commitDeletionEffectsOnFiber(
20422041
}
20432042
return;
20442043
}
2044+
// Fall through
20452045
}
2046-
// eslint-disable-next-line no-fallthrough
20472046
case HostSingleton: {
20482047
if (enableHostSingletons && supportsSingletons) {
20492048
if (!offscreenSubtreeWasHidden) {
@@ -2071,15 +2070,14 @@ function commitDeletionEffectsOnFiber(
20712070

20722071
return;
20732072
}
2073+
// Fall through
20742074
}
2075-
// eslint-disable-next-line no-fallthrough
20762075
case HostComponent: {
20772076
if (!offscreenSubtreeWasHidden) {
20782077
safelyDetachRef(deletedFiber, nearestMountedAncestor);
20792078
}
20802079
// Intentional fallthrough to next branch
20812080
}
2082-
// eslint-disable-next-line-no-fallthrough
20832081
case HostText: {
20842082
// We only need to remove the nearest host child. Set the host parent
20852083
// to `null` on the stack to indicate that nested children don't
@@ -2707,8 +2705,8 @@ function commitMutationEffectsOnFiber(
27072705
}
27082706
return;
27092707
}
2708+
// Fall through
27102709
}
2711-
// eslint-disable-next-line-no-fallthrough
27122710
case HostSingleton: {
27132711
if (enableHostSingletons && supportsSingletons) {
27142712
if (flags & Update) {
@@ -2727,8 +2725,8 @@ function commitMutationEffectsOnFiber(
27272725
}
27282726
}
27292727
}
2728+
// Fall through
27302729
}
2731-
// eslint-disable-next-line-no-fallthrough
27322730
case HostComponent: {
27332731
recursivelyTraverseMutationEffects(root, finishedWork, lanes);
27342732
commitReconciliationEffects(finishedWork);
@@ -3772,7 +3770,6 @@ function commitPassiveMountOnFiber(
37723770
}
37733771
// Intentional fallthrough to next branch
37743772
}
3775-
// eslint-disable-next-line-no-fallthrough
37763773
default: {
37773774
recursivelyTraversePassiveMountEffects(
37783775
finishedRoot,
@@ -3966,7 +3963,6 @@ export function reconnectPassiveEffects(
39663963
}
39673964
// Intentional fallthrough to next branch
39683965
}
3969-
// eslint-disable-next-line-no-fallthrough
39703966
default: {
39713967
recursivelyTraverseReconnectPassiveEffects(
39723968
finishedRoot,
@@ -4047,7 +4043,6 @@ function commitAtomicPassiveEffects(
40474043
}
40484044
break;
40494045
}
4050-
// eslint-disable-next-line-no-fallthrough
40514046
default: {
40524047
recursivelyTraverseAtomicPassiveEffects(
40534048
finishedRoot,

packages/react-reconciler/src/ReactFiberCompleteWork.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ function completeWork(
11721172
}
11731173
}
11741174
}
1175+
// Fall through
11751176
}
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
12371238
}
1238-
// eslint-disable-next-line-no-fallthrough
12391239
case HostComponent: {
12401240
popHostContext(workInProgress);
12411241
const type = workInProgress.type;

packages/react-reconciler/src/ReactFiberThrow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ function throwException(
465465
}
466466
break;
467467
}
468+
// Fall through
468469
}
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

-4
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,6 @@ 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
11281125
case RootErrored: {
11291126
// We should have already attempted to retry this tree. If we reached
11301127
// this point, it errored again. Commit it.
@@ -2381,7 +2378,6 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
23812378
unitOfWork.tag = FunctionComponent;
23822379
// Fallthrough to the next branch.
23832380
}
2384-
// eslint-disable-next-line no-fallthrough
23852381
case SimpleMemoComponent:
23862382
case FunctionComponent: {
23872383
// Resolve `defaultProps`. This logic is copied from `beginWork`.

0 commit comments

Comments
 (0)