TWNTY-3794 - ESLint rule: only take explicit boolean predicates in if statements (#4354)

* ESLint rule: only take explicit boolean predicates in if statements

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Merge main

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix frontend linter errors

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix jest

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

* Fix lint on new code

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
This commit is contained in:
gitstart-app[bot]
2024-03-09 10:48:19 +01:00
committed by GitHub
parent 40bea0d95e
commit 17511be0cf
164 changed files with 655 additions and 367 deletions

View File

@ -28,6 +28,7 @@ export const useScopedHotkeyCallback = () =>
.getValue();
if (!currentHotkeyScopes.includes(scope)) {
// eslint-disable-next-line @nx/workspace-explicit-boolean-predicates-in-if
if (DEBUG_HOTKEY_SCOPE) {
logDebug(
`%cI can't call hotkey (${
@ -42,6 +43,7 @@ export const useScopedHotkeyCallback = () =>
return;
}
// eslint-disable-next-line @nx/workspace-explicit-boolean-predicates-in-if
if (DEBUG_HOTKEY_SCOPE) {
logDebug(
`%cI can call hotkey (${

View File

@ -2,6 +2,8 @@ import { Options, useHotkeys } from 'react-hotkeys-hook';
import { Keys } from 'react-hotkeys-hook/dist/types';
import { useRecoilState } from 'recoil';
import { isNonNullable } from '~/utils/isNonNullable';
import { pendingHotkeyState } from '../states/internal/pendingHotkeysState';
import { useScopedHotkeyCallback } from './useScopedHotkeyCallback';
@ -55,7 +57,7 @@ export const useSequenceHotkeys = (
setPendingHotkey(null);
if (options.preventDefault) {
if (isNonNullable(options.preventDefault)) {
keyboardEvent.stopImmediatePropagation();
keyboardEvent.stopPropagation();
keyboardEvent.preventDefault();

View File

@ -63,15 +63,15 @@ export const useSetHotkeyScope = () =>
const scopesToSet: string[] = [];
if (newHotkeyScope.customScopes?.commandMenu) {
if (newHotkeyScope.customScopes?.commandMenu === true) {
scopesToSet.push(AppHotkeyScope.CommandMenu);
}
if (newHotkeyScope?.customScopes?.goto) {
if (newHotkeyScope?.customScopes?.goto === true) {
scopesToSet.push(AppHotkeyScope.Goto);
}
if (newHotkeyScope?.customScopes?.keyboardShortcutMenu) {
if (newHotkeyScope?.customScopes?.keyboardShortcutMenu === true) {
scopesToSet.push(AppHotkeyScope.KeyboardShortcutMenu);
}