mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
2.8 KiB
2.8 KiB
Lint and TypeScript Failure Analysis
Summary of recurring failure categories
- Prettier formatting drifts. Multiple PRs required follow-up fixes solely for formatting (e.g., commits
27360b5,fe8e17e,64b8476,4f3e727,67decac). - Unused or mis-scoped imports/vars in UI flows and tests. Lint fixes such as removing unused ESLint disables or console statements and adjusting Cypress selectors surfaced repeatedly (e.g.,
477a6e4,05b88c7,67decac). - Missing type annotations in tests and utilities. Several commits added typings to satisfy lint/tsc in jest/cypress contexts (e.g.,
2096ca2,83f5716,8b3b2bb). - Prisma/type declaration gaps. Lint/tsc runs failed when generated Prisma types or domain types were not referenced explicitly (e.g., PR #951 added explicit Prisma type definitions to satisfy lint/tests).
- Large fixture or geojson files affecting tsc. CI changes added ignores for heavy data (e.g.,
f45ce2aexcluded country borders from lint/tsc) suggesting type-checking big JSON assets causes timeouts or memory pressure.
Recommended mitigations and guidelines
- Run formatters before pushing. Use
npm run lint -- --fixornpm run format(if available) prior to opening a PR to avoid formatter-only failures. - Keep test helpers typed. Add explicit parameter and return types in Jest/Cypress helpers; avoid implicit
anyand ensure async functions declarePromise<...>return types. - Prisma type availability. Ensure
prisma generatehas been run locally so generated types exist; import Prisma-generated types in service/tests rather than relying on implicitanyshapes. - Reduce unused code and console noise. Remove unused imports/variables early; prefer
debuglogging patterns overconsole.*in production code. Drop staleeslint-disabledirectives when no longer needed. - Scope lint/tsc includes. Confirm large JSON fixtures (e.g., country border data) remain excluded via
tsconfigexcludeor ESLintignorePatternsto keep checks performant. - Pre-flight local checks. Run
npm run lintandnpm run tscat least once per PR branch; if working in only frontend or backend, run the workspace-specific commands to catch env-specific rules.
Mapping categories to preventative actions
- Prettier drifts → automate via pre-commit hook or CI format check and always run formatter locally.
- Unused imports/console noise → enable IDE ESLint integration; clean up during development.
- Missing type annotations → configure TypeScript/Jest/Cypress typings globally and prefer typed helpers; avoid implicit anys.
- Prisma/type gaps → document the need to regenerate Prisma client after schema changes; commit necessary type files when applicable.
- Large fixtures → keep ignores up to date and consider typed stubs or schema-minimized fixtures for tests.