Skip to content

Commit d7a4b08

Browse files
style: add curly eslint rule; fix failing places (#736)
1 parent 5f32ac9 commit d7a4b08

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default tseslint.config(
3636
},
3737
rules: {
3838
...reactHooks.configs.recommended.rules,
39+
curly: ['error', 'all'],
3940
"react-refresh/only-export-components": "warn",
4041
"no-multiple-empty-lines": "error",
4142
quotes: ["error", "double"],

src/components/CodeBlock/CodeBlock.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ export const CodeBlock = ({
119119
setTimeout(() => setCopied(false), 2000);
120120
} catch (error) {
121121
let message = "Unable to copy code";
122-
if (error instanceof Error) message = error.message;
122+
if (error instanceof Error) {
123+
message = error.message;
124+
}
123125
setErrorCopy(true);
124126
if (typeof onCopyError === "function") {
125127
onCopyError(message);

src/components/FileUpload/FileMultiUpload.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ const formatFileSize = (sizeInBytes: number): string => {
178178
};
179179

180180
const isFiletypeSupported = (filename: string, supportedTypes: string[]): boolean => {
181-
if (!supportedTypes.length) return true;
181+
if (!supportedTypes.length) {
182+
return true;
183+
}
182184

183185
const extension = filename.toLowerCase().slice(filename.lastIndexOf("."));
184186
return supportedTypes.some(type => type.toLowerCase() === extension.toLowerCase());

src/components/FileUpload/FileUpload.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ const formatFileSize = (sizeInBytes: number): string => {
194194
};
195195

196196
const isFiletypeSupported = (filename: string, supportedTypes: string[]): boolean => {
197-
if (!supportedTypes.length) return true;
197+
if (!supportedTypes.length) {
198+
return true;
199+
}
198200

199201
const extension = filename.toLowerCase().slice(filename.lastIndexOf("."));
200202
return supportedTypes.some(type => type.toLowerCase() === extension.toLowerCase());

src/components/SplitButton/SplitButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ export const SplitButton = ({
6767

6868
useEffect(() => {
6969
const targetDiv = ref.current;
70-
if (!targetDiv) return;
70+
if (!targetDiv) {
71+
return;
72+
}
7173

7274
const resizeObserver = new ResizeObserver(entries => {
7375
for (const entry of entries) {

0 commit comments

Comments
 (0)