From f346bcafc02c937c6fe05068d6c68c71bd24b4b3 Mon Sep 17 00:00:00 2001 From: iamBadgers Date: Tue, 5 Mar 2024 12:36:42 -0800 Subject: [PATCH] add prettier to backend --- backend/.prettierrc.json | 8 ++++++++ backend/package-lock.json | 16 ++++++++++++++++ backend/package.json | 5 ++++- backend/src/app.ts | 14 +++++++------- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 backend/.prettierrc.json diff --git a/backend/.prettierrc.json b/backend/.prettierrc.json new file mode 100644 index 0000000..66e2335 --- /dev/null +++ b/backend/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": false, + "tabWidth": 2, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none" +} \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index 0d32110..7ef4d3f 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -16,6 +16,7 @@ "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", "eslint": "^8.57.0", + "prettier": "^3.2.5", "typescript": "^5.3.3" } }, @@ -2009,6 +2010,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", diff --git a/backend/package.json b/backend/package.json index 3007c07..fd8bbc2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -4,7 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "format": "prettier --write src/" }, "keywords": [], "author": "", @@ -14,6 +16,7 @@ "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", "eslint": "^8.57.0", + "prettier": "^3.2.5", "typescript": "^5.3.3" }, "dependencies": { diff --git a/backend/src/app.ts b/backend/src/app.ts index 2a287de..e6ba6cd 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -1,11 +1,11 @@ -import express from 'express'; -const app = express(); -const port = 3000; +import express from 'express' +const app = express() +const port = 3000 app.get('/', (req, res) => { - res.send('Hello World!'); -}); + res.send('Hello World!') +}) app.listen(port, () => { - return console.log(`Express is listening at http://localhost:${port}`); -}); + return console.log(`Express is listening at http://localhost:${port}`) +})