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 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 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..3bc4cfe 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}": [ @@ -92,6 +93,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",