name: lint-fix description: Run ESLint and Prettier to check and auto-fix code quality issues in the Ghostfolio project disable-model-invocation: true allowed-tools: Bash, Read, Glob argument-hint: "[check|fix|affected]"
Ghostfolio Lint & Format Fixer
Run ESLint and Prettier to catch and fix issues before commits. The Husky pre-commit hook enforces these, so fixing early saves time.
Project Configuration
- ESLint: v9.35.0 with flat config (
eslint.config.cjs)- NX module boundary enforcement
- Angular-specific rules (@angular-eslint)
- TypeScript support (@typescript-eslint 8.43.0)
- Prettier: v3.8.1
- Import sorting:
@ghostfolio/first, then third-party, then relative - 80 char width, 2 spaces, single quotes, no trailing commas
- Import sorting:
- Pre-commit hook: Runs lint + format:check on affected files
Commands
Based on $ARGUMENTS:
check (default if no argument)
Check for lint and format issues without fixing:
cd /home/james-allen/Projects/ghostfolio && npx nx run-many --target=lint --all --parallel=4
cd /home/james-allen/Projects/ghostfolio && npx nx format:check
Report all issues found, grouped by file.
fix
Auto-fix all fixable lint and format issues:
cd /home/james-allen/Projects/ghostfolio && npx nx run-many --target=lint --all --parallel=4 --fix
cd /home/james-allen/Projects/ghostfolio && npx nx format:write
Then re-run check to report any remaining issues that need manual fixing.
affected
Only check/fix files affected by current changes (matches pre-commit behavior):
cd /home/james-allen/Projects/ghostfolio && npx nx affected --target=lint --base=main --head=HEAD --parallel=2
cd /home/james-allen/Projects/ghostfolio && npx nx format:check --uncommitted
Prettier Rules Summary
When fixing issues manually, follow these rules:
- Quotes: Single quotes (
') not double - Trailing commas: None
- Semicolons: Required
- Print width: 80 characters
- Tab width: 2 spaces
- End of line: Auto
- Import order:
@ghostfolio/imports (internal)- Third-party modules
- Relative imports (
./,../)
- Blank line between each group
Common Issues
- Module boundary violations: Imports crossing NX project boundaries. Fix by using proper
@ghostfolio/path aliases. - Unused imports: Remove them.
- Import ordering: Let Prettier fix this automatically with
format:write. - Angular template issues: Check for
@angular-eslintrule violations.