Skip to content

Linting

In the Hybr1d Frontend Repository, we maintain high code quality standards through rigorous linting practices. ESLint is our primary tool for linting, ensuring that all code adheres to our defined standards.

The Role of ESLint

ESLint is a static code analysis tool used to identify problematic patterns in JavaScript code. It helps in:

  • Maintaining Code Quality: Ensuring code consistency and preventing errors.
  • Enforcing Coding Standards: Aligning code with our defined best practices and guidelines.
  • Improving Code Readability: Making the code more understandable and maintainable.

Integration of ESLint

ESLint is integrated into our development workflow:

  1. Configuration File: A .eslintrc file is included in the project root, specifying the rules and standards.
  2. Pre-commit Checks: ESLint runs as part of the pre-commit checks to ensure issues are addressed early in the development process.
  3. CI/CD Pipeline: The Continuous Integration/Continuous Deployment (CI/CD) pipeline includes an ESLint step. The pipeline fails if any linting warnings or errors are detected, ensuring no substandard code is merged into the main branch.

Addressing Linting Warnings

  • Mandatory Resolution: Developers must address all ESLint warnings and errors. Ignoring or bypassing these checks is not permitted.
  • Code Reviews: During code reviews, adherence to ESLint rules is strictly evaluated.
  • Automated Fixes: ESLint can automatically fix some issues. Developers should run the pnpm lint:fix command to automatically fix as many issues as possible.

Pre commit husky hook

We have a husky pre commit hook that runs pnpm lint before every commit. This ensures that no linting errors are committed to the repository.