TWNTY-2244 - ESLint rule: enforce usage of .getLoadable() + .getValue() to get atoms (#4143)

* ESLint rule: enforce usage of .getLoadable() + .getValue() to get atoms

Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Merge main

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Fix

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Fix linter issue

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Fix linter

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
gitstart-app[bot]
2024-03-06 00:24:20 +01:00
committed by GitHub
parent 706b5d3cf1
commit b2210bd418
17 changed files with 180 additions and 24 deletions

View File

@ -14,7 +14,7 @@ export const usePreviousHotkeyScope = () => {
() => {
const previousHotkeyScope = snapshot
.getLoadable(previousHotkeyScopeState)
.valueOrThrow();
.getValue();
if (!previousHotkeyScope) {
return;
@ -35,7 +35,7 @@ export const usePreviousHotkeyScope = () => {
(scope: string, customScopes?: CustomHotkeyScopes) => {
const currentHotkeyScope = snapshot
.getLoadable(currentHotkeyScopeState)
.valueOrThrow();
.getValue();
setHotkeyScope(scope, customScopes);
set(previousHotkeyScopeState, currentHotkeyScope);

View File

@ -25,7 +25,7 @@ export const useScopedHotkeyCallback = () =>
}) => {
const currentHotkeyScopes = snapshot
.getLoadable(internalHotkeysEnabledScopesState)
.valueOrThrow();
.getValue();
if (!currentHotkeyScopes.includes(scope)) {
if (DEBUG_HOTKEY_SCOPE) {

View File

@ -27,7 +27,7 @@ export const useSetHotkeyScope = () =>
async (hotkeyScopeToSet: string, customScopes?: CustomHotkeyScopes) => {
const currentHotkeyScope = snapshot
.getLoadable(currentHotkeyScopeState)
.valueOrThrow();
.getValue();
if (currentHotkeyScope.scope === hotkeyScopeToSet) {
if (!isNonNullable(customScopes)) {