Skip to content

Commit db65b81

Browse files
committed
introduce prettier
1 parent 2f5c7c5 commit db65b81

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

.prettierignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dist
2+
lib
3+
.gitignore
4+
*.snap
5+
*.svg
6+
*.png
7+
*.jpeg
8+
*.jpg
9+
*.md

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"lint": "eslint . --ext .ts",
9+
"prettier:fix": "npx prettier --write 'src/**/*'",
910
"build": "rm -rf dist && npm run build-ts",
1011
"build-ts": "tsc",
1112
"serve": "node dist/server.js",
@@ -31,6 +32,7 @@
3132
"concurrently": "^4.1.0",
3233
"eslint": "^8.35.0",
3334
"nodemon": "^2.0.21",
35+
"prettier": "^2.8.4",
3436
"typescript": "^4.9.5"
3537
}
3638
}

src/api/example/controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request, Response } from "express";
1+
import { Request, Response } from 'express';
22

33
export const get = (req: Request, res: Response) => {
44
res.status(200).send({});

src/api/example/index.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export default class ExampleApi implements API {
1111
}
1212

1313
setupApi() {
14-
this.router.get(
15-
'/example',
16-
exampleMW.canGet,
17-
exampleCtrl.get
18-
);
14+
this.router.get('/example', exampleMW.canGet, exampleCtrl.get);
1915
}
2016
}

src/api/example/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request, Response, NextFunction } from "express";
1+
import { Request, Response, NextFunction } from 'express';
22

33
export const canGet = (req: Request, res: Response, next: NextFunction) => {
44
return next();

src/api/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import ExampleApi from "./example";
1+
import ExampleApi from './example';
22

3-
import { Router, Express } from "express";
3+
import { Router, Express } from 'express';
44

55
export const setupApis = (application: Express) => {
66
const router = Router();
77
const exampleApi = new ExampleApi(router);
88

99
exampleApi.setupApi();
1010

11-
application.use("/api", router);
11+
application.use('/api', router);
1212
};
1313

1414
export interface API {

0 commit comments

Comments
 (0)