Cursor rule
.cursor/rules/strict-broker-protection-rest.mdcSubagent task: Fix strict TypeScript errors in remaining broker-protection files and add to CORE_FILES
Cursor rules
Quality
89/100
Scores the file, not the repository.Length
592 words
15 headings · 9 code blocksRepository
70
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.123456789101112131415# Strict TypeScript: Broker Protection (Rest)1617## Task1819Fix all strict-mode TypeScript errors in 8 remaining broker-protection files and add them to `CORE_FILES`.2021## Branch2223```24git checkout main && git pull origin main && git checkout -b cursor/strict/broker-protection-rest25```2627## Files (22 errors total)2829### `injected/src/features/broker-protection.js` (3 errors)30```31(44,66): error TS18046: 'e' is of type 'unknown'.32(80,20): error TS7006: Parameter 'action' implicitly has an 'any' type.33(121,43): error TS7006: Parameter 'x' implicitly has an 'any' type.34```3536### `injected/src/features/broker-protection/captcha-services/captcha.service.js` (1 error)37```38(80,26): error TS2345: Argument of type 'string | PirError' is not assignable to parameter of type 'object'.39```4041### `injected/src/features/broker-protection/captcha-services/providers/cloudflare-turnstile.js` (4 errors)42```43(74,30): error TS2345: Argument of type 'string | PirError' is not assignable to parameter of type 'object'.44(82,30): error TS2345: Argument of type 'HTMLElement | PirError | null' is not assignable to parameter of type 'object'.45(111,30): error TS2345: Argument of type 'string | PirError' is not assignable to parameter of type 'object'.46(122,24): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.47```4849### `injected/src/features/broker-protection/comparisons/address.js` (2 errors)50```51(17,42): error TS7006: Parameter 'stateAbbreviation' implicitly has an 'any' type.52(24,12): error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type (US state map).53```5455### `injected/src/features/broker-protection/comparisons/is-same-age.js` (2 errors)56```57(6,27): error TS7006: Parameter 'userAge' implicitly has an 'any' type.58(6,36): error TS7006: Parameter 'ageFound' implicitly has an 'any' type.59```6061### `injected/src/features/broker-protection/execute.js` (1 error)62```63(43,46): error TS18046: 'e' is of type 'unknown'.64```6566### `injected/src/features/broker-protection/extractors/address.js` (1 error)67```68(4,26): error TS7016: Could not find a declaration file for module 'parse-address'.69```7071### `injected/src/features/broker-protection/utils/utils.js` (8 errors)72```73(101,40): error TS7006: Parameter 'selector' implicitly has an 'any' type.74(116,37): error TS7006: Parameter 'selector' implicitly has an 'any' type.75(132,42): error TS7006: Parameter 'selector' implicitly has an 'any' type.76(151,45): error TS7006: Parameter 'selector' implicitly has an 'any' type.77(239,13): error TS2314: Generic type 'Array<T>' requires 1 type argument(s).78(242,28): error TS7006: Parameter 'a' implicitly has an 'any' type.79(242,31): error TS7006: Parameter 'b' implicitly has an 'any' type.80(256,34): error TS7006: Parameter 'profile' implicitly has an 'any' type.81```8283## Fix Patterns8485- **TS7006** (Parameter implicitly any): Add `@param {Type}` JSDoc.86- **TS18046** ('e' is unknown): Use `error instanceof Error ? error.message : String(error)` pattern.87- **TS2345** (Argument not assignable): Narrow types with guards or adjust the function signature upstream.88- **TS7016** (No declaration file for module): Add `// @ts-ignore` only as last resort, or create a minimal `.d.ts` declaration in the project. Better: use `/** @type {import('parse-address')} */` if types exist, or `/** @type {Record<string, Function>} */` for the default import.89- **TS2314** (Generic requires type args): Change `Array` → `Array<string>` or appropriate type.90- **TS7053/TS7015** (No index signature): Cast with `Record<string, X>` or narrow the index.9192## Workflow93941. `npm ci`952. Add all 8 files to CORE_FILES in `scripts/check-strict-core.js`963. Fix each file's errors974. `npm run tsc-strict-core` — must pass985. `npm run test-unit` — must pass996. `npm run lint` — must pass (run `npm run lint-fix` first if needed)1007. Commit: `fix(types): add strict checking for broker-protection files`1018. `git push -u origin cursor/strict/broker-protection-rest`102103## Constraints104105- Do NOT use `any` — use `unknown`, specific types, or proper interfaces106- Do NOT use `@ts-ignore` or `@ts-expect-error` (except for the `parse-address` module if no types exist)107- Do NOT modify files outside the assigned list (except `scripts/check-strict-core.js`)108- Do NOT remove existing CORE_FILES entries109- Preserve existing behavior — type fixes only, no logic changes110
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-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-actions.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 | |
| 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 |
