-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add automated linting and formatting enforcement #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add automated linting and formatting enforcement #70
Conversation
|
Hey @Janmesh23 |
|
Also, can the pipeline auto-run the prettify and commit the files?
If you need approval for the action when you push the code, just ask in this channel anybody will approve. |
Hi @lovestaco ! |
package.json
Outdated
| @@ -0,0 +1,6 @@ | |||
| { | |||
| "devDependencies": { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can delte this file, its propbably not needed
package-lock.json
Outdated
| "lockfileVersion": 3, | ||
| "requires": true, | ||
| "packages": {} | ||
| "packages": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can delte this file, its propbably not needed
| "dev": "node --max-old-space-size=16384 ./node_modules/astro/astro.js dev", | ||
| "start": "astro dev", | ||
| "build": "node --max-old-space-size=16384 ./node_modules/astro/astro.js build", | ||
| "build:mcp": "node scripts/build-mcp.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just revert these two lines, these are needed.
|
Hey @Janmesh23 ran the actions, it failed again, here is the link |

Description
This PR implements automated code quality enforcement to maintain consistent code standards across the project. Currently, there was no mechanism to enforce linting or formatting before code is committed, which could lead to inconsistent code style and quality issues.
Fixes : #56
This solution adds both local pre-commit enforcement (using Husky v9 + lint-staged) and server-side enforcement (using GitHub Actions) to ensure all code meets our quality standards before it's merged.
Key improvements:
Type of Change
How Has This Been Tested?
Test Environment:
Manual Testing Performed:
Test A: Local pre-commit hook validation
Test B: Auto-fixing functionality
Test C: Manual lint/format scripts
npm run lint→ Successfully checked all filesnpm run format:check→ Successfully validated formattingnpm run check→ Both checks passednpm run lint:fixandnpm run format→ Auto-fixed issuesTest D: ESLint v9 flat config validation
.astrofiles.tsxand.tsfilesTest E: Prettier with Astro plugin
.astrofiles → Correctly formattedReproduction Steps:
After (With enforcement):
Pre-commit Hook in Action
GitHub Actions CI Check
(CI workflow runs automatically on every PR and validates code quality)
Checklist
Additional Notes
What Changed?
New Files Added:
.github/workflows/lint.yml- GitHub Actions CI workflow for PR validationfrontend/.husky/pre-commit- Pre-commit hook that runs lint-stagedfrontend/eslint.config.js- ESLint v9 flat config with Astro + React supportfrontend/.prettierrc- Prettier configuration with Astro pluginfrontend/.prettierignore- Files to ignore from Prettier formattingModified Files:
frontend/package.json- Added lint/format scripts and lint-staged configurationfrontend/package-lock.json- Added new dependencies (Husky, ESLint, Prettier, plugins)Dependencies Added:
husky(v9) - Git hooks managementlint-staged- Run linters on staged fileseslint(v9) - JavaScript/TypeScript linterprettier- Code formattereslint-plugin-astro- Astro-specific ESLint rulesprettier-plugin-astro- Astro formatting support@typescript-eslint/*- TypeScript ESLint integrationeslint-plugin-react*- React-specific linting rulesglobals- Global variables definitions for ESLint v9For Contributors:
No changes to workflow! Developers continue using git normally:
The pre-commit hook runs automatically. If it fails, fix the reported errors and commit again.
Optional manual checks before committing:
Emergency bypass (not recommended):
git commit --no-verify -m "emergency commit"Benefits:
✅ Consistent code style - No more style debates in PRs
✅ Faster code reviews - Reviewers focus on logic, not formatting
✅ Prevents bad commits - Catch issues before they reach the repository
✅ Fast local checks - Only staged files are checked (not entire codebase)
✅ Modern tooling - ESLint v9 flat config, Husky v9, latest Prettier
✅ Full Astro support -
.astrofiles are properly linted and formattedKnown Limitations:
--no-verify(but CI will catch issues)npm installafter pulling the branchnpm run lintstill needed for verification)Future Enhancements:
NOTE : The changes might seem huge because while commit , the feature has formatted previously unformatted codebase