Skip to content

Commit cb77861

Browse files
Merge pull request #72 from rootstrap/chore/eslint_rules
Chore/eslint rules
2 parents ee73269 + 6147c3d commit cb77861

File tree

19 files changed

+57
-19
lines changed

19 files changed

+57
-19
lines changed

.eslintrc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ module.exports = {
55
extends: [
66
'expo',
77
'plugin:tailwindcss/recommended',
8-
'prettier'
8+
'prettier',
9+
'eslint:recommended'
910
],
11+
env: {
12+
'jest/globals': true,
13+
'node': true
14+
},
1015
plugins: [
1116
'unicorn',
1217
'@typescript-eslint',
1318
'unused-imports',
1419
'tailwindcss',
1520
'simple-import-sort',
16-
'sonarjs'
21+
'sonarjs',
22+
'jest'
1723
],
1824
parserOptions: {
1925
project: './tsconfig.json',
2026
},
2127
rules: {
28+
'import/no-duplicates': 'error',
2229
'@typescript-eslint/no-explicit-any': 'error',
2330
'unicorn/filename-case': [
2431
'error',
@@ -73,6 +80,7 @@ module.exports = {
7380
],
7481
'object-shorthand': 'error',
7582
'arrow-body-style': ["error", "as-needed"],
83+
'no-console': ['error', {allow: ['error']}],
7684
'guard-for-in': 'error'
7785
},
7886
overrides: [

env.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ if (shouldValidateEnv) {
220220
}
221221

222222
console.error(...messages);
223-
224223
throw new Error(
225224
'Invalid environment variables, Check terminal for more details '
226225
);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"expo-splash-screen": "0.27.5",
7474
"expo-status-bar": "~1.12.1",
7575
"expo-system-ui": "~3.0.7",
76-
"i18next": "^23.14.0",
7776
"expo-updates": "~0.25.24",
77+
"i18next": "^23.14.0",
7878
"lodash.memoize": "^4.1.2",
7979
"moti": "^0.29.0",
8080
"nativewind": "4.0.36",
@@ -120,6 +120,7 @@
120120
"eslint-config-expo": "^7.1.2",
121121
"eslint-config-prettier": "^9.1.0",
122122
"eslint-plugin-i18n-json": "^4.0.0",
123+
"eslint-plugin-jest": "^28.8.3",
123124
"eslint-plugin-prettier": "^5.2.1",
124125
"eslint-plugin-simple-import-sort": "^10.0.0",
125126
"eslint-plugin-sonarjs": "^1.0.4",

pnpm-lock.yaml

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/common/api-provider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useReactQueryDevTools } from '@dev-plugins/react-query';
22
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3+
import { type ReactNode } from 'react';
34
export const queryClient = new QueryClient();
45

5-
export function APIProvider({ children }: { children: React.ReactNode }) {
6+
export function APIProvider({ children }: Readonly<{ children: ReactNode }>) {
67
useReactQueryDevTools(queryClient);
78
return (
89
// Provide the client to your App

src/api/common/utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type GenericObject = { [key: string]: unknown };
5151
export const toCamelCase = (obj: GenericObject): GenericObject => {
5252
const newObj: GenericObject = {};
5353
for (const key in obj) {
54-
if (obj.hasOwnProperty(key)) {
54+
if (Object.hasOwn(obj,key)) {
5555
if (key.includes('_')) {
5656
const newKey = key.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
5757
newObj[newKey] = obj[key];
@@ -66,7 +66,7 @@ export const toCamelCase = (obj: GenericObject): GenericObject => {
6666
export const toSnakeCase = (obj: GenericObject): GenericObject => {
6767
const newObj: GenericObject = {};
6868
for (const key in obj) {
69-
if (obj.hasOwnProperty(key)) {
69+
if (Object.hasOwn(obj,key)) {
7070
let newKey = key.match(/([A-Z])/g)
7171
? key
7272
.match(/([A-Z])/g)!

src/app/_layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../../global.css';
44
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
55
import { ThemeProvider } from '@react-navigation/native';
66
import { SplashScreen, Stack } from 'expo-router';
7+
import React from 'react';
78
import { StyleSheet } from 'react-native';
89
import FlashMessage from 'react-native-flash-message';
910
import { GestureHandlerRootView } from 'react-native-gesture-handler';

src/app/feed/add-post.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default function AddPost() {
2121
const { mutate: addPost, isPending } = useAddPost();
2222

2323
const onSubmit = (data: FormType) => {
24-
console.log(data);
2524
addPost(
2625
{ ...data, userId: 1 },
2726
{

src/app/login.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default function Login() {
1010
const signIn = useAuth.use.signIn();
1111

1212
const onSubmit: LoginFormProps['onSubmit'] = (data) => {
13+
// eslint-disable-next-line no-console
1314
console.log(data);
1415
signIn({ access: 'access-token', refresh: 'refresh-token' });
1516
router.push('/');

src/app/onboarding.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Cover } from '@/components/cover';
44
import { useIsFirstTime } from '@/core/hooks';
55
import { Button, FocusAwareStatusBar, SafeAreaView, Text, View } from '@/ui';
66
export default function Onboarding() {
7-
const [_, setIsFirstTime] = useIsFirstTime();
7+
const [, setIsFirstTime] = useIsFirstTime();
88
const router = useRouter();
99
return (
1010
<View className="flex h-full items-center justify-center">

0 commit comments

Comments
 (0)