Skip to content

Commit ac860c2

Browse files
committed
eslint: Turn off rules default-case and consistent-return
We'd like to use Flow enums soon; see code comment for how this helps prepare for that.
1 parent 30e013c commit ac860c2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.eslintrc.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ rules:
7575
# of Airbnb's settings where we don't want a full repeal.
7676
#
7777

78+
# When switching on a Flow-enum value, we want to omit a `default` case
79+
# when Flow says the `case`s are exhaustive. See discussion:
80+
# https://github.com/zulip/zulip-mobile/pull/5444#discussion_r928049374
81+
default-case: off
82+
83+
# When switching on a Flow-enum value, we want to omit a `default` case
84+
# when Flow says the `case`s are exhaustive. And if each `case` has a
85+
# `return` statement, then any return statement after the `switch` will be
86+
# unreachable. This rule would have us write one anyway. See discussion:
87+
# https://github.com/zulip/zulip-mobile/pull/5444#discussion_r928049374
88+
consistent-return: off
89+
7890
# With hermes-eslint for `parser`, above, this rule can analyze Flow
7991
# types. It would fire on global types like $ReadOnly, for which it
8092
# doesn't see a declaration. We could find out how to teach the rule that

src/reactUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export const useHasStayedTrueForMs = (value: boolean, duration: number): boolean
6666

6767
const [result, setResult] = useState<boolean>(false);
6868

69-
// eslint-disable-next-line consistent-return
7069
useEffect(() => {
7170
if (value) {
7271
const id = setTimeout(() => setResult(true), duration);

0 commit comments

Comments
 (0)