Skip to content

Commit 9f68543

Browse files
committed
fix: biome configuration
1 parent 9b468ec commit 9f68543

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

biome.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
33
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4-
"files": { "ignoreUnknown": false, "ignore": ["dist"] },
4+
"files": { "ignoreUnknown": false, "includes": ["**", "!**/dist"] },
55
"formatter": {
66
"enabled": true,
77
"lineWidth": 120,
88
"bracketSpacing": true
99
},
10-
"organizeImports": { "enabled": true },
10+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
1111
"linter": {
1212
"enabled": true,
1313
"rules": {

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
"build": "tsc && tsup",
1212
"start:dev": "node --import=tsx --watch src/index.ts",
1313
"start:prod": "node dist/index.js",
14-
"lint": "biome lint --fix",
15-
"format": "biome format --write",
14+
"check": "biome check --write",
1615
"test": "vitest run",
17-
"test:cov": "vitest run --coverage",
18-
"check": "pnpm lint && pnpm format && pnpm build && pnpm test"
16+
"test:cov": "vitest run --coverage"
1917
},
2018
"dependencies": {
2119
"@asteasolutions/zod-to-openapi": "7.3.4",
@@ -46,9 +44,14 @@
4644
"vitest": "3.2.3"
4745
},
4846
"tsup": {
49-
"entry": ["src/index.ts"],
47+
"entry": [
48+
"src/index.ts"
49+
],
5050
"outDir": "dist",
51-
"format": ["esm", "cjs"],
51+
"format": [
52+
"esm",
53+
"cjs"
54+
],
5255
"target": "es2020",
5356
"sourcemap": true,
5457
"clean": true,

src/api/user/userRouter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { OpenAPIRegistry } from "@asteasolutions/zod-to-openapi";
22
import express, { type Router } from "express";
33
import { z } from "zod";
4-
5-
import { createApiResponse } from "@/api-docs/openAPIResponseBuilders";
64
import { GetUserSchema, UserSchema } from "@/api/user/userModel";
5+
import { createApiResponse } from "@/api-docs/openAPIResponseBuilders";
76
import { validateRequest } from "@/common/utils/httpHandlers";
87
import { userController } from "./userController";
98

src/common/__tests__/requestLogger.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("Request Logger Middleware", () => {
1313
app.get("/success", (_req, res) => {
1414
res.status(StatusCodes.OK).send("Success");
1515
});
16-
app.get("/redirect", (req, res) => res.redirect("/success"));
16+
app.get("/redirect", (_req, res) => res.redirect("/success"));
1717
app.get("/error", () => {
1818
throw new Error("Test error");
1919
});

src/common/middleware/requestLogger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const httpLogger = pinoHttp({
4444
},
4545
});
4646

47-
const captureResponseBody = (req: Request, res: Response, next: NextFunction) => {
47+
const captureResponseBody = (_req: Request, res: Response, next: NextFunction) => {
4848
if (!env.isProduction) {
4949
const originalSend = res.send;
5050
res.send = function (body) {

src/common/utils/httpHandlers.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ export const validateRequest = (schema: ZodSchema) => async (req: Request, res:
99
await schema.parseAsync({ body: req.body, query: req.query, params: req.params });
1010
next();
1111
} catch (err) {
12-
const errors = (err as ZodError).errors.map((e) => {
13-
const fieldPath = e.path.length > 0 ? e.path.join('.') : 'root';
14-
return `${fieldPath}: ${e.message}`;
15-
});
16-
17-
const errorMessage =
18-
errors.length === 1
19-
? `Invalid input: ${errors[0]}`
20-
: `Invalid input (${errors.length} errors): ${errors.join('; ')}`;
21-
22-
const statusCode = HTTP_STATUS_CODES.BAD_REQUEST;
23-
const serviceResponse = ServiceResponse.failure(errorMessage, null, statusCode);
24-
res.status(serviceResponse.statusCode).send(serviceResponse);
12+
const errors = (err as ZodError).errors.map((e) => {
13+
const fieldPath = e.path.length > 0 ? e.path.join(".") : "root";
14+
return `${fieldPath}: ${e.message}`;
15+
});
16+
17+
const errorMessage =
18+
errors.length === 1
19+
? `Invalid input: ${errors[0]}`
20+
: `Invalid input (${errors.length} errors): ${errors.join("; ")}`;
21+
22+
const statusCode = StatusCodes.BAD_REQUEST;
23+
const serviceResponse = ServiceResponse.failure(errorMessage, null, statusCode);
24+
res.status(serviceResponse.statusCode).send(serviceResponse);
2525
}
2626
};

src/server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import cors from "cors";
22
import express, { type Express } from "express";
33
import helmet from "helmet";
44
import { pino } from "pino";
5-
6-
import { openAPIRouter } from "@/api-docs/openAPIRouter";
75
import { healthCheckRouter } from "@/api/healthCheck/healthCheckRouter";
86
import { userRouter } from "@/api/user/userRouter";
7+
import { openAPIRouter } from "@/api-docs/openAPIRouter";
98
import errorHandler from "@/common/middleware/errorHandler";
109
import rateLimiter from "@/common/middleware/rateLimiter";
1110
import requestLogger from "@/common/middleware/requestLogger";

0 commit comments

Comments
 (0)