Cursor rule
.cursor/rules/strict-click-to-load.mdcSubagent task: Fix strict TypeScript errors in click-to-load files and add to CORE_FILES
Cursor rules
Quality
89/100
Scores the file, not the repository.Length
772 words
10 headings · 3 code blocksRepository
70
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.123456789# Strict TypeScript: Click-to-Load1011## Task1213Fix all strict-mode TypeScript errors in 2 click-to-load files and add them to `CORE_FILES`. This is the largest single-file effort (169 errors in click-to-load.js).1415## Branch1617```18git checkout main && git pull origin main && git checkout -b cursor/strict/click-to-load19```2021## Files (170 errors total)2223### `injected/src/features/click-to-load.js` (169 errors)2425**Key error categories:**26271. **Variables `styles`, `sharedStrings`, `config`, `appID`, `entities`, `readyToDisplayPlaceholdersResolver`, `afterPageLoadResolver` implicitly any (TS7034/TS7005)** — ~100 errors. These module-level variables are initialized as `undefined`/empty and assigned later. Add explicit `/** @type {X} */` at declaration.28292. **Property access on `Object` or `{}` typed params (TS2339/TS7053)** — ~30 errors. Config objects need proper typing. Define `@typedef` for the config shape, element data, etc.30313. **Parameter implicitly any (TS7006)** — ~5 errors. Add `@param` annotations.32334. **Type incompatibility (TS2322)** — `(originalElement: HTMLIFrameElement, ...)` vs `(originalElement: HTMLElement | HTMLIFrameElement, ...)`. Widen the parameter type.34355. **`this` implicitly any (TS2683)** — Arrow functions or explicit `@this` annotations.36376. **Cannot invoke possibly null (TS2721)** — Add null checks before invoking.38397. **No initializer (TS2564)** — `#messagingContext` property. Add `!` definite assignment assertion or initialize.40418. **displayMode index (TS7053)** — Cast the enum/string to the correct key type.4243**Strategy for `styles` variable (~80 of the 169 errors):** The `styles` variable is used extensively. Find where it's assigned (likely from config) and type it with a comprehensive `@typedef` capturing all style properties used throughout the file. A single proper type annotation at the declaration eliminates ~80 errors.4445**Strategy for `sharedStrings`:** Same approach — find the shape from config and type it.4647### `injected/src/features/click-to-load/components/ctl-login-button.js` (1 error)48```49(23,5): error TS2564: Property '#element' has no initializer and is not definitely assigned in the constructor.50```5152## Full Error List for click-to-load.js5354```55(31,5): TS7034: Variable 'appID' implicitly has type 'any'56(37,5): TS7034: Variable 'config' implicitly has type 'any'57(38,5): TS7034: Variable 'sharedStrings' implicitly has type 'any'58(39,5): TS7034: Variable 'styles' implicitly has type 'any'59(60,7): TS7034: Variable 'entities' implicitly has type 'any[]'60(69,5): TS7034: Variable 'readyToDisplayPlaceholdersResolver' implicitly has type 'any'61(77,5): TS7034: Variable 'afterPageLoadResolver' implicitly has type 'any'62(119,44): TS2339: Property 'clickAction' does not exist on type 'Object'63(120,43): TS2339: Property 'replaceSettings' does not exist on type 'Object'64(122,9): TS7008: Member 'placeholderElement' implicitly has an 'any' type65(195,13): TS7053: Element implicitly has an 'any' type (string index on {})66(238,34): TS7053: Element implicitly has an 'any' type67(240,34): TS7053: Element implicitly has an 'any' type68(268,31): TS2339: Property 'app_id_replace' does not exist on type '{}'69(268,49): TS7005: Variable 'appID' implicitly has an 'any' type70(269,95): TS7005: Variable 'appID' implicitly has an 'any' type71(273,29): TS7053: Element implicitly has an 'any' type72(330,24): TS7006: Parameter 'event' implicitly has an 'any' type73(414,30): TS7006: Parameter 'e' implicitly has an 'any' type74(450,49): TS7005: Variable 'styles' implicitly has an 'any' type75(456,52): TS7053: Element implicitly has an 'any' type (displayMode index)76(458,48): TS7005: Variable 'styles' implicitly has an 'any' type77(520,60): TS7053: Element implicitly has an 'any' type78(521,21): TS7006: Parameter 'e' implicitly has an 'any' type79(644-1964): ~140 more errors, mostly TS7005 for 'styles' and 'sharedStrings' variables80(1788,5): TS2564: Property '#messagingContext' has no initializer81(1792,16): TS7006: Parameter 'args' implicitly has an 'any' type82(1823-1867): TS7053/TS2339 on config entity indexing83(1894-1950): TS7005 for 'afterPageLoadResolver' and 'readyToDisplayPlaceholdersResolver'84(1905,13): TS2721: Cannot invoke possibly null85(1911,13): TS2721: Cannot invoke possibly null86(1921,12): TS7006: Parameter 'message' implicitly has an 'any' type87(1963-1964): TS7005 for 'config'88```8990## Fix Patterns9192- **Module-level variables**: Add `/** @type {X | undefined} */` where `X` is derived from usage. For `styles`, trace to where it's populated from config.93- **TS2564**: Use `/** @type {X} */ (#prop)` or add definite assignment `!` in declaration.94- **TS2339 on Object**: Define proper `@typedef` for the config/entity shapes.95- **TS2322 (HTMLIFrameElement vs union)**: Widen parameter to `HTMLElement | HTMLIFrameElement`.96- **TS2683 (this)**: Convert to arrow function or add `@this {Type}`.97- **TS2721**: Guard with `if (resolver) resolver()`.9899## Workflow1001011. `npm ci`1022. Add both files to CORE_FILES in `scripts/check-strict-core.js`1033. Fix errors — start with the `styles` and `sharedStrings` typedefs to eliminate bulk errors1044. `npm run tsc-strict-core` — must pass1055. `npm run test-unit` — must pass1066. `npm run lint` — must pass (run `npm run lint-fix` first if needed)1077. Commit: `fix(types): add strict checking for click-to-load files`1088. `git push -u origin cursor/strict/click-to-load`109110## Constraints111112- Do NOT use `any` — use `unknown`, specific types, or proper interfaces113- Do NOT use `@ts-ignore` or `@ts-expect-error`114- Do NOT modify files outside the assigned list (except `scripts/check-strict-core.js`)115- Do NOT remove existing CORE_FILES entries116- Preserve existing behavior — type fixes only, no logic changes117
Also in duckduckgo/content-scope-scripts
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| duckduckgo/content-scope-scriptstypes-generator/AGENTS.md · 70 | AGENTS.md | testarchtypesdo-not | 73/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-broker-protection-actions.mdc · 70 | Cursor rules | buildteststyletypes+4 | 93/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-broker-protection-rest.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-detectors.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-duckplayer-native.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-duckplayer.mdc · 70 | Cursor rules | setupteststyletypes+4 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-fingerprinting.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-message-bridge.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-a.mdc · 70 | Cursor rules | teststyletypesgit+4 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-b.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-c.mdc · 70 | Cursor rules | teststyletypesgit+4 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-web-compat-and-telemetry.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-zero-errors-batch.mdc · 70 | Cursor rules | testtypesgitdo-not+1 | 81/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsAGENTS.md · 70 | AGENTS.md | buildtestlint-formatstyle+5 | 83/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsinjected/AGENTS.md · 70 | AGENTS.md | buildteststylearch+2 | 92/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsmessaging/AGENTS.md · 70 | AGENTS.md | testarchtesting-strategyapi | 66/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago |
Diff against types-generator/AGENTS.md Diff against .cursor/rules/strict-broker-protection-actions.mdc Diff against .cursor/rules/strict-broker-protection-rest.mdc Diff against .cursor/rules/strict-detectors.mdc Diff against .cursor/rules/strict-duckplayer-native.mdc Diff against .cursor/rules/strict-duckplayer.mdc Diff against .cursor/rules/strict-fingerprinting.mdc Diff against .cursor/rules/strict-message-bridge.mdc Diff against .cursor/rules/strict-standalone-features-a.mdc Diff against .cursor/rules/strict-standalone-features-b.mdc Diff against .cursor/rules/strict-standalone-features-c.mdc Diff against .cursor/rules/strict-web-compat-and-telemetry.mdc Diff against .cursor/rules/strict-zero-errors-batch.mdc Diff against AGENTS.md Diff against injected/AGENTS.md Diff against messaging/AGENTS.md Diff against special-pages/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
