Skip to content

Update Javascript linting config to specify expected text domain #4578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 14, 2025

Conversation

daledupreez
Copy link
Contributor

Towards STRIPE-453

Changes proposed in this Pull Request:

This PR tackles three closely related linting improvements:

  • We now include the @wordpress/i18n-text-domain rule in our Javascript linting configuration, and we have it configured to require the woocommerce-gateway-stripe text domain.
  • Three locations that were not using the correct text domain have now been fixed
  • We now exclude a few directories from Javascript linting -- these directories don't contain Javascript sources files, but may contain files that could otherwise be picked up by the linting checks. The directories are as follows:
    • build/
    • node_modules/
    • phpunit-html/
    • release/
    • vendor/

Testing instructions

  • Inspect the translation changes and verify that they look correct

  • Check out this branch locally

  • Run npx eslint . --ext=js,jsx,ts,tsx and verify that it completes quickly and no errors are reported

  • Manually modify one call to __() in a Javascript file to specify no text domain, and another to specify an incorrect text domain

  • Run npx eslint . --ext=js,jsx,ts,tsx and verify that both changes above are flagged due to the incorrect text domain.


  • [N/A] Covered with tests (or have a good reason not to test in description ☝️)
  • [N/A] Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@daledupreez daledupreez requested review from a team and Copilot August 12, 2025 14:55
@daledupreez daledupreez self-assigned this Aug 12, 2025
@daledupreez daledupreez requested review from diegocurbelo and wjrosa and removed request for a team August 12, 2025 14:55
Copy link
Contributor

@Copilot 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 improves JavaScript translation handling by enforcing consistent text domain usage through ESLint configuration. It ensures all translatable strings use the correct woocommerce-gateway-stripe text domain.

  • Adds ESLint rule to enforce woocommerce-gateway-stripe text domain for all JavaScript translations
  • Fixes three incorrect text domain usages in existing code
  • Excludes non-source directories from linting to improve performance

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.eslintrc.js Adds i18n text domain rule and excludes build/vendor directories from linting
client/stripe-utils/cash-app-limit-notice-handler.js Adds missing text domain parameter to translation function
client/settings/stripe-account-connected-notice/index.js Corrects text domain from 'woocommerce' to 'woocommerce-gateway-stripe'
client/settings/general-settings-section/payment-method-checkbox.js Adds missing text domain parameter to translation function
readme.txt Documents the fix in changelog
changelog.txt Documents the fix in changelog

Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

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

Nice fix, Dale. Changes look good 👍

Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@daledupreez
Copy link
Contributor Author

Merging, as the e2e test failures look unrelated to these changes.

@daledupreez daledupreez merged commit 0348bb0 into develop Aug 14, 2025
38 of 40 checks passed
@daledupreez daledupreez deleted the update/linting-config-to-specify-expected-domain branch August 14, 2025 09:42
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