Skip to content

Commit e2fce6d

Browse files
committed
Enforce brace-style
1 parent a48a7cf commit e2fce6d

File tree

7 files changed

+15
-27
lines changed

7 files changed

+15
-27
lines changed

frontend/eslint.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export default tseslint.config(
3535
{ allowConstantExport: true },
3636
],
3737
...stylistic.configs['recommended-flat'].rules,
38-
'@stylistic/semi': ['error', 'always']
38+
'@stylistic/semi': ['error', 'always'],
39+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
3940
},
4041
},
4142
)

frontend/src/App.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ function AppContent() {
3232
const setTokenWithStorage = useCallback((newToken: string | null) => {
3333
if (newToken) {
3434
localStorage.setItem('token', newToken);
35-
}
36-
else {
35+
} else {
3736
localStorage.removeItem('token');
3837
}
3938
setToken(newToken);
@@ -50,8 +49,7 @@ function AppContent() {
5049
});
5150
const data = await response.json() as Info;
5251
setInfo({ ...data, status: 'success' });
53-
}
54-
catch (exc) {
52+
} catch (exc) {
5553
console.error('Error fetching info:', exc);
5654
setInfo(prevInfo => ({ ...prevInfo, status: 'error' }));
5755
}
@@ -102,8 +100,7 @@ function AppContent() {
102100
dispatch(deleteBalloon(message.runId));
103101
break;
104102
}
105-
}
106-
else {
103+
} else {
107104
// Handle initial State
108105
const state = message;
109106
dispatch(setContest(state.contest));

frontend/src/pages/Login.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ const Login = ({ infoHolder }: { infoHolder: InfoHolder }) => {
3838
infoHolder.setToken(data.token);
3939
navigate('/');
4040
}
41-
}
42-
catch (err) {
41+
} catch (err) {
4342
console.error(err);
4443
setError('Произошла ошибка при входе');
45-
}
46-
finally {
44+
} finally {
4745
setIsLoading(false);
4846
}
4947
};

frontend/src/pages/Register.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ const Register = ({ infoHolder }: { infoHolder: InfoHolder }) => {
5050
infoHolder.setToken(data.token);
5151
navigate('/');
5252
}
53-
}
54-
catch (err) {
53+
} catch (err) {
5554
console.error(err);
5655
setError('Произошла ошибка при регистрации');
57-
}
58-
finally {
56+
} finally {
5957
setIsLoading(false);
6058
}
6159
};

frontend/src/pages/VolunteerAccess.tsx

+4-8
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ const VolunteerAccessView = ({ infoHolder }: { infoHolder: InfoHolder }) => {
2525
const data = await response.json() as Volunteer[];
2626
setVolunteers(data);
2727
setError(null);
28-
}
29-
catch (err) {
28+
} catch (err) {
3029
console.error(err);
3130
setError('Не удалось загрузить список волонтеров');
32-
}
33-
finally {
31+
} finally {
3432
setIsLoading(false);
3533
}
3634
}, [infoHolder.token]);
@@ -60,12 +58,10 @@ const VolunteerAccessView = ({ infoHolder }: { infoHolder: InfoHolder }) => {
6058
setVolunteers(volunteers.map(v =>
6159
v.id === id ? { ...v, [role]: newValue } : v,
6260
));
63-
}
64-
catch (err) {
61+
} catch (err) {
6562
console.error(err);
6663
setError('Не удалось обновить права доступа');
67-
}
68-
finally {
64+
} finally {
6965
setIsUpdating(null);
7066
}
7167
};

frontend/src/store/balloonsSlice.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export const balloonsSlice = createSlice({
1717
const index = state.items.findIndex(b => b.runId === action.payload.runId);
1818
if (index >= 0) {
1919
state.items[index] = action.payload;
20-
}
21-
else {
20+
} else {
2221
state.items.push(action.payload);
2322
}
2423
},

frontend/src/store/hallSlice.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export const hallSlice = createSlice({
1616
state.selectedHall = action.payload;
1717
if (action.payload) {
1818
localStorage.setItem('selectedHall', action.payload);
19-
}
20-
else {
19+
} else {
2120
localStorage.removeItem('selectedHall');
2221
}
2322
},

0 commit comments

Comments
 (0)