Skip to content

Abhishek - fix lint rules and write yaml job - #1754

Merged
one-community merged 26 commits into
developmentfrom
abhishek_lint_test_automation
Nov 27, 2025
Merged

one-community merged 26 commits into
developmentfrom
abhishek_lint_test_automation

Conversation

@1709abhishek

@1709abhishek 1709abhishek commented Sep 25, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR implements mandatory linting and unit testing requirements for all backend pull requests to enforce code quality standards and eliminate manual tracking spreadsheets. The implementation includes automated GitHub Actions workflows, ESLint configuration with enterprise-level rules, Jest coverage enforcement at 60% threshold, and branch protection requirements that prevent merging without passing all checks.

Related PRS (if any):

This backend PR works in conjunction with the frontend PR(#4114) implementing similar linting and testing requirements for the React application.

Main changes explained:

updated .github/workflows/nodejs.yml for automated lint and test checks on every PR
Created jest.config.js with %age coverage thresholds for lines, functions, branches, and statements
Updated ESLint configuration with light enterprise rules (warnings-first approach for gradual adoption)
Added package.json scripts for coverage enforcement (test:ci, test:coverage, lint:check)
Configured Jest to collect coverage from all source files in src/, controllers/, routes/, services/, etc.
Set up coverage exclusions for test files, config files, migrations, and seeders
Implemented GitHub Actions workflow that fails PRs if linting errors exist or coverage falls below 60%

How to test:

Check out current branch
Run npm install to install dependencies
Run npm run lint to verify ESLint configuration works without errors
Run npm run test:ci to check current test coverage levels and verify 60% enforcement
Create a test branch with intentional linting errors (missing semicolon, console.log)
Push and create PR - verify GitHub Actions fails the lint check
Fix linting errors and push again - verify GitHub Actions passes
Verify that PRs cannot be merged without passing both lint and coverage checks
Check that coverage report shows realistic percentages for controllers, routes, and services

Screenshots or videos of changes:

Screenshot 2025-09-26 at 6 10 51 PM Screenshot 2025-09-26 at 6 15 05 PM

Note:

This PR establishes automated quality gates that completely eliminate manual tracking. The 60% coverage threshold will initially cause test failures for files lacking sufficient tests - teams should add unit tests gradually to meet requirements. No backend code can be merged without passing both ESLint checks and coverage thresholds. The ESLint configuration uses a warnings-first approach to ease developer adoption while maintaining enterprise standards. Also my suggestion is to increase %age coverage from now on gradually in all the modules so that we can follow 60% minimum testing criteria.

@1709abhishek 1709abhishek changed the title fix lint rules and write yaml job Abhishek - fix lint rules and write yaml job Oct 16, 2025
@one-community
one-community merged commit b999d13 into development Nov 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants