a2ui-project / a2ui-project/a2ui
Enforce 1P-compatible coding standards via Linting and TS Config
- Vorherrschende Sprache
- TypeScript
- Sterne
- 16.4k
- Forks
- 1.3k
- Ø Merge
- 3 T. 15 Std.
- Gemergte PRs (30 T.)
- 134
Beschreibung
To prevent new code from inadvertently breaking the Google 1P import process, we need to add several automated checks (formatting/linting) to our CI pipeline. This work should be completed following the merge of PR #1655.
### 1. Enforce `override` keyword (TypeScript)
We need to enable the `"noImplicitOverride": true` compiler option in our TypeScript configuration (e.g., `renderers/lit/tsconfig.json`).
* **Why**: This will force the compiler to throw an error if a developer overrides a method (such as Lit's `render()` or `updated()`) or a property (`static styles`) without explicitly providing the `override` keyword, maintaining compatibility with Google3's strict TypeScript compilation rules.
### 2. Prevent External Imports Inside Packages (ESLint)
We need to add the `no-restricted-imports` rule to our ESLint configuration (`eslint.preset.mjs` or package-specific configs).
* **Why**: To explicitly forbid importing from `@a2ui/lit/*` (or similar package names) from within that package's own source directories. This will enforce the use of relative imports (`../` or `./`) for internal file resolution, which is required for monorepo environments.
### 3. Enforce Strict Component Property Typing (TypeScript / ESLint)
We need to enhance our type strictness, either via `tsconfig.json` (`strict: true`) or specific ESLint rules like `@typescript-eslint/typedef`.
* **Why**: This ensures that properties (like input `type`s in `TextField`) are explicitly typed (e.g., `'text' | 'number' | 'password'`) rather than relying on loose string inference, preventing mismatched types downstream in Google3.
Beitragsleitfaden
Rechercherichtung
Die Arbeit umfasst drei unterschiedliche Konfigurationsänderungen. Erstens soll die TypeScript-Konfigurationsdatei (z. B. `renderers/lit/tsconfig.json`) gefunden werden, um `"noImplicitOverride": true` hinzuzufügen. Zweitens soll die ESLint-Konfiguration (`eslint.preset.mjs`) gefunden werden, um eine `no-restricted-imports`-Regel für Importe interner Pakete hinzuzufügen. Drittens sollen vorhandene `tsconfig.json`-Dateien überprüft werden, um sicherzustellen, dass `strict: true` gesetzt ist, oder es sollen relevante ESLint-Regeln hinzugefügt werden. Überprüfe die Konfiguration der CI-Pipeline, um sicherzustellen, dass diese Prüfungen ausgeführt werden. „Erledigt“ bedeutet, dass die CI mit diesen neuen, für die Codebasis geltenden Regeln erfolgreich durchläuft.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- eslint, typescript
- Bereich
- build-system, ci-cd, tooling
- Issue-Typ
- Refactoring
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100