Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ module.exports = {
extends: [
'expo',
'plugin:tailwindcss/recommended',
'prettier'
'prettier',
'eslint:recommended'
],
env: {
'jest/globals': true,
'node': true
},
plugins: [
'unicorn',
'@typescript-eslint',
'unused-imports',
'tailwindcss',
'simple-import-sort',
'sonarjs'
'sonarjs',
'jest'
],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'import/no-duplicates': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'unicorn/filename-case': [
'error',
Expand Down Expand Up @@ -73,6 +80,7 @@ module.exports = {
],
'object-shorthand': 'error',
'arrow-body-style': ["error", "as-needed"],
'no-console': ['error', {allow: ['error']}],
'guard-for-in': 'error'
},
overrides: [
Expand Down
1 change: 0 additions & 1 deletion env.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ if (shouldValidateEnv) {
}

console.error(...messages);
Comment thread
fernandatoledo marked this conversation as resolved.

throw new Error(
'Invalid environment variables, Check terminal for more details '
);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"expo-splash-screen": "0.27.5",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.7",
"i18next": "^23.14.0",
"expo-updates": "~0.25.24",
"i18next": "^23.14.0",
"lodash.memoize": "^4.1.2",
"moti": "^0.29.0",
"nativewind": "4.0.36",
Expand Down Expand Up @@ -120,6 +120,7 @@
"eslint-config-expo": "^7.1.2",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-i18n-json": "^4.0.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-sonarjs": "^1.0.4",
Expand Down
27 changes: 27 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/api/common/api-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useReactQueryDevTools } from '@dev-plugins/react-query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { type ReactNode } from 'react';
export const queryClient = new QueryClient();

export function APIProvider({ children }: { children: React.ReactNode }) {
export function APIProvider({ children }: Readonly<{ children: ReactNode }>) {
useReactQueryDevTools(queryClient);
return (
// Provide the client to your App
Expand Down
4 changes: 2 additions & 2 deletions src/api/common/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type GenericObject = { [key: string]: unknown };
export const toCamelCase = (obj: GenericObject): GenericObject => {
const newObj: GenericObject = {};
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (Object.hasOwn(obj,key)) {
if (key.includes('_')) {
const newKey = key.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
newObj[newKey] = obj[key];
Expand All @@ -66,7 +66,7 @@ export const toCamelCase = (obj: GenericObject): GenericObject => {
export const toSnakeCase = (obj: GenericObject): GenericObject => {
const newObj: GenericObject = {};
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (Object.hasOwn(obj,key)) {
let newKey = key.match(/([A-Z])/g)
? key
.match(/([A-Z])/g)!
Expand Down
1 change: 1 addition & 0 deletions src/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../../global.css';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
import { ThemeProvider } from '@react-navigation/native';
import { SplashScreen, Stack } from 'expo-router';
import React from 'react';
import { StyleSheet } from 'react-native';
import FlashMessage from 'react-native-flash-message';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
Expand Down
1 change: 0 additions & 1 deletion src/app/feed/add-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function AddPost() {
const { mutate: addPost, isPending } = useAddPost();

const onSubmit = (data: FormType) => {
console.log(data);
addPost(
{ ...data, userId: 1 },
{
Expand Down
1 change: 1 addition & 0 deletions src/app/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function Login() {
const signIn = useAuth.use.signIn();

const onSubmit: LoginFormProps['onSubmit'] = (data) => {
// eslint-disable-next-line no-console
console.log(data);
signIn({ access: 'access-token', refresh: 'refresh-token' });
router.push('/');
Expand Down
2 changes: 1 addition & 1 deletion src/app/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Cover } from '@/components/cover';
import { useIsFirstTime } from '@/core/hooks';
import { Button, FocusAwareStatusBar, SafeAreaView, Text, View } from '@/ui';
export default function Onboarding() {
const [_, setIsFirstTime] = useIsFirstTime();
const [, setIsFirstTime] = useIsFirstTime();
const router = useRouter();
return (
<View className="flex h-full items-center justify-center">
Expand Down
3 changes: 1 addition & 2 deletions src/components/inputs.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useState } from 'react';

import type { OptionType } from '@/ui';
import { Input, Select, View } from '@/ui';
import { Checkbox, Radio, Switch } from '@/ui';
import { Checkbox, Input, Radio, Select, Switch, View } from '@/ui';

import { Title } from './title';

Expand Down
2 changes: 2 additions & 0 deletions src/components/settings/item.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

import type { TxKeyPath } from '@/core';
import { Pressable, Text, View } from '@/ui';
import { ArrowRight } from '@/ui/icons';
Expand Down
2 changes: 2 additions & 0 deletions src/components/settings/items-container.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

import type { TxKeyPath } from '@/core';
import { Text, View } from '@/ui';

Expand Down
5 changes: 2 additions & 3 deletions src/core/auth/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { create } from 'zustand';

import { createSelectors } from '../utils';
import type { TokenType } from './utils';
import { getToken, removeToken, setToken } from './utils';
import { getToken, removeToken, setToken, type TokenType } from './utils';

interface AuthState {
token: TokenType | null;
Expand Down Expand Up @@ -31,7 +30,7 @@ const _useAuth = create<AuthState>((set, get) => ({
} else {
get().signOut();
}
} catch (e) {
} catch (_) {
// catch error here
// Maybe sign_out user!
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/hooks/use-selected-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type ColorSchemeType = 'light' | 'dark' | 'system';
*
*/
export const useSelectedTheme = () => {
const { colorScheme: _color, setColorScheme } = useColorScheme();
const { setColorScheme } = useColorScheme();
const [theme, _setTheme] = useMMKVString(SELECTED_THEME, storage);

const setSelectedTheme = useCallback(
Expand All @@ -32,7 +32,6 @@ export const useSelectedTheme = () => {
export const loadSelectedTheme = () => {
const theme = storage.getString(SELECTED_THEME);
if (theme !== undefined) {
console.log('theme', theme);
colorScheme.set(theme as ColorSchemeType);
}
};
1 change: 1 addition & 0 deletions src/core/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NavigationContainer } from '@react-navigation/native';
import type { RenderOptions } from '@testing-library/react-native';
import { render } from '@testing-library/react-native';
import type { ReactElement } from 'react';
import React from 'react';
const createAppWrapper = () => ({ children }: { children: React.ReactNode }) => (
<BottomSheetModalProvider>
<NavigationContainer>{children}</NavigationContainer>
Expand Down
1 change: 1 addition & 0 deletions src/ui/focus-aware-status-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useIsFocused } from '@react-navigation/native';
import { useColorScheme } from 'nativewind';
import React from 'react';
Comment thread
fernandatoledo marked this conversation as resolved.
import { StatusBar } from 'react-native';

type Props = React.ComponentProps<typeof StatusBar>;
Expand Down
3 changes: 1 addition & 2 deletions src/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import colors from '@/ui/colors';
import { CaretDown } from '@/ui/icons';

import type { InputControllerType } from './input';
import { useModal } from './modal';
import { Modal } from './modal';
import { Modal, useModal } from './modal';
import { Text } from './text';

const selectTv = tv({
Expand Down
1 change: 0 additions & 1 deletion src/ui/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const HEIGHT = height;

// for onError react queries and mutations
export const showError = (error: AxiosError) => {
console.log(JSON.stringify(error?.response?.data));
const description = extractError(error?.response?.data).trimEnd();

showMessage({
Expand Down