Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis committed Jan 29, 2025
1 parent 3150887 commit 3679161
Show file tree
Hide file tree
Showing 55 changed files with 305 additions and 546 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@
module.exports = {
extends: 'expo',
ignorePatterns: ['/dist/*'],
rules: {
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-redeclare": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_$",
"varsIgnorePattern": "^_$",
"caughtErrorsIgnorePattern": "^_$"
}
],
"react-hooks/exhaustive-deps": "off",
"react/display-name": "off",
}
};
7 changes: 3 additions & 4 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ import {
Platform,
StatusBar,
UIManager,
View,
} from 'react-native';
import {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import {
DefaultTheme,
NavigationContainer,
NavigationContainerRef,
createNavigationContainerRef,
} from '@react-navigation/native';

Expand Down Expand Up @@ -338,7 +335,7 @@ const App = () => {
let response: Response | null = null
try {
response = await fetch(STATUS_URL, {cache: 'no-cache'});
} catch (e) {};
} catch (_) {};

if (response === null || !response.ok) {
// If even the status server is down, things are *very* not-okay. But odds
Expand Down Expand Up @@ -428,6 +425,7 @@ const App = () => {
}, [inboxStats, setNumUnreadTitle]);

if (Platform.OS === 'web') {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
const handlePopstate = (ev) => {
ev.preventDefault();
Expand All @@ -442,6 +440,7 @@ const App = () => {
window.addEventListener('popstate', handlePopstate);
}, []);

// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
return listen<Inbox | null>('inbox', onChangeInbox, true);
}, [onChangeInbox]);
Expand Down
5 changes: 0 additions & 5 deletions api/api.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {
Platform,
} from 'react-native';
import {
API_URL,
} from '../env/env';
import * as _ from "lodash";
import { sessionToken } from '../kv-storage/session-token';
import { Buffer } from "buffer";
import { NonNullImageCropperOutput } from '../components/image-cropper';
import { delay } from '../util/util';
import { notify } from '../events/events';
import { ValidationErrorToast, SOMETHING_WENT_WRONG } from '../components/toast';
Expand Down
4 changes: 0 additions & 4 deletions components/audio-bio.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import {
View,
StyleSheet,
SafeAreaView,
} from 'react-native';
import {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
Expand Down
3 changes: 0 additions & 3 deletions components/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { X } from "react-native-feather";
import { ImageBackground } from "expo-image";
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'
import { faLock } from '@fortawesome/free-solid-svg-icons/faLock'
import { verificationOptionGroups } from '../data/option-groups';

const Avatar = ({percentage, ...props}) => {
const {
Expand All @@ -25,8 +24,6 @@ const Avatar = ({percentage, ...props}) => {
imageUuid,
imageBlurhash,
navigation,
size,
shadow = false,
isSkipped = false,
verificationRequired = null,
} = props;
Expand Down
15 changes: 6 additions & 9 deletions components/base-quiz-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
PanResponder,
Platform,
RegisteredStyle,
View,
ViewStyle,
} from 'react-native';
import Animated, {
Expand All @@ -30,8 +29,6 @@ import Animated, {
type Direction = 'left' | 'right' | 'up' | 'down' | 'none'
type SwipeHandler = (direction: Direction) => void
type CardLeftScreenHandler = (direction: Direction) => void
type SwipeRequirementFufillUpdate = (direction: Direction) => void
type SwipeRequirementUnfufillUpdate = () => void

interface API {
/**
Expand Down Expand Up @@ -372,26 +369,26 @@ const BaseQuizCard = forwardRef(
PanResponder.create({
// Ask to be the responder:
onStartShouldSetPanResponder:
(evt, gestureState) => false,
() => false,
onStartShouldSetPanResponderCapture:
(evt, gestureState) => false,
() => false,
onMoveShouldSetPanResponder:
(evt, gestureState) => {
() => {
if (!isAtStartPosition.current) {
return false;
}
isAtStartPosition.current = false;
return true;
},
onMoveShouldSetPanResponderCapture:
(evt, gestureState) => {
() => {
if (!isAtStartPosition.current) {
return false;
}
isAtStartPosition.current = false;
return true;
},
onPanResponderGrant: (evt, gestureState) => {
onPanResponderGrant: (evt) => {
if (Platform.OS === 'web') {
evt.preventDefault?.();
}
Expand All @@ -410,7 +407,7 @@ const BaseQuizCard = forwardRef(
immediate: true,
})
},
onPanResponderTerminationRequest: (evt, gestureState) => {
onPanResponderTerminationRequest: () => {
return true;
},
onPanResponderRelease: (evt, gestureState) => {
Expand Down
13 changes: 0 additions & 13 deletions components/button-group.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import {
Animated,
Pressable,
View,
} from 'react-native';
import {
useCallback,
useEffect,
useRef,
memo,
} from 'react';
import { DefaultText } from './default-text';

import { ButtonGroup as ButtonGroup_ } from '@rneui/themed';

const ButtonGroup = (props) => {
Expand Down
1 change: 0 additions & 1 deletion components/button/centered-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
ActivityIndicator,
Animated,
Pressable,
View,
} from 'react-native';
import {
useRef,
Expand Down
1 change: 0 additions & 1 deletion components/button/option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
ActivityIndicator,
Animated,
Pressable,
View,
} from 'react-native';
import {
useCallback,
Expand Down
5 changes: 2 additions & 3 deletions components/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from 'react-native';
import {
useCallback,
useEffect,
useRef,
useState,
} from 'react';
Expand All @@ -26,8 +25,8 @@ const Chart = ({name1, percentage1, name2, percentage2, ...props}) => {

const [expanded, setExpanded] = useState(false);

const { opacity, scaleXY } = LayoutAnimation.Properties;
const { easeInEaseOut, linear } = LayoutAnimation.Types;
const { scaleXY } = LayoutAnimation.Properties;
const { easeInEaseOut } = LayoutAnimation.Types;

const animatedBackgroundColor = useRef(new Animated.Value(1)).current;

Expand Down
3 changes: 1 addition & 2 deletions components/club-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ActivityIndicator,
Animated,
Easing,
Pressable,
SafeAreaView,
ScrollView,
Expand All @@ -19,7 +18,7 @@ import { TopNavBar } from './top-nav-bar';
import { Title } from './title';
import Ionicons from '@expo/vector-icons/Ionicons';
import { DefaultTextInput } from './default-text-input';
import { api, japi } from '../api/api';
import { api } from '../api/api';
import * as _ from "lodash";
import { Basic } from './basic';
import { listen, lastEvent } from '../events/events';
Expand Down
3 changes: 0 additions & 3 deletions components/color-picker-modal/color-picker-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import {
HsvColorPicker,
HsvColorPickerRef,
} from './hsv-color-picker';
import {
hsvToHex,
} from './util';
import {
DefaultText,
} from './../default-text';
Expand Down
2 changes: 0 additions & 2 deletions components/color-picker-modal/hue-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, {
forwardRef,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} from 'react';
import {
Animated,
Expand Down
14 changes: 0 additions & 14 deletions components/color-picker-modal/saturation-value-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React, {
forwardRef,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} from 'react';
import {
Animated,
View,
TouchableWithoutFeedback,
PanResponder,
StyleSheet,
ViewStyle,
Expand All @@ -19,7 +16,6 @@ import {
} from 'expo-linear-gradient';
import {
clamp,
hsvToHex,
} from './util';

type SaturationValuePickerRef = {
Expand Down Expand Up @@ -94,16 +90,6 @@ const SaturationValuePicker = forwardRef<
outputRange: ['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 1)'],
});

const computeSatVal = (locationX: number, locationY: number) => ({
saturation: clamp(locationX / size),
value: 1 - clamp(locationY / size),
});

const getCurrentColor = useCallback(
() => hsvToHex(hue.current, baseSliderXY.current.x, baseSliderXY.current.y),
[hue, baseSliderXY]
);

const getHue = useCallback(
() => hue.current, [hue]);
const getSaturation = useCallback(
Expand Down
6 changes: 6 additions & 0 deletions components/color-picker-modal/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,27 @@ const hsvToRgb = (h: number, s: number, v: number) => {

switch (i % 6) {
case 0:
// eslint-disable-next-line no-unused-expressions
r = v, g = t, b = p;
break;
case 1:
// eslint-disable-next-line no-unused-expressions
r = q, g = v, b = p;
break;
case 2:
// eslint-disable-next-line no-unused-expressions
r = p, g = v, b = t;
break;
case 3:
// eslint-disable-next-line no-unused-expressions
r = p, g = q, b = v;
break;
case 4:
// eslint-disable-next-line no-unused-expressions
r = t, g = p, b = v;
break;
case 5:
// eslint-disable-next-line no-unused-expressions
r = v, g = p, b = q;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion components/conversation-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ const ConversationScreen = ({navigation, route}) => {
const [isActive, setIsActive] = useState(AppState.currentState === 'active');
const [isOnline, setIsOnline] = useState(lastEvent('xmpp-is-online') ?? false);

const [messageFetchTimeout, setMessageFetchTimeout] = useState(false);
const [messages, setMessages] = useState<Message[] | null>(null);
const [lastMessageStatus, setLastMessageStatus] = useState<
MessageStatus | null
Expand Down Expand Up @@ -560,6 +559,7 @@ const ConversationScreen = ({navigation, route}) => {
]);

if (Platform.OS === 'web') {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
const handleFocus = () => {
markLastMessageRead();
Expand Down
1 change: 0 additions & 1 deletion components/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
forwardRef,
useCallback,
useImperativeHandle,
useRef,
useState
} from 'react';
import DropDownPicker from 'react-native-dropdown-picker';
Expand Down
1 change: 0 additions & 1 deletion components/deafult-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Animated,
BackHandler,
Easing,
Platform,
StatusBar,
StyleSheet,
View,
Expand Down
2 changes: 0 additions & 2 deletions components/default-flat-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import {
} from 'react-native';
import {
forwardRef,
isValidElement,
memo,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
Expand Down
1 change: 0 additions & 1 deletion components/default-long-text-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Platform } from 'react-native';
import { DefaultTextInput } from './default-text-input';

const DefaultLongTextInput = (props) => {
Expand Down
Loading

0 comments on commit 3679161

Please sign in to comment.