Skip to content

Commit e405de5

Browse files
Merge pull request #63 from rootstrap/chore/sonar_eslint
fix: braces and parentheses should be used consistently with arrow fu…
2 parents 1b65797 + 20b2d52 commit e405de5

File tree

21 files changed

+125
-104
lines changed

21 files changed

+125
-104
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ module.exports = {
7171
destructuring: 'any',
7272
},
7373
],
74-
'object-shorthand': 'error'
74+
'object-shorthand': 'error',
75+
'arrow-body-style': ["error", "as-needed"]
7576
},
7677
overrides: [
7778
// Configuration for translations files (i18next)

src/api/common/interceptors.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export default function interceptors() {
1616
response.data = toCamelCase(response.data);
1717
return response;
1818
},
19-
(error: AxiosError) => {
20-
return Promise.reject(error);
21-
}
19+
(error: AxiosError) => Promise.reject(error)
2220
);
2321
}

src/api/posts/use-post.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ type Response = Post;
99

1010
export const usePost = createQuery<Response, Variables, AxiosError>({
1111
queryKey: ['posts'],
12-
fetcher: (variables) => {
13-
return client
12+
fetcher: (variables) => client
1413
.get(`posts/${variables.id}`)
15-
.then((response) => response.data);
16-
},
14+
.then((response) => response.data),
1715
});

src/api/posts/use-posts.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ type Variables = void; // as react-query-kit is strongly typed, we need to speci
99

1010
export const usePosts = createQuery<Response, Variables, AxiosError>({
1111
queryKey: ['posts'],
12-
fetcher: () => {
13-
return client.get(`posts`).then((response) => response.data.posts);
14-
},
12+
fetcher: () => client.get(`posts`).then((response) => response.data.posts),
1513
});

src/app/(app)/_layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ export default function TabLayout() {
6464
);
6565
}
6666

67-
const CreateNewPostLink = () => {
68-
return (
67+
const CreateNewPostLink = () => (
6968
<Link href="/feed/add-post" asChild>
7069
<Pressable>
7170
<Text className="px-3 text-primary-300">Create</Text>
7271
</Pressable>
7372
</Link>
7473
);
75-
};

src/components/buttons.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Button, View } from '@/ui';
22

33
import { Title } from './title';
44

5-
export const Buttons = () => {
6-
return (
5+
export const Buttons = () => (
76
<>
87
<Title text="Buttons" />
98
<View>
@@ -47,4 +46,3 @@ export const Buttons = () => {
4746
</View>
4847
</>
4948
);
50-
};

src/components/card.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const images = [
1313
'https://images.unsplash.com/photo-1587974928442-77dc3e0dba72?auto=format&fit=crop&w=800&q=80',
1414
];
1515

16-
export const Card = ({ title, body, id }: Props) => {
17-
return (
16+
export const Card = ({ title, body, id }: Props) => (
1817
<Link href={`/feed/${id}`} asChild>
1918
<Pressable>
2019
<View className="m-2 overflow-hidden rounded-xl border border-neutral-300 bg-white dark:bg-neutral-900">
@@ -36,4 +35,3 @@ export const Card = ({ title, body, id }: Props) => {
3635
</Pressable>
3736
</Link>
3837
);
39-
};

src/components/colors.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import colors from '@/ui/colors';
44
import { Title } from './title';
55
type ColorName = keyof typeof colors;
66

7-
export const Colors = () => {
8-
return (
7+
export const Colors = () => (
98
<>
109
<Title text="Colors" />
1110
{(Object.keys(colors) as ColorName[]).map((name) => (
1211
<Color name={name} key={name} />
1312
))}
1413
</>
1514
);
16-
};
1715

1816
const Color = ({ name }: { name: ColorName }) => {
1917
if (typeof colors[name] === 'string') {
@@ -23,22 +21,19 @@ const Color = ({ name }: { name: ColorName }) => {
2321
<View className="pt-2" testID={`color-list-${name}`}>
2422
<Text className="font-medium">{name.toUpperCase()}</Text>
2523
<View className="flex-row flex-wrap content-between justify-around ">
26-
{Object.entries(colors[name]).map(([key, value]) => {
27-
return (
24+
{Object.entries(colors[name]).map(([key, value]) => (
2825
<ColorCard
2926
key={`${colors[name]}-${key}`}
3027
value={key}
3128
color={value}
3229
/>
33-
);
34-
})}
30+
))}
3531
</View>
3632
</View>
3733
);
3834
};
3935

40-
const ColorCard = ({ color, value }: { value: string; color: string }) => {
41-
return (
36+
const ColorCard = ({ color, value }: { value: string; color: string }) => (
4237
<View className="flex-1">
4338
<View
4439
className="h-14 w-full rounded-sm"
@@ -47,4 +42,3 @@ const ColorCard = ({ color, value }: { value: string; color: string }) => {
4742
<Text className="text-sm">{value}</Text>
4843
</View>
4944
);
50-
};

src/components/settings/items-container.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ type Props = {
66
title?: TxKeyPath;
77
};
88

9-
export const ItemsContainer = ({ children, title }: Props) => {
10-
return (
9+
export const ItemsContainer = ({ children, title }: Props) => (
1110
<>
1211
{title && <Text className="pb-2 pt-4 text-lg" tx={title} />}
1312
{
@@ -17,4 +16,3 @@ export const ItemsContainer = ({ children, title }: Props) => {
1716
}
1817
</>
1918
);
20-
};

src/components/title.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import { Text, View } from '@/ui';
33
type Props = {
44
text: string;
55
};
6-
export const Title = ({ text }: Props) => {
7-
return (
6+
export const Title = ({ text }: Props) => (
87
<View className="flex-row items-center justify-center py-4 pb-2">
98
<Text className="pr-2 text-2xl">{text}</Text>
109
<View className="h-[2px] flex-1 bg-neutral-300" />
1110
</View>
1211
);
13-
};

0 commit comments

Comments
 (0)