Skip to content

Commit 9d36961

Browse files
authored
Merge pull request #8 from scituinsk/chore/setup-dev-tools
chore: setup editor config and husky
2 parents 9186752 + 0713eed commit 9d36961

File tree

21 files changed

+289
-166
lines changed

21 files changed

+289
-166
lines changed

.editorconfig

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# Aturan paling atas berlaku untuk semua file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 2
10+
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
# Pengaturan spesifik untuk file JavaScript dan JSX/TSX
15+
[*.{js,jsx,ts,tsx}]
16+
indent_size = 2
17+
indent_style = space
18+
19+
# Pengaturan untuk file CSS, SCSS, dan Less
20+
[*.{css,scss,less}]
21+
indent_size = 2
22+
indent_style = space
23+
24+
# Pengaturan untuk file JSON dan Markdown
25+
[*.{json,md}]
26+
indent_size = 2
27+
indent_style = space
28+
trim_trailing_whitespace = false
29+
30+
# Pengaturan untuk file HTML
31+
[*.html]
32+
indent_size = 2
33+
indent_style = space
34+
35+
# Pengaturan untuk file YAML
36+
[*.{yml,yaml}]
37+
indent_size = 2
38+
indent_style = space

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy React via SSH and Docker Compose
33
# Pemicu workflow -> dijalankan saat ada push ke branch main atau bisa dijalankan manual
44
on:
55
push:
6-
branches: [ "main" ]
6+
branches: ["main"]
77
workflow_dispatch:
88

99
jobs:

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npm run lint
2+
npm run format

eslint.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import { defineConfig, globalIgnores } from 'eslint/config'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import { defineConfig, globalIgnores } from "eslint/config";
66

77
export default defineConfig([
8-
globalIgnores(['dist']),
8+
globalIgnores(["dist"]),
99
{
10-
files: ['**/*.{js,jsx}'],
10+
files: ["**/*.{js,jsx}"],
1111
extends: [
1212
js.configs.recommended,
13-
reactHooks.configs['recommended-latest'],
13+
reactHooks.configs["recommended-latest"],
1414
reactRefresh.configs.vite,
1515
],
1616
languageOptions: {
1717
ecmaVersion: 2020,
1818
globals: globals.browser,
1919
parserOptions: {
20-
ecmaVersion: 'latest',
20+
ecmaVersion: "latest",
2121
ecmaFeatures: { jsx: true },
22-
sourceType: 'module',
22+
sourceType: "module",
2323
},
2424
},
2525
rules: {
26-
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
26+
"no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }],
2727
},
2828
},
29-
])
29+
]);

index.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -13,10 +13,7 @@
1313
href="/logo-dark.svg"
1414
media="(prefers-color-scheme: dark)"
1515
/>
16-
<meta
17-
name="viewport"
18-
content="width=device-width, initial-scale=1.0"
19-
/>
16+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2017
<link
2118
href="https://api.fontshare.com/v2/css?f[]=clash-display@400,500,600,700&display=swap"
2219
rel="stylesheet"
@@ -26,9 +23,6 @@
2623
</head>
2724
<body>
2825
<div id="root"></div>
29-
<script
30-
type="module"
31-
src="/src/index.jsx"
32-
></script>
26+
<script type="module" src="/src/index.jsx"></script>
3327
</body>
3428
</html>

package-lock.json

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

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"dev": "vite",
88
"build": "vite build",
99
"lint": "eslint .",
10-
"preview": "vite preview"
10+
"preview": "vite preview",
11+
"prepare": "husky",
12+
"format": "npx prettier --write ."
1113
},
1214
"dependencies": {
1315
"@fontsource/rubik": "^5.2.8",
@@ -32,6 +34,8 @@
3234
"eslint-plugin-react-hooks": "^5.2.0",
3335
"eslint-plugin-react-refresh": "^0.4.20",
3436
"globals": "^16.4.0",
37+
"husky": "^9.1.7",
38+
"prettier": "^3.6.2",
3539
"vite": "^7.1.7"
3640
}
3741
}

src/components/app-logo.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import logoBrand from "../assets/logo-brand.png";
55
export const AppLogo = () => {
66
return (
77
<Link to="/">
8-
<img
9-
src={logoBrand}
10-
alt="LOGO BRAND"
11-
/>
8+
<img src={logoBrand} alt="LOGO BRAND" />
129
</Link>
1310
);
1411
};

src/components/ui/avatar.jsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ const AvatarContext = createContext();
2626
const useAvatarContext = () => {
2727
const context = useContext(AvatarContext);
2828
if (!context) {
29-
throw new Error("Avatar components must be used within an <Avatar> provider");
29+
throw new Error(
30+
"Avatar components must be used within an <Avatar> provider",
31+
);
3032
}
3133
return context;
3234
};
@@ -74,23 +76,28 @@ const AvatarImage = React.forwardRef(({ src, className, ...props }, ref) => {
7476
});
7577
AvatarImage.displayName = "AvatarImage";
7678

77-
const AvatarFallback = React.forwardRef(({ className, children, ...props }, ref) => {
78-
const { imageStatus } = useAvatarContext();
79+
const AvatarFallback = React.forwardRef(
80+
({ className, children, ...props }, ref) => {
81+
const { imageStatus } = useAvatarContext();
7982

80-
if (imageStatus === "loaded") {
81-
return null;
82-
}
83+
if (imageStatus === "loaded") {
84+
return null;
85+
}
8386

84-
return (
85-
<div
86-
ref={ref}
87-
className={cn("flex h-full w-full items-center justify-center bg-gray-200 text-gray-600 font-medium select-none", className)}
88-
{...props}
89-
>
90-
{children}
91-
</div>
92-
);
93-
});
87+
return (
88+
<div
89+
ref={ref}
90+
className={cn(
91+
"flex h-full w-full items-center justify-center bg-gray-200 text-gray-600 font-medium select-none",
92+
className,
93+
)}
94+
{...props}
95+
>
96+
{children}
97+
</div>
98+
);
99+
},
100+
);
94101
AvatarFallback.displayName = "AvatarFallback";
95102

96103
export { Avatar, AvatarImage, AvatarFallback };

src/components/ui/button.jsx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,27 @@ const buttonVariants = cva(
1313

1414
primary: "bg-primary text-text-invers hover:bg-secondary",
1515
secondary: "bg-secondary text-text-invers hover:bg-primary",
16-
ternary: "bg-ternary text-text-invers hover:bg-primary active:bg-secondary",
16+
ternary:
17+
"bg-ternary text-text-invers hover:bg-primary active:bg-secondary",
1718

18-
destructive: "bg-error text-text-invers hover:opacity-90 active:opacity-80",
19+
destructive:
20+
"bg-error text-text-invers hover:opacity-90 active:opacity-80",
1921

20-
outline: "bg-transparent border border-primary text-primary hover:bg-primary hover:text-text-invers",
22+
outline:
23+
"bg-transparent border border-primary text-primary hover:bg-primary hover:text-text-invers",
2124

22-
"outline-primary": "border border-primary bg-transparent text-primary hover:bg-primary hover:text-text-invers",
25+
"outline-primary":
26+
"border border-primary bg-transparent text-primary hover:bg-primary hover:text-text-invers",
2327

24-
"outline-destructive": "border border-error bg-transparent text-error hover:bg-error hover:text-text-invers",
28+
"outline-destructive":
29+
"border border-error bg-transparent text-error hover:bg-error hover:text-text-invers",
2530

26-
ghost: "bg-transparent text-text hover:bg-surface/70 active:bg-surface/90",
27-
"ghost-primary": "bg-transparent text-primary hover:bg-surface/70 active:bg-surface/90",
28-
"ghost-destructive": "bg-transparent text-error hover:bg-surface/70 active:bg-surface/90",
31+
ghost:
32+
"bg-transparent text-text hover:bg-surface/70 active:bg-surface/90",
33+
"ghost-primary":
34+
"bg-transparent text-primary hover:bg-surface/70 active:bg-surface/90",
35+
"ghost-destructive":
36+
"bg-transparent text-error hover:bg-surface/70 active:bg-surface/90",
2937

3038
link: "bg-transparent text-primary underline-offset-4 hover:underline",
3139
},
@@ -51,32 +59,35 @@ const buttonVariants = cva(
5159
size: "default",
5260
rounded: "default",
5361
},
54-
}
62+
},
5563
);
5664

57-
const Button = forwardRef(({ className, variant, size, rounded, asChild = false, children, ...props }, ref) => {
58-
const buttonClasses = cn(buttonVariants({ variant, size, rounded, className }));
65+
const Button = forwardRef(
66+
(
67+
{ className, variant, size, rounded, asChild = false, children, ...props },
68+
ref,
69+
) => {
70+
const buttonClasses = cn(
71+
buttonVariants({ variant, size, rounded, className }),
72+
);
5973

60-
if (asChild && isValidElement(children)) {
61-
return cloneElement(children, {
62-
ref,
63-
className: cn(buttonClasses, children.props.className),
64-
...props,
65-
...children.props,
66-
});
67-
}
74+
if (asChild && isValidElement(children)) {
75+
return cloneElement(children, {
76+
ref,
77+
className: cn(buttonClasses, children.props.className),
78+
...props,
79+
...children.props,
80+
});
81+
}
6882

69-
return (
70-
<AriaButton
71-
ref={ref}
72-
className={buttonClasses}
73-
{...props}
74-
>
75-
{children}
76-
</AriaButton>
77-
);
78-
});
83+
return (
84+
<AriaButton ref={ref} className={buttonClasses} {...props}>
85+
{children}
86+
</AriaButton>
87+
);
88+
},
89+
);
7990

8091
Button.displayName = "Button";
8192

82-
export { Button, buttonVariants };
93+
export { Button };

0 commit comments

Comments
 (0)