From b15a435069a4721214a542af0bd0d24c8ae2066d Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 25 Aug 2023 10:48:38 -0500 Subject: [PATCH] Eslint updates (#1281) * eslint: Update eslintrc * eslint: Strings must use singlequote quotes * eslint: expected { after if-condition * eslint: update warnings * a little cleanup * remove conflicted file --------- Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Co-authored-by: Paul Frazee --- .eslintrc.js | 2 ++ src/view/com/modals/Modal.web.tsx | 4 ++-- src/view/com/modals/ProfilePreview.tsx | 2 +- src/view/com/util/Alert.web.tsx | 2 ++ src/view/com/util/ViewSelector.tsx | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9d6e6df8..46b5231b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { plugins: ['@typescript-eslint', 'detox'], ignorePatterns: [ '**/__mocks__/*.ts', + 'src/platform/polyfills.ts', 'src/third-party', 'ios', 'android', @@ -25,6 +26,7 @@ module.exports = { files: ['*.js', '*.mjs', '*.ts', '*.tsx'], rules: { semi: [2, 'never'], + 'react-native/no-inline-styles': 0, }, }, ], diff --git a/src/view/com/modals/Modal.web.tsx b/src/view/com/modals/Modal.web.tsx index 0e28b161..687c4fba 100644 --- a/src/view/com/modals/Modal.web.tsx +++ b/src/view/com/modals/Modal.web.tsx @@ -118,10 +118,10 @@ function Modal({modal}: {modal: ModalIface}) { } return ( - // eslint-disable-next-line + // eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors - {/* eslint-disable-next-line */} + {/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors */} { const {screen} = useAnalytics() // track the navigator state to detect if a page-load occurred - const navState = useNavigationState(s => s) + const navState = useNavigationState(state => state) const [initNavState] = useState(navState) const isLoading = initNavState !== navState diff --git a/src/view/com/util/Alert.web.tsx b/src/view/com/util/Alert.web.tsx index 94ccc7e4..bf245650 100644 --- a/src/view/com/util/Alert.web.tsx +++ b/src/view/com/util/Alert.web.tsx @@ -3,10 +3,12 @@ import {AlertButton, AlertStatic} from 'react-native' class WebAlert implements Pick { public alert(title: string, message?: string, buttons?: AlertButton[]): void { if (buttons === undefined || buttons.length === 0) { + // eslint-disable-next-line no-alert window.alert([title, message].filter(Boolean).join('\n')) return } + // eslint-disable-next-line no-alert const result = window.confirm([title, message].filter(Boolean).join('\n')) if (result === true) { diff --git a/src/view/com/util/ViewSelector.tsx b/src/view/com/util/ViewSelector.tsx index a25ca4d8..cd329928 100644 --- a/src/view/com/util/ViewSelector.tsx +++ b/src/view/com/util/ViewSelector.tsx @@ -174,8 +174,8 @@ export function Selector({ { - const {height} = e.nativeEvent.layout - setHeight(height || 60) + const {height: layoutHeight} = e.nativeEvent.layout + setHeight(layoutHeight || 60) }}> {items.map((item, i) => { const selected = i === selectedIndex