From e2775b1375e82e3d2434760408a853458874e037 Mon Sep 17 00:00:00 2001 From: oxcodexo Date: Sat, 12 Apr 2025 19:06:32 +0100 Subject: [PATCH 1/5] chore(prettier): align with common defaults and extend with file-specific rules --- .prettierrc.json | 29 +++++++++++++--- package-lock.json | 84 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + 3 files changed, 107 insertions(+), 7 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 890990e..604fcf4 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,10 +1,29 @@ { - "semi": true, - "singleQuote": true, "printWidth": 100, "tabWidth": 2, - "trailingComma": "es5", - "jsxSingleQuote": true, + "useTabs": false, + "semi": true, + "singleQuote": true, + "jsxSingleQuote": false, + "trailingComma": "all", + "bracketSpacing": true, "bracketSameLine": false, - "arrowParens": "always" + "arrowParens": "always", + "endOfLine": "lf", + "overrides": [ + { + "files": "*.md", + "options": { + "printWidth": 80, + "proseWrap": "always" + } + }, + { + "files": "*.{ts,tsx}", + "options": { + "parser": "typescript" + } + } + ], + "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/package-lock.json b/package-lock.json index 359f188..de37812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vite_react_shadcn_ts", - "version": "1.11.1", + "version": "1.11.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vite_react_shadcn_ts", - "version": "1.11.1", + "version": "1.11.2", "dependencies": { "@hookform/resolvers": "^3.9.0", "@radix-ui/react-accordion": "^1.2.0", @@ -76,6 +76,7 @@ "lovable-tagger": "^1.1.7", "postcss": "^8.4.47", "prettier": "^3.5.3", + "prettier-plugin-tailwindcss": "^0.6.11", "tailwindcss": "^3.4.11", "typescript": "^5.8.3", "typescript-eslint": "^8.0.1", @@ -6526,6 +6527,85 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-tailwindcss": { + "version": "0.6.11", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.11.tgz", + "integrity": "sha512-YxaYSIvZPAqhrrEpRtonnrXdghZg1irNg4qrjboCXrpybLWVs55cW2N3juhspVJiO0JBvYJT8SYsJpc8OQSnsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.21.3" + }, + "peerDependencies": { + "@ianvs/prettier-plugin-sort-imports": "*", + "@prettier/plugin-pug": "*", + "@shopify/prettier-plugin-liquid": "*", + "@trivago/prettier-plugin-sort-imports": "*", + "@zackad/prettier-plugin-twig": "*", + "prettier": "^3.0", + "prettier-plugin-astro": "*", + "prettier-plugin-css-order": "*", + "prettier-plugin-import-sort": "*", + "prettier-plugin-jsdoc": "*", + "prettier-plugin-marko": "*", + "prettier-plugin-multiline-arrays": "*", + "prettier-plugin-organize-attributes": "*", + "prettier-plugin-organize-imports": "*", + "prettier-plugin-sort-imports": "*", + "prettier-plugin-style-order": "*", + "prettier-plugin-svelte": "*" + }, + "peerDependenciesMeta": { + "@ianvs/prettier-plugin-sort-imports": { + "optional": true + }, + "@prettier/plugin-pug": { + "optional": true + }, + "@shopify/prettier-plugin-liquid": { + "optional": true + }, + "@trivago/prettier-plugin-sort-imports": { + "optional": true + }, + "@zackad/prettier-plugin-twig": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + }, + "prettier-plugin-css-order": { + "optional": true + }, + "prettier-plugin-import-sort": { + "optional": true + }, + "prettier-plugin-jsdoc": { + "optional": true + }, + "prettier-plugin-marko": { + "optional": true + }, + "prettier-plugin-multiline-arrays": { + "optional": true + }, + "prettier-plugin-organize-attributes": { + "optional": true + }, + "prettier-plugin-organize-imports": { + "optional": true + }, + "prettier-plugin-sort-imports": { + "optional": true + }, + "prettier-plugin-style-order": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + } + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", diff --git a/package.json b/package.json index e281fe1..59682a3 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "lovable-tagger": "^1.1.7", "postcss": "^8.4.47", "prettier": "^3.5.3", + "prettier-plugin-tailwindcss": "^0.6.11", "tailwindcss": "^3.4.11", "typescript": "^5.8.3", "typescript-eslint": "^8.0.1", From 2389743a526f8a6764596ac6c23537074c2061d2 Mon Sep 17 00:00:00 2001 From: oxcodexo Date: Sat, 12 Apr 2025 19:11:25 +0100 Subject: [PATCH 2/5] chore(husky): improve Husky hooks with better status feedback --- .husky/pre-commit | 14 +++++++++++++- .husky/pre-push | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 0bd3cd0..abd12f8 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,14 @@ #!/bin/sh -npx lint-staged \ No newline at end of file + +echo "๐Ÿงน Running Prettier & ESLint on staged files..." + +npx lint-staged + +RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "โŒ Commit aborted due to lint errors or formatting issues." + exit 1 +else + echo "โœ… All good! Proceeding with commit." +fi \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push index c171672..ddd020b 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,2 +1,14 @@ #!/bin/sh -npm run typecheck \ No newline at end of file + +echo "๐Ÿ” Running TypeScript type check..." + +npm run typecheck + +RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "โŒ Push aborted due to TypeScript errors." + exit 1 +else + echo "โœ… No TypeScript errors. Proceeding with push." +fi From 2a2c6cd04a0e516c178c872c0df19e3a9c93f870 Mon Sep 17 00:00:00 2001 From: oxcodexo Date: Sat, 12 Apr 2025 19:15:11 +0100 Subject: [PATCH 3/5] feat(github-actions): add automated code quality workflow on new PR or push --- .github/workflows/check.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..f8e2ecf --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,22 @@ +name: Code Quality Check + +on: [push, pull_request] + +jobs: + lint-format-typecheck: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run format, lint, and typecheck + run: npm run check From 313e1e4b3d0a83175dad446f3b14de726a8ddb40 Mon Sep 17 00:00:00 2001 From: oxcodexo <125923858+oxcodexo@users.noreply.github.com> Date: Sat, 12 Apr 2025 19:32:34 +0100 Subject: [PATCH 4/5] fix(package.json): add check script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 59682a3..fe214ab 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "format": "prettier --write .", "typecheck": "tsc --noEmit", "lint:fix": "eslint . --fix", - "lint": "eslint ." + "lint": "eslint .", + "check": "npm run format && npm run lint && npm run typecheck", }, "lint-staged": { "**/*.{js,jsx,ts,tsx}": [ From ebd9d6935fc6c2ba2de9ea0a27122ae0fbe899b8 Mon Sep 17 00:00:00 2001 From: oxcodexo <125923858+oxcodexo@users.noreply.github.com> Date: Sat, 12 Apr 2025 19:37:07 +0100 Subject: [PATCH 5/5] fix(package.json): remove trailing comma --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fe214ab..3bc4cfe 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "typecheck": "tsc --noEmit", "lint:fix": "eslint . --fix", "lint": "eslint .", - "check": "npm run format && npm run lint && npm run typecheck", + "check": "npm run format && npm run lint && npm run typecheck" }, "lint-staged": { "**/*.{js,jsx,ts,tsx}": [