Skip to content

Commit ab9dcc8

Browse files
committed
add prettier
1 parent 92dab41 commit ab9dcc8

8 files changed

Lines changed: 75 additions & 23 deletions

File tree

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm-lock.yaml

APPWRITE_SETUP.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ This guide will help you set up Appwrite for this project
2323
- For development: add `localhost:3000`
2424
- For production: add your domain
2525

26-
### 4. Environment Variables
26+
### 4. Environment Variables
2727

2828
1. Change `.env.example` to `.env.local` in your project root
2929

30-
2. **Replace:**
30+
2. **Replace:**
31+
3132
- `NEXT_PUBLIC_APPWRITE_PROJECT_ID` with your actual Appwrite project ID
3233
- `NEXT_PUBLIC_APPWRITE_ENDPOINT` with your actual Appwrite endpoint that looks like "https://city.cloud.appwrite.io/v1"
3334

34-
3535
## Features
3636

3737
The login page includes:
@@ -51,12 +51,10 @@ The login page includes:
5151
3. Use the "Create new account" button to register a new user
5252
4. After successful login, users will see a welcome message with logout option
5353

54-
5554
## Troubleshooting
5655

5756
### Common Issues
5857

5958
1. **"Project ID not found"**: Make sure you've updated the project ID in `.env.local`
6059
2. **CORS errors**: Ensure your domain is added to the allowed domains in Appwrite settings
6160
3. **Authentication failed**: Check that email/password auth is enabled in your Appwrite project
62-

eslint.config.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { dirname } from "path";
22
import { fileURLToPath } from "url";
33
import { FlatCompat } from "@eslint/eslintrc";
4+
import { defineConfig } from "eslint/config";
5+
import eslintConfigPrettier from "eslint-config-prettier/flat";
46

57
const __filename = fileURLToPath(import.meta.url);
68
const __dirname = dirname(__filename);
@@ -9,8 +11,7 @@ const compat = new FlatCompat({
911
baseDirectory: __dirname,
1012
});
1113

12-
const eslintConfig = [
14+
export default defineConfig([
1315
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
15-
16-
export default eslintConfig;
16+
eslintConfigPrettier,
17+
]);

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"dev": "next dev --turbopack",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"format": "prettier --write .",
11+
"format:check": "prettier --check ."
1012
},
1113
"dependencies": {
1214
"appwrite": "^18.1.1",
@@ -22,11 +24,17 @@
2224
"@types/react-dom": "^19",
2325
"eslint": "^9",
2426
"eslint-config-next": "15.4.1",
27+
"eslint-config-prettier": "^10.1.8",
28+
"prettier": "^3.6.2",
2529
"tailwindcss": "^4",
2630
"typescript": "^5"
2731
},
2832
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
2933
"pnpm": {
30-
"onlyBuiltDependencies": ["@tailwindcss/oxide", "sharp", "unrs-resolver"]
34+
"onlyBuiltDependencies": [
35+
"@tailwindcss/oxide",
36+
"sharp",
37+
"unrs-resolver"
38+
]
3139
}
3240
}

pnpm-lock.yaml

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

prettier.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @see https://prettier.io/docs/configuration
3+
* @type {import("prettier").Config}
4+
*/
5+
const config = {
6+
semi: true,
7+
singleQuote: false,
8+
};
9+
10+
export default config;

src/app/appwrite.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Client, Account} from 'appwrite';
1+
import { Client, Account } from "appwrite";
22

33
const client = new Client();
44

55
client
6-
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!) // Your API Endpoint
7-
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID!); // Your project ID
6+
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!) // Your API Endpoint
7+
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID!); // Your project ID
88

99
export const account = new Account(client);
10-
export { ID } from 'appwrite';
10+
export { ID } from "appwrite";

src/app/login/page.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { account, ID } from "../appwrite";
44
import type { Models } from "appwrite";
55

66
const LoginPage = () => {
7-
const [loggedInUser, setLoggedInUser] = useState<Models.User<Models.Preferences> | null>(null);
7+
const [loggedInUser, setLoggedInUser] =
8+
useState<Models.User<Models.Preferences> | null>(null);
89
const [email, setEmail] = useState("");
910
const [password, setPassword] = useState("");
1011
const [name, setName] = useState("");
@@ -73,7 +74,8 @@ const LoginPage = () => {
7374
Welcome!
7475
</h2>
7576
<p className="text-gray-600 mb-6">
76-
Logged in as <span className="font-semibold">{loggedInUser.name}</span>
77+
Logged in as{" "}
78+
<span className="font-semibold">{loggedInUser.name}</span>
7779
</p>
7880
<button
7981
type="button"
@@ -108,10 +110,13 @@ const LoginPage = () => {
108110
{error}
109111
</div>
110112
)}
111-
113+
112114
<form className="space-y-6">
113115
<div>
114-
<label htmlFor="email" className="block text-sm font-medium text-gray-700">
116+
<label
117+
htmlFor="email"
118+
className="block text-sm font-medium text-gray-700"
119+
>
115120
Email address
116121
</label>
117122
<div className="mt-1">
@@ -130,7 +135,10 @@ const LoginPage = () => {
130135
</div>
131136

132137
<div>
133-
<label htmlFor="password" className="block text-sm font-medium text-gray-700">
138+
<label
139+
htmlFor="password"
140+
className="block text-sm font-medium text-gray-700"
141+
>
134142
Password
135143
</label>
136144
<div className="mt-1">
@@ -149,7 +157,10 @@ const LoginPage = () => {
149157
</div>
150158

151159
<div>
152-
<label htmlFor="name" className="block text-sm font-medium text-gray-700">
160+
<label
161+
htmlFor="name"
162+
className="block text-sm font-medium text-gray-700"
163+
>
153164
Full Name
154165
</label>
155166
<div className="mt-1">
@@ -178,7 +189,7 @@ const LoginPage = () => {
178189
>
179190
{loading ? "Signing in..." : "Sign in"}
180191
</button>
181-
192+
182193
<button
183194
type="button"
184195
onClick={register}
@@ -195,4 +206,4 @@ const LoginPage = () => {
195206
);
196207
};
197208

198-
export default LoginPage;
209+
export default LoginPage;

0 commit comments

Comments
 (0)