Skip to content

Conversation

@icodebyamanda
Copy link
Contributor

@icodebyamanda icodebyamanda commented Oct 17, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/72649045549333/task/1211479926220519?focus=true

Description

  • Add JSDoc type definitions matching element-hiding.ts schema
  • Cast getFeatureSetting return values to proper types with fallbacks
  • Update function parameter types to use new JSDoc types
  • Add type guards for union types (ElementHidingRule)
  • Preserve all original comments from codebase
  • Fix TypeScript compilation errors with proper null checks

This integrates the refactored schema types from privacy-configuration into the content-scope-scripts element-hiding feature for better type safety and maintainability.

Testing Steps

Checklist

Please tick all that apply:

  • [x ] I have tested this change locally
  • [x ] I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

Note

Add JSDoc typings across element-hiding and make feature settings access type-safe with sensible defaults, updating rule handling and selector usage accordingly.

  • Element-hiding typing:
    • Add JSDoc typedefs: ElementHidingValue, ElementHidingRuleHide, ElementHidingRuleModify, ElementHidingRuleWithoutSelector, ElementHidingRule, ElementHidingDomain, StyleTagException, ElementHidingConfiguration.
    • Update function params to use ElementHidingRule/ElementHidingValue; add targeted casts in injectStyleTag and hideAdNodes.
  • Configuration handling:
    • Cast getFeatureSetting results with defaults for adLabelStrings, useStrictHideStyleTag, hideTimeouts, unhideTimeouts, and mediaAndFormSelectors (explicit fallback string when falsy).
    • Retain conditional style-tag injection gated by styleTagExceptions.
  • Runtime touchpoints:
    • Ensure rule extraction/injection (extractTimeoutRules, injectStyleTag, applyRules) operate on typed ElementHidingRule[].

Written by Cursor Bugbot for commit 294e01b. This will update automatically on new commits. Configure here.

- Add JSDoc type definitions matching element-hiding.ts schema
- Cast getFeatureSetting return values to proper types with fallbacks
- Update function parameter types to use new JSDoc types
- Add type guards for union types (ElementHidingRule)
- Preserve all original comments from codebase
- Fix TypeScript compilation errors with proper null checks

This integrates the refactored schema types from privacy-configuration
into the content-scope-scripts element-hiding feature for better
type safety and maintainability.
@icodebyamanda icodebyamanda requested a review from a team as a code owner October 17, 2025 14:02
@netlify
Copy link

netlify bot commented Oct 17, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit 294e01b
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/68ff2f3fc754220008a2b55d
😎 Deploy Preview https://deploy-preview-2016--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Oct 17, 2025

[Beta] Generated file diff

Time updated: Mon, 27 Oct 2025 08:38:12 GMT

Android
    - android/contentScope.js

File has changed

Apple
    - apple/contentScope.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

@github-actions
Copy link

github-actions bot commented Oct 17, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

cursor[bot]

This comment was marked as outdated.

@laghee laghee requested a review from Copilot October 22, 2025 08:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive TypeScript type definitions to the element-hiding feature through JSDoc annotations, improving type safety and preventing runtime errors. The changes introduce a structured type system for element hiding rules and configurations, along with runtime guards to handle optional properties safely.

Key changes:

  • Introduces JSDoc typedefs for element hiding rules, values, domains, and configuration
  • Adds runtime type guards to prevent accessing properties on rules without selectors
  • Provides explicit type casts and fallback defaults for configuration settings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@laghee laghee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok -- made a few comments, but I don't see anything genuinely risky.

euw-arasolofotsara1 added 2 commits October 23, 2025 19:05
- Update TypeScript definitions to match new privacy configuration schema
- Split ElementHidingRuleWithSelector into ElementHidingRuleHide and ElementHidingRuleModify
- Make values required for modify rules, remove from hide rules
- Remove unnecessary 'selector' in rule guards from injectStyleTag() and hideAdNodes()
- Add type assertions to clarify that these functions only receive rules with selectors
- Improve code consistency and efficiency
@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Null Checks Mask Configuration Errors

The added null checks for rule.values before calling modifyAttribute and modifyStyle could mask configuration errors. According to the type definition ElementHidingRuleModify, the values property is required (not optional) for rules with type 'modify-attr' or 'modify-style'. A rule of these types without values doesn't make logical sense - what would it modify? The null check silently ignores such malformed rules instead of allowing them to fail and surface the configuration error. This changes the behavior from potentially throwing a helpful runtime error to silently doing nothing, which could hide real configuration issues.

Fix in Cursor Fix in Web

cursor[bot]

This comment was marked as outdated.

euw-arasolofotsara1 added 2 commits October 23, 2025 20:24
- Replace confusing self-referential fallback with explicit conditional
- Add comment explaining fallback to default value when setting is missing
- Make intent clear: fallback to hardcoded default, not preserve existing value
- Addresses feedback about unclear fallback pattern
…rors

- Remove if (rule.values) checks from modify-attr and modify-style cases
- Values property is required according to ElementHidingRuleModify typedef
- Null checks were masking configuration errors by silently ignoring malformed rules
- Now fails fast when values is missing, helping developers catch config issues early
- Fixes JSDoc type mismatch between required values property and null checks
cursor[bot]

This comment was marked as outdated.

@laghee laghee requested a review from Copilot October 27, 2025 09:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@icodebyamanda icodebyamanda added this pull request to the merge queue Oct 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 27, 2025
@dharb dharb added this pull request to the merge queue Oct 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 27, 2025
@icodebyamanda icodebyamanda added this pull request to the merge queue Nov 4, 2025
Merged via the queue into main with commit b0596b6 Nov 4, 2025
21 checks passed
@icodebyamanda icodebyamanda deleted the ar/c-s-s-automation-elementHiding branch November 4, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants