Cursor rule
.cursor/rules/strict-broker-protection-actions.mdcSubagent task: Fix strict TypeScript errors in broker-protection action files and add to CORE_FILES
Cursor rules
Quality
93/100
Scores the file, not the repository.Length
820 words
14 headings · 8 code blocksRepository
70
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1234567891011121314# Strict TypeScript: Broker Protection Actions1516## Task1718Fix all strict-mode TypeScript errors in 7 broker-protection action files and add them to `CORE_FILES`.1920## Branch2122```23git checkout main && git pull origin main && git checkout -b cursor/strict/broker-protection-actions24```2526## Files (39 errors total)2728### `injected/src/features/broker-protection/actions/build-url.js` (3 errors)29```30(11,26): error TS7006: Parameter 'action' implicitly has an 'any' type.31(27,37): error TS7006: Parameter 'action' implicitly has an 'any' type.32(27,45): error TS7006: Parameter 'userData' implicitly has an 'any' type.33```3435### `injected/src/features/broker-protection/actions/build-url-transforms.js` (5 errors)36```37(68,52): error TS7006: Parameter 'range' implicitly has an 'any' type.38(149,41): error TS2345: Argument of type 'string | number | undefined' is not assignable to parameter of type 'string | number'.39(168,50): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.40(177,21): error TS7006: Parameter 's' implicitly has an 'any' type.41(179,41): error TS7006: Parameter 'word' implicitly has an 'any' type.42```4344### `injected/src/features/broker-protection/actions/captcha-callback.js` (12 errors)45```46(13,16): error TS2532: Object is possibly 'undefined'.47(13,27): error TS2339: Property 'function' does not exist on type '{ id: string; version: string; }'.48(15,13): error TS2532: Object is possibly 'undefined'.49(15,24): error TS2339: Property 'function' does not exist on type '{ id: string; version: string; }'.50(16,54): error TS2532: Object is possibly 'undefined'.51(16,65): error TS2339: Property 'callback' does not exist on type '{ id: string; version: string; }'.52(50,26): error TS2339: Property 'pageurl' does not exist on type '{ id: string; version: string; }'.53(56,26): error TS2339: Property 'sitekey' does not exist on type '{ id: string; version: string; }'.54(60,30): error TS2339: Property 'callback' does not exist on type '{ id: string; version: string; }'.55(61,30): error TS2339: Property 'function' does not exist on type '{ id: string; version: string; }'.56(63,30): error TS2339: Property 'function' does not exist on type '{ id: string; version: string; }'.57(64,30): error TS2339: Property 'callback' does not exist on type '{ id: string; version: string; }'.58```5960### `injected/src/features/broker-protection/actions/captcha-deprecated.js` (1 error)61```62(95,30): error TS7006: Parameter 'action' implicitly has an 'any' type.63```6465### `injected/src/features/broker-protection/actions/click.js` (6 errors)66```67(48,102): error TS18046: 'error' is of type 'unknown'.68(69,31): error TS18048: 'elem' is possibly 'undefined'.69(74,28): error TS18048: 'elem' is possibly 'undefined'.70(196,63): error TS18046: 'error' is of type 'unknown'.71(203,79): error TS18046: 'error' is of type 'unknown'.72(211,72): error TS18046: 'error' is of type 'unknown'.73```7475### `injected/src/features/broker-protection/actions/extract.js` (9 errors)76```77(94,37): error TS7006: Parameter '_' implicitly has an 'any' type.78(94,40): error TS7006: Parameter 'value' implicitly has an 'any' type.79(141,13): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.80(156,13): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.81(173,28): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ profileUrl: ... }'.82(177,28): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ profileUrl: ... }'.83(205,11): error TS7034: Variable 'matchedFields' implicitly has type 'any[]'.84(211,18): error TS7005: Variable 'matchedFields' implicitly has an 'any[]' type.85(376,27): error TS7006: Parameter 'link' implicitly has an 'any' type.86```8788### `injected/src/features/broker-protection/actions/fill-form.js` (3 errors)89```90(111,31): error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type (US state map).91(232,25): error TS7006: Parameter 'element' implicitly has an 'any' type.92(258,40): error TS18046: 'e' is of type 'unknown'.93```9495## Fix Patterns9697- **TS7006** (Parameter implicitly any): Add `@param {Type}` JSDoc annotations. Look at how the param is used and what calling code passes.98- **TS2339** (Property doesn't exist): The type `{ id: string; version: string; }` in captcha-callback.js is too narrow — find the actual type definition or extend it with the missing properties via `@typedef`.99- **TS2532/TS18048** (Possibly undefined): Add null checks before accessing.100- **TS18046** ('error' is unknown): Cast or check `error instanceof Error` before accessing `.message`.101- **TS7053** (No index signature): Use `Record<string, X>` casts or narrow index types.102- **TS7034/TS7005** (Variable implicitly any): Add explicit type annotations at declaration.103- **TS2345** (Argument not assignable): Add null/undefined guards or narrow types.104105## Workflow1061071. `npm ci`1082. Add all 7 files to CORE_FILES in `scripts/check-strict-core.js`1093. Fix each file's errors using JSDoc type annotations1104. `npm run tsc-strict-core` — must pass1115. `npm run test-unit` — must pass1126. `npm run lint` — must pass (run `npm run lint-fix` first if needed)1137. Commit: `fix(types): add strict checking for broker-protection action files`1148. `git push -u origin cursor/strict/broker-protection-actions`115116## Constraints117118- Do NOT use `any` — use `unknown`, specific types, or proper interfaces119- Do NOT use `@ts-ignore` or `@ts-expect-error`120- Do NOT modify files outside the assigned list (except `scripts/check-strict-core.js`)121- Do NOT remove existing CORE_FILES entries122- Preserve existing behavior — type fixes only, no logic changes123
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-rest.mdc · 70 | Cursor rules | teststyletypesgit+3 | 89/100 | 3 days ago | |
| duckduckgo/content-scope-scripts.cursor/rules/strict-click-to-load.mdc · 70 | Cursor rules | teststyletypesgit+2 | 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-rest.mdc Diff against .cursor/rules/strict-click-to-load.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 | |
| dodgecfr/combatfilms-webapp.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 | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago |
