Skip to content

Commit

Permalink
Merge pull request #357 from wyne/eslint-no-duplicates
Browse files Browse the repository at this point in the history
Eslint no duplicates
  • Loading branch information
wyne authored Nov 21, 2023
2 parents 4d9e89d + 9085b4d commit 927bc79
Show file tree
Hide file tree
Showing 56 changed files with 188 additions and 151 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ module.exports = {
'semi': ['error', 'always'],
'eol-last': ['error', 'always'],
'import/order': ['error', {
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"],
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'alphabetize': {
'order': 'asc',
'caseInsensitive': true,
},
'newlines-between': 'always',
}],
'import/no-duplicates': 'error',
},
ignorePatterns: ['web-build', '__mocks__'],
};
9 changes: 5 additions & 4 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';

import analytics from '@react-native-firebase/analytics';
import { StatusBar } from 'expo-status-bar';
import { View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import analytics from '@react-native-firebase/analytics';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';

import { Navigation } from './src/Navigation';
import { store, persistor } from './redux/store';
import { AddendModalContextProvider } from './src/components/Sheets/AddendModalContext';
import { GameSheetContextProvider } from './src/components/Sheets/GameSheetContext';
import { Navigation } from './src/Navigation';

if (process.env.EXPO_PUBLIC_FIREBASE_ANALYTICS == "false") {
analytics().setAnalyticsCollectionEnabled(false);
Expand Down
6 changes: 2 additions & 4 deletions redux/GamesSlice.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configureStore } from '@reduxjs/toolkit';
import { EntityState } from '@reduxjs/toolkit';
import { configureStore , EntityState } from '@reduxjs/toolkit';
import { Store } from 'redux';

import gamesReducer, {
Expand All @@ -8,8 +7,7 @@ import gamesReducer, {
gameSave,
gameDelete,
selectAllGames,
} from './GamesSlice';
import { GameState } from './GamesSlice';
GameState } from './GamesSlice';

describe('games reducer', () => {
let store: Store<EntityState<GameState>>;
Expand Down
6 changes: 2 additions & 4 deletions redux/GamesSlice.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { createEntityAdapter } from '@reduxjs/toolkit';
import { createAsyncThunk } from '@reduxjs/toolkit';
import * as Crypto from 'expo-crypto';
import analytics from '@react-native-firebase/analytics';
import { createSlice, PayloadAction , createEntityAdapter , createAsyncThunk } from '@reduxjs/toolkit';
import * as Crypto from 'expo-crypto';

import { playerAdd } from './PlayersSlice';
import { setCurrentGameId } from './SettingsSlice';
Expand Down
3 changes: 1 addition & 2 deletions redux/PlayersSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { createEntityAdapter } from '@reduxjs/toolkit';
import crashlytics from '@react-native-firebase/crashlytics';
import { createSlice, PayloadAction , createEntityAdapter } from '@reduxjs/toolkit';

type RoundIndex = number;

Expand Down
5 changes: 2 additions & 3 deletions redux/SettingsSlice.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Store } from 'redux';
import { configureStore } from '@reduxjs/toolkit';
import { Store } from 'redux';

import settingsReducer, {
setCurrentGameId,
toggleHomeFullscreen,
setMultiplier,
setOnboardedVersion,
} from './SettingsSlice';
import { SettingsState } from './SettingsSlice';
SettingsState } from './SettingsSlice';


describe('settings reducer', () => {
Expand Down
2 changes: 1 addition & 1 deletion redux/SettingsSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { SemVer, valid } from 'semver';
import * as Application from 'expo-application';
import { SemVer, valid } from 'semver';

export interface SettingsState {
home_fullscreen: boolean;
Expand Down
4 changes: 2 additions & 2 deletions redux/store.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import { persistStore, persistReducer } from 'redux-persist';
import { configureStore } from "@reduxjs/toolkit";
import { persistStore, persistReducer } from 'redux-persist';

import settingsReducer from './SettingsSlice';
import gamesReducer from './GamesSlice';
import scoresReducer from './PlayersSlice';
import settingsReducer from './SettingsSlice';

const settingsPersistConfig = {
key: 'settings',
Expand Down
19 changes: 10 additions & 9 deletions src/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import React from 'react';

import { DarkTheme, NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import * as Application from 'expo-application';
import { SemVer, parse } from 'semver';

import ListScreen from "../src/screens/ListScreen";
import GameScreen from "../src/screens/GameScreen";
import SettingsScreen from "../src/screens/SettingsScreen";
import AppInfoScreen from "../src/screens/AppInfoScreen";
import OnboardingScreen from '../src/screens/OnboardingScreen';
import HomeHeader from '../src/components/Headers/HomeHeader';
import { useAppSelector } from '../redux/hooks';
import AppInfoHeader from '../src/components/Headers/AppInfoHeader';
import GameHeader from '../src/components/Headers/GameHeader';
import HomeHeader from '../src/components/Headers/HomeHeader';
import SettingsHeader from '../src/components/Headers/SettingsHeader';
import AppInfoHeader from '../src/components/Headers/AppInfoHeader';
import { useAppSelector } from '../redux/hooks';
import AppInfoScreen from "../src/screens/AppInfoScreen";
import GameScreen from "../src/screens/GameScreen";
import ListScreen from "../src/screens/ListScreen";
import OnboardingScreen from '../src/screens/OnboardingScreen';
import SettingsScreen from "../src/screens/SettingsScreen";

import ShareScreen from './screens/ShareScreen';
import ShareHeader from './components/Headers/ShareHeader';
import ShareScreen from './screens/ShareScreen';

export type OnboardingScreenParamList = {
onboarding: boolean;
Expand Down
5 changes: 3 additions & 2 deletions src/components/AppInfo/RotatingIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { TouchableWithoutFeedback } from 'react-native';
import { Image } from 'expo-image';

import analytics from '@react-native-firebase/analytics';
import { Image } from 'expo-image';
import { TouchableWithoutFeedback } from 'react-native';
import Animated, {
Easing,
PinwheelIn,
Expand Down
5 changes: 3 additions & 2 deletions src/components/AppInfo/VideoTutorial.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState, useRef, useCallback } from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { AVPlaybackStatus, AVPlaybackStatusSuccess, Video } from 'expo-av';

import analytics from '@react-native-firebase/analytics';
import { AVPlaybackStatus, AVPlaybackStatusSuccess, Video } from 'expo-av';
import { View, Button, StyleSheet } from 'react-native';

function isAVPlaybackStatusSuccess(param: AVPlaybackStatus): param is AVPlaybackStatusSuccess {
return (param as AVPlaybackStatusSuccess).isPlaying !== undefined;
Expand Down
1 change: 1 addition & 0 deletions src/components/BigButtons/BigButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";

import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
import { Icon } from "react-native-elements";
import Animated, { FadeIn, FadeOut, Layout } from "react-native-reanimated";
Expand Down
1 change: 1 addition & 0 deletions src/components/Buttons/AddendButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';

import { Text, View, StyleSheet, TouchableHighlight } from 'react-native';

import { useAppSelector } from '../../../redux/hooks';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Buttons/AppInfoButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import analytics from '@react-native-firebase/analytics';
import { render, fireEvent, waitFor } from '@testing-library/react-native';

import { useNavigationMock } from '../../../test/test-helpers';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons/AppInfoButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import { systemBlue } from '../../constants';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import { systemBlue } from '../../constants';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Buttons/CheckButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import analytics from '@react-native-firebase/analytics';
import { render, fireEvent, waitFor } from '@testing-library/react-native';

import { useNavigationMock } from '../../../test/test-helpers';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons/CheckButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase, RouteProp } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Text } from 'react-native';

import { systemBlue } from '../../constants';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons/FullscreenButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
import { systemBlue } from '../../constants';
import { toggleHomeFullscreen } from '../../../redux/SettingsSlice';
import { systemBlue } from '../../constants';

import HeaderButton from './HeaderButton';

Expand Down
1 change: 1 addition & 0 deletions src/components/Buttons/HeaderButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';

import { TouchableOpacity, StyleSheet } from 'react-native';

interface Props {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buttons/HomeButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import { systemBlue } from '../../constants';
Expand Down
9 changes: 5 additions & 4 deletions src/components/Buttons/NewGameButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { Icon } from 'react-native-elements';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';

import { MenuAction, MenuView } from '@react-native-menu/menu';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Icon } from 'react-native-elements';

import { asyncCreateGame, selectAllGames } from '../../../redux/GamesSlice';
import { useAppSelector, useAppDispatch } from '../../../redux/hooks';
import { systemBlue } from '../../constants';
import { asyncCreateGame, selectAllGames } from '../../../redux/GamesSlice';

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
Expand Down
3 changes: 2 additions & 1 deletion src/components/EditGame.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useState } from 'react';

import { Text, View, StyleSheet, NativeSyntheticEvent, TextInputEndEditingEventData } from 'react-native';
import { Input } from 'react-native-elements';

import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { selectGameById, updateGame } from '../../redux/GamesSlice';
import { useAppDispatch, useAppSelector } from '../../redux/hooks';

const UNTITLED = "Untitled";

Expand Down
8 changes: 4 additions & 4 deletions src/components/EditPlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';

import analytics from '@react-native-firebase/analytics';
import { Text, View, StyleSheet, TouchableOpacity, NativeSyntheticEvent, TextInputEndEditingEventData, Alert } from 'react-native';
import { Icon, Input } from 'react-native-elements';
import analytics from '@react-native-firebase/analytics';
import Animated from 'react-native-reanimated';

import { palette } from '../constants';
import { selectGameById, updateGame } from '../../redux/GamesSlice';
import { selectPlayerById } from '../../redux/PlayersSlice';
import { removePlayer, updatePlayer } from '../../redux/PlayersSlice';
import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { selectPlayerById , removePlayer, updatePlayer } from '../../redux/PlayersSlice';
import { palette } from '../constants';


interface Props {
Expand Down
14 changes: 7 additions & 7 deletions src/components/GameListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { Text, StyleSheet, Alert, Platform } from 'react-native';
import { ListItem } from 'react-native-elements';
import Moment from 'react-moment';
import { Icon } from 'react-native-elements';
import Animated, { FadeInUp, SlideOutLeft } from 'react-native-reanimated';

import analytics from '@react-native-firebase/analytics';
import { MenuView, MenuAction, NativeActionEvent } from '@react-native-menu/menu';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit';
import Moment from 'react-moment';
import { Text, StyleSheet, Alert, Platform } from 'react-native';
import { ListItem , Icon } from 'react-native-elements';
import Animated, { FadeInUp, SlideOutLeft } from 'react-native-reanimated';

import { selectGameById, gameDelete } from '../../redux/GamesSlice';
import { setCurrentGameId } from '../../redux/SettingsSlice';
import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { setCurrentGameId } from '../../redux/SettingsSlice';


import GameListItemPlayerName from './GameListItemPlayerName';
Expand Down
5 changes: 3 additions & 2 deletions src/components/Headers/AppInfoHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { Text, StyleSheet } from 'react-native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';

import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Text, StyleSheet } from 'react-native';

import HomeButton from '../Buttons/HomeButton';

Expand Down
7 changes: 4 additions & 3 deletions src/components/Headers/CustomHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';

import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { View, StyleSheet } from 'react-native';
import Animated, { Easing, FadeInUp } from 'react-native-reanimated';
import { SafeAreaView } from 'react-native-safe-area-context';

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
Expand Down
14 changes: 7 additions & 7 deletions src/components/Headers/GameHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Button } from 'react-native-elements';
import { Icon } from 'react-native-elements/dist/icons/Icon';

import { roundNext, roundPrevious , selectGameById } from '../../../redux/GamesSlice';
import { useAppDispatch, useAppSelector } from '../../../redux/hooks';
import FullscreenButton from '../Buttons/FullscreenButton';
import { roundNext, roundPrevious } from '../../../redux/GamesSlice';
import { selectGameById } from '../../../redux/GamesSlice';
import { systemBlue } from '../../constants';
import HomeButton from '../Buttons/HomeButton';
import AddendButton from '../Buttons/AddendButton';
import FullscreenButton from '../Buttons/FullscreenButton';
import HomeButton from '../Buttons/HomeButton';

import CustomHeader from './CustomHeader';

Expand Down
5 changes: 3 additions & 2 deletions src/components/Headers/HomeHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { Text, StyleSheet, View } from 'react-native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';

import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Text, StyleSheet, View } from 'react-native';

import AppInfoButton from '../Buttons/AppInfoButton';
import NewGameButton from '../Buttons/NewGameButton';
Expand Down
Loading

0 comments on commit 927bc79

Please sign in to comment.