Description
Currently, our monorepo does not enforce linting rules before a commit is made. This means contributors might accidentally push code with formatting errors, trailing spaces, or unused variables, which then requires manual fixes or fails in CI.
To maintain high code quality and improve our Developer Experience (DX), we need to implement Husky and lint-staged. This will automatically run our linter on staged files right before a commit is created. If the linter fails, the commit will be blocked until the issues are fixed.
What needs to be done (Tasks)
Where to look
- Root
package.json
apps/web-dashboard/package.json (to see the existing lint commands)
Why this is important
This is a standard industry practice that saves reviewers time and ensures the urBackend codebase stays clean and consistent!
Skills Required
- Basic knowledge of Node.js &
package.json
- Git Hooks
- ESLint / Code Linting concepts
Description
Currently, our monorepo does not enforce linting rules before a commit is made. This means contributors might accidentally push code with formatting errors, trailing spaces, or unused variables, which then requires manual fixes or fails in CI.
To maintain high code quality and improve our Developer Experience (DX), we need to implement Husky and lint-staged. This will automatically run our linter on staged files right before a commit is created. If the linter fails, the commit will be blocked until the issues are fixed.
What needs to be done (Tasks)
huskyandlint-stagedas development dependencies in the rootpackage.json..huskyfolder).pre-commithook inside.husky/that triggersnpx lint-staged.lint-stagedconfiguration block in the rootpackage.json(or a.lintstagedrcfile) to run ESLint on all staged JavaScript/React files (*.js,*.jsx).npm run lint --workspace=web-dashboard(or equivalent eslint command) only on the files that are staged.package.jsonscripts to include"prepare": "husky install"so that husky hooks are automatically set up when someone runsnpm install.Where to look
package.jsonapps/web-dashboard/package.json(to see the existing lint commands)Why this is important
This is a standard industry practice that saves reviewers time and ensures the
urBackendcodebase stays clean and consistent!Skills Required
package.json