From c5581a6250bcd2196935e37495c3c78311a56679 Mon Sep 17 00:00:00 2001 From: Priyanshu suman Date: Fri, 6 Sep 2024 23:03:45 +0530 Subject: [PATCH] Implimented prittier into the github action --- .github/workflows/main.yml | 10 +++++++++- client/package-lock.json | 16 ++++++++++++++++ client/package.json | 11 +++++++---- server/package-lock.json | 16 ++++++++++++++++ server/package.json | 5 ++++- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e336802d5..62ae14e07 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,4 +87,12 @@ jobs: if [ -e "server/firebase-secret.json" ] || [ -e ".env" ]; then echo "Error: Found .env or firebase-secret.json in the pull request. Please remove them before merging." exit 1 - fi \ No newline at end of file + fi + + - name: Check Prettier Formatting + run: npm run format:check + working-directory: server/ + + - name: Check Prettier Formatting + run: npm run format:check + working-directory: client/ \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index e66df0b94..e7d960874 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -48,6 +48,7 @@ "eslint-config-expo": "^7.0.0", "jest": "^29.2.1", "jest-expo": "~51.0.1", + "prettier": "^3.3.3", "react-test-renderer": "18.2.0", "typescript": "~5.3.3" } @@ -18096,6 +18097,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/client/package.json b/client/package.json index e98a5f52c..5f89650b5 100644 --- a/client/package.json +++ b/client/package.json @@ -9,7 +9,9 @@ "ios": "expo start --ios", "web": "expo start --web", "test": "jest --watchAll", - "lint": "expo lint" + "lint": "expo lint", + "format": "prettier --write .", + "format:check": "prettier --check ." }, "jest": { "preset": "jest-expo" @@ -51,12 +53,13 @@ "@types/jest": "^29.5.12", "@types/react": "~18.2.45", "@types/react-test-renderer": "^18.0.7", + "eslint": "^8.57.0", + "eslint-config-expo": "^7.0.0", "jest": "^29.2.1", "jest-expo": "~51.0.1", + "prettier": "^3.3.3", "react-test-renderer": "18.2.0", - "typescript": "~5.3.3", - "eslint": "^8.57.0", - "eslint-config-expo": "^7.0.0" + "typescript": "~5.3.3" }, "private": true } diff --git a/server/package-lock.json b/server/package-lock.json index 81ce346a5..a8841ff06 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -27,6 +27,7 @@ "@types/jest": "^29.5.11", "jest": "^29.7.0", "nodemon": "^3.0.3", + "prettier": "^3.3.3", "socket.io-client": "^4.7.4", "ts-node": "^10.9.1", "typescript": "^5.2.2" @@ -7875,6 +7876,21 @@ "node": ">=8" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", diff --git a/server/package.json b/server/package.json index 463b48ee5..32f8fe40b 100644 --- a/server/package.json +++ b/server/package.json @@ -8,7 +8,9 @@ "start": "node build/index.js", "build": "npx tsc", "build:watch": "npx tsc -w", - "start:watch": "nodemon build/index.js" + "start:watch": "nodemon build/index.js", + "format": "prettier --write .", + "format:check": "prettier --check ." }, "author": "", "license": "ISC", @@ -19,6 +21,7 @@ "@types/jest": "^29.5.11", "jest": "^29.7.0", "nodemon": "^3.0.3", + "prettier": "^3.3.3", "socket.io-client": "^4.7.4", "ts-node": "^10.9.1", "typescript": "^5.2.2"