Skip to content

Commit 89a8af0

Browse files
committed
fix: fix prettier not working correctly with lint --fix ( fix #410)
1 parent c063b12 commit 89a8af0

21 files changed

+91
-89
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path');
33
module.exports = {
44
extends: ['expo', 'plugin:tailwindcss/recommended', 'prettier'],
55
plugins: [
6+
'prettier',
67
'unicorn',
78
'@typescript-eslint',
89
'unused-imports',
@@ -14,6 +15,7 @@ module.exports = {
1415
project: './tsconfig.json',
1516
},
1617
rules: {
18+
'prettier/prettier': 'warn',
1719
'unicorn/filename-case': [
1820
'error',
1921
{

.prettierrc.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
module.exports = {
1+
/** @type {import('prettier').Config} */
2+
const config = {
23
singleQuote: true,
34
endOfLine: 'auto',
4-
};
5+
trailingComma: 'es5',
6+
};
7+
8+
module.exports = config;

app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
7272
'expo-localization',
7373
'expo-router',
7474
['app-icon-badge', appIconBadgeConfig],
75-
["react-native-edge-to-edge"]
75+
['react-native-edge-to-edge'],
7676
],
7777
extra: {
7878
...ClientEnv,

src/app/(app)/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Feed() {
1010
const { data, isPending, isError } = usePosts();
1111
const renderItem = React.useCallback(
1212
({ item }: { item: Post }) => <Card {...item} />,
13-
[],
13+
[]
1414
);
1515

1616
if (isError) {

src/app/feed/add-post.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function AddPost() {
4242
onError: () => {
4343
showErrorMessage('Error adding post');
4444
},
45-
},
45+
}
4646
);
4747
};
4848
return (

src/components/login-form.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('LoginForm Form ', () => {
5959
email: 'youssef@gmail.com',
6060
password: 'password',
6161
},
62-
expect.objectContaining({}),
62+
expect.objectContaining({})
6363
);
6464
});
6565
});

src/components/settings/language-item.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ export const LanguageItem = () => {
1616
setLanguage(option.value as Language);
1717
modal.dismiss();
1818
},
19-
[setLanguage, modal],
19+
[setLanguage, modal]
2020
);
2121

2222
const langs = React.useMemo(
2323
() => [
2424
{ label: translate('settings.english'), value: 'en' },
2525
{ label: translate('settings.arabic'), value: 'ar' },
2626
],
27-
[],
27+
[]
2828
);
2929

3030
const selectedLanguage = React.useMemo(
3131
() => langs.find((lang) => lang.value === language),
32-
[language, langs],
32+
[language, langs]
3333
);
3434

3535
return (

src/components/settings/theme-item.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ThemeItem = () => {
1616
setSelectedTheme(option.value as ColorSchemeType);
1717
modal.dismiss();
1818
},
19-
[setSelectedTheme, modal],
19+
[setSelectedTheme, modal]
2020
);
2121

2222
const themes = React.useMemo(
@@ -25,12 +25,12 @@ export const ThemeItem = () => {
2525
{ label: `${translate('settings.theme.light')} 🌞`, value: 'light' },
2626
{ label: `${translate('settings.theme.system')} ⚙️`, value: 'system' },
2727
],
28-
[],
28+
[]
2929
);
3030

3131
const theme = React.useMemo(
3232
() => themes.find((t) => t.value === selectedTheme),
33-
[selectedTheme, themes],
33+
[selectedTheme, themes]
3434
);
3535

3636
return (

src/components/ui/button.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Button component ', () => {
1717
render(
1818
<Button testID="button">
1919
<Text> Custom child </Text>
20-
</Button>,
20+
</Button>
2121
);
2222
expect(screen.getByText('Custom child')).toBeOnTheScreen();
2323
});
@@ -34,7 +34,7 @@ describe('Button component ', () => {
3434
it('should call onClick handler when clicked', async () => {
3535
const onClick = jest.fn();
3636
const { user } = setup(
37-
<Button testID="button" label="Click the button" onPress={onClick} />,
37+
<Button testID="button" label="Click the button" onPress={onClick} />
3838
);
3939
expect(screen.getByTestId('button')).toBeOnTheScreen();
4040
await user.press(screen.getByTestId('button'));
@@ -48,7 +48,7 @@ describe('Button component ', () => {
4848
loading={true}
4949
label="Click the button"
5050
onPress={onClick}
51-
/>,
51+
/>
5252
);
5353
expect(screen.getByTestId('button')).toBeOnTheScreen();
5454
expect(screen.getByTestId('button-activity-indicator')).toBeOnTheScreen();
@@ -69,7 +69,7 @@ describe('Button component ', () => {
6969
disabled={true}
7070
onPress={onClick}
7171
variant="secondary"
72-
/>,
72+
/>
7373
);
7474
expect(screen.getByTestId('button')).toBeOnTheScreen();
7575
await user.press(screen.getByTestId('button'));

src/components/ui/button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ export const Button = React.forwardRef<View, Props>(
105105
textClassName = '',
106106
...props
107107
},
108-
ref,
108+
ref
109109
) => {
110110
const styles = React.useMemo(
111111
() => button({ variant, disabled, size }),
112-
[variant, disabled, size],
112+
[variant, disabled, size]
113113
);
114114

115115
return (
@@ -142,5 +142,5 @@ export const Button = React.forwardRef<View, Props>(
142142
)}
143143
</Pressable>
144144
);
145-
},
145+
}
146146
);

0 commit comments

Comments
 (0)