a2ui-project / a2ui-project/a2ui
Enforce 1P-compatible coding standards via Linting and TS Config
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.4k
- Forks
- 1.3k
- Merge medio
- 3 d 15 h
- PR fusionados (30 d)
- 134
Descripción
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.
Guía de contribución
Línea de trabajo
El trabajo implica tres cambios de configuración distintos. Primero, localiza el archivo de configuración de TypeScript (por ejemplo, `renderers/lit/tsconfig.json`) para añadir `"noImplicitOverride": true`. Segundo, busca la configuración de ESLint (`eslint.preset.mjs`) para añadir una regla `no-restricted-imports` para las importaciones de paquetes internos. Tercero, revisa los archivos `tsconfig.json` existentes para asegurarte de que `strict: true` esté establecido o añade las reglas de ESLint pertinentes. Comprueba la configuración de la canalización de CI para asegurarte de que estas comprobaciones se ejecuten. «Hecho» significa que la CI pasa con estas nuevas reglas aplicadas al código base.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- eslint, typescript
- Área
- build-system, ci-cd, tooling
- Tipo de issue
- Refactorización
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100