RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/duckduckgo/content-scope-scripts

Cursor rule

.cursor/rules/strict-click-to-load.mdc

Subagent 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 blocks

Repository

70

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
duckduckgo/content-scope-scripts/.cursor/rules/strict-click-to-load.mdcRawGitHub
1---
2description: "Subagent task: Fix strict TypeScript errors in click-to-load files and add to CORE_FILES"
3globs:
4 - "scripts/check-strict-core.js"
5 - "injected/src/features/click-to-load.js"
6 - "injected/src/features/click-to-load/components/ctl-login-button.js"
7---
8 
9# Strict TypeScript: Click-to-Load
10 
11## Task
12 
13Fix 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).
14 
15## Branch
16 
17```
18git checkout main && git pull origin main && git checkout -b cursor/strict/click-to-load
19```
20 
21## Files (170 errors total)
22 
23### `injected/src/features/click-to-load.js` (169 errors)
24 
25**Key error categories:**
26 
271. **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.
28 
292. **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.
30 
313. **Parameter implicitly any (TS7006)** — ~5 errors. Add `@param` annotations.
32 
334. **Type incompatibility (TS2322)** — `(originalElement: HTMLIFrameElement, ...)` vs `(originalElement: HTMLElement | HTMLIFrameElement, ...)`. Widen the parameter type.
34 
355. **`this` implicitly any (TS2683)** — Arrow functions or explicit `@this` annotations.
36 
376. **Cannot invoke possibly null (TS2721)** — Add null checks before invoking.
38 
397. **No initializer (TS2564)** — `#messagingContext` property. Add `!` definite assignment assertion or initialize.
40 
418. **displayMode index (TS7053)** — Cast the enum/string to the correct key type.
42 
43**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.
44 
45**Strategy for `sharedStrings`:** Same approach — find the shape from config and type it.
46 
47### `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```
51 
52## Full Error List for click-to-load.js
53 
54```
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' type
65(195,13): TS7053: Element implicitly has an 'any' type (string index on {})
66(238,34): TS7053: Element implicitly has an 'any' type
67(240,34): TS7053: Element implicitly has an 'any' type
68(268,31): TS2339: Property 'app_id_replace' does not exist on type '{}'
69(268,49): TS7005: Variable 'appID' implicitly has an 'any' type
70(269,95): TS7005: Variable 'appID' implicitly has an 'any' type
71(273,29): TS7053: Element implicitly has an 'any' type
72(330,24): TS7006: Parameter 'event' implicitly has an 'any' type
73(414,30): TS7006: Parameter 'e' implicitly has an 'any' type
74(450,49): TS7005: Variable 'styles' implicitly has an 'any' type
75(456,52): TS7053: Element implicitly has an 'any' type (displayMode index)
76(458,48): TS7005: Variable 'styles' implicitly has an 'any' type
77(520,60): TS7053: Element implicitly has an 'any' type
78(521,21): TS7006: Parameter 'e' implicitly has an 'any' type
79(644-1964): ~140 more errors, mostly TS7005 for 'styles' and 'sharedStrings' variables
80(1788,5): TS2564: Property '#messagingContext' has no initializer
81(1792,16): TS7006: Parameter 'args' implicitly has an 'any' type
82(1823-1867): TS7053/TS2339 on config entity indexing
83(1894-1950): TS7005 for 'afterPageLoadResolver' and 'readyToDisplayPlaceholdersResolver'
84(1905,13): TS2721: Cannot invoke possibly null
85(1911,13): TS2721: Cannot invoke possibly null
86(1921,12): TS7006: Parameter 'message' implicitly has an 'any' type
87(1963-1964): TS7005 for 'config'
88```
89 
90## Fix Patterns
91 
92- **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()`.
98 
99## Workflow
100 
1011. `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 errors
1044. `npm run tsc-strict-core` — must pass
1055. `npm run test-unit` — must pass
1066. `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`
109 
110## Constraints
111 
112- Do NOT use `any` — use `unknown`, specific types, or proper interfaces
113- 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 entries
116- Preserve existing behavior — type fixes only, no logic changes
117 

Commands it names

  • git checkout main && git pull origin main && git checkout -b cursor/strict/click-to-load
  • npm ci
  • npm run tsc-strict-core
  • npm run test-unit
  • npm run lint
  • npm run lint-fix
  • git push -u origin cursor/strict/click-to-load

Sections

  • Strict TypeScript: Click-to-Load
  • Task
  • Branch
  • Files (170 errors total)
  • `injected/src/features/click-to-load.js` (169 errors)
  • `injected/src/features/click-to-load/components/ctl-login-button.js` (1 error)
  • Full Error List for click-to-load.js
  • Fix Patterns
  • Workflow
  • Constraints

What it covers

testcode-styletypesgit-prdo-notagent-behaviour

Stack — with the evidence

typescript

(1.00)

javascript

(1.00)

node

(1.00)

eslint

(1.00)

playwright

(0.70)

swift

(0.60)

github-actions

(0.60)

Glob targeting

  • scripts/check-strict-core.js
  • injected/src/features/click-to-load.js
  • injected/src/features/click-to-load/components/ctl-login-button.js

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
duckduckgo
Language
—
License
—
Archived
no

All configs in this repo

Also in duckduckgo/content-scope-scripts

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
duckduckgo/content-scope-scriptstypes-generator/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5testarchtypesdo-not73/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-broker-protection-actions.mdc · 70Cursor rulestypescriptjavascript+5buildteststyletypes+493/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-broker-protection-rest.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-detectors.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-duckplayer-native.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-duckplayer.mdc · 70Cursor rulestypescriptjavascript+5setupteststyletypes+489/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-fingerprinting.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-message-bridge.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-a.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+489/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-b.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-standalone-features-c.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+489/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-web-compat-and-telemetry.mdc · 70Cursor rulestypescriptjavascript+5teststyletypesgit+389/1003 days ago
duckduckgo/content-scope-scripts.cursor/rules/strict-zero-errors-batch.mdc · 70Cursor rulestypescriptjavascript+5testtypesgitdo-not+181/1003 days ago
duckduckgo/content-scope-scriptsAGENTS.md · 70AGENTS.mdtypescriptjavascript+6buildtestlint-formatstyle+583/1003 days ago
duckduckgo/content-scope-scriptsinjected/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+292/1003 days ago
duckduckgo/content-scope-scriptsmessaging/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5testarchtesting-strategyapi66/1003 days ago
duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+3100/1003 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.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack