mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-24 14:05:50 +02:00
1.9 KiB
1.9 KiB
ESLint
Key Features
-
Automation:
- A pre-commit hook has been added to automatically run ESLint on the added or modified files, ensuring code quality before commits.
-
Manual Usage:
- If you prefer not to use the pre-commit hook, you can manually run ESLint to automatically fix issues using the command:
npx eslint --fix . or npm run eslint - Running this command will lint all files in the repository.
- If you prefer not to use the pre-commit hook, you can manually run ESLint to automatically fix issues using the command:
-
GitHub Action:
- A GitHub Action has been added to automatically run ESLint on every push and pull request, ensuring code quality in the CI/CD pipeline.
Summary of ESLint Rules
-
General Rules:
- Equality: Use
===and!==instead of==and!=(eqeqeq). - Indentation: Enforce 2-space indentation (
indent). - Quotes: Use doublequotes for strings (
quotes). - Variable Declarations:
- Disallow
var; useletorconst(no-var). - Prefer
constfor variables that are never reassigned (prefer-const).
- Disallow
- Unused Variables: Allow unused function parameters but enforce error for other unused variables (
@typescript-eslint/no-unused-vars). - End of Line: Ensure at least one newline at the end of files (
eol-last). - Curly Braces: Enforce the use of curly braces for all control statements (
curly). - Brace Style: Use one true brace style (
1tbs) for TypeScript-specific syntax (@typescript-eslint/brace-style).
- Equality: Use
-
TypeScript-Specific Rules:
- Semicolons:
- Enforce semicolons for TypeScript-specific syntax (
@typescript-eslint/semi). - Disallow unnecessary semicolons (
@typescript-eslint/no-extra-semi).
- Enforce semicolons for TypeScript-specific syntax (
- Semicolons:
Benefits
- Consistency: Ensures consistent coding style across the project.
- Code Quality: Helps catch potential errors and improve overall code quality.
- Readability: Makes the codebase easier to read and maintain.