a2ui-project / a2ui-project/a2ui

Enforce 1P-compatible coding standards via Linting and TS Config

オープン
#1,667 コメント 1 件 リアクション 0 件 担当者 1 名 @josemontespg に割り当て済み GitHub で見る
component: lit renderer P2 type: feature/enhancement
主要言語
TypeScript
スター
16.4k
フォーク
1.3k
平均マージ
3日 15時間
マージ済み PR(30日)
134

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

作業には、3つの異なる設定変更が含まれます。まず、TypeScript設定ファイル(例: `renderers/lit/tsconfig.json`)を見つけて、`"noImplicitOverride": true` を追加します。次に、ESLint設定(`eslint.preset.mjs`)を見つけて、内部パッケージのインポートに対する `no-restricted-imports` ルールを追加します。最後に、既存の `tsconfig.json` ファイルを確認し、`strict: true` が設定されていることを確認するか、関連するESLintルールを追加します。これらのチェックが実行されることを確認するため、CIパイプラインの設定を確認します。「完了」とは、コードベースにこれらの新しいルールを適用した状態でCIが成功することを意味します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
eslint, typescript
領域
build-system, ci-cd, tooling
issue の種類
リファクタリング
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。