Add ESLint TypeScript rules and translation validation
Summary
- Add ESLint rules for TypeScript strict typing (
no-explicit-any,consistent-type-assertions) - Add translation validation scripts to ensure translation consistency across locales
- Fix invalid translation key
search.no_results→search_page.no_results - Document all new rules and scripts in CLAUDE.md
Changes
ESLint TypeScript Rules
-
@typescript-eslint/no-explicit-any(warn) - discouragesanytype usage -
@typescript-eslint/consistent-type-assertions(warn) - discourages type assertions while allowingas constand object literals as parameters
Translation Validation Scripts
Two new scripts in scripts/ folder:
-
check-blog-translations.js - Cross-locale key sync
- Compares all locales against English reference
- Reports missing/extra keys per locale
-
check-blog-translation-usage.js - Code usage validation
- Scans for
t('key')and<Trans i18nKey="key"> - Reports keys used in code that don't exist
- Optional
--unusedflag for unused keys
- Scans for
Usage
pnpm --filter @hive/blog lint # ESLint with new rules
pnpm --filter @hive/blog lint:translations # Cross-locale validation
pnpm --filter @hive/blog lint:translations:usage # Code usage validation
Test plan
-
ESLint rules work and show warnings for
anytypes -
lint:translationsdetects missing keys across locales -
lint:translations:usagepasses after fixingsearch.no_results - Scripts handle edge cases (nested keys, dynamic keys, Trans component)