Skip to content

FEC-753: Add shared no-direct-currency formatting rule#3961

Merged
nima-ct merged 8 commits intomainfrom
FEC-753-no-direct-currency-formatting-rule
Apr 8, 2026
Merged

FEC-753: Add shared no-direct-currency formatting rule#3961
nima-ct merged 8 commits intomainfrom
FEC-753-no-direct-currency-formatting-rule

Conversation

@nima-ct
Copy link
Copy Markdown
Contributor

@nima-ct nima-ct commented Apr 2, 2026

Summary

This PR adds a bundled ESLint rule no-direct-currency-formatting to @commercetools-frontend/eslint-config-mc-app, exposed via @commercetools-frontend/eslint-config-mc-app/rules.

Description

Right now, the ESLint rule only exists in the Merchant Center frontend repo, so to have one common place and avoid repeating it across repos, we centralize it here to prevent incorrect money formatting usage.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mc-app-kit-playground Ready Ready Preview, Comment Apr 8, 2026 10:52am
merchant-center-application-kit-components-playground Ready Ready Preview, Comment Apr 8, 2026 10:52am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 2, 2026

🦋 Changeset detected

Latest commit: b4e2921

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@commercetools-frontend/eslint-config-mc-app Minor
@commercetools-applications/merchant-center-template-starter-typescript Minor
@commercetools-applications/merchant-center-template-starter Minor
@commercetools-applications/merchant-center-custom-view-template-starter-typescript Minor
@commercetools-applications/merchant-center-custom-view-template-starter Minor
@commercetools-backend/eslint-config-node Minor
@commercetools-backend/express Minor
@commercetools-backend/loggers Minor
@commercetools-frontend/actions-global Minor
@commercetools-frontend/application-components Minor
@commercetools-frontend/application-config Minor
@commercetools-frontend/application-shell-connectors Minor
@commercetools-frontend/application-shell Minor
@commercetools-frontend/assets Minor
@commercetools-frontend/babel-preset-mc-app Minor
@commercetools-frontend/browser-history Minor
@commercetools-frontend/codemod Minor
@commercetools-frontend/constants Minor
@commercetools-frontend/create-mc-app Minor
@commercetools-frontend/cypress Minor
@commercetools-frontend/i18n Minor
@commercetools-frontend/jest-preset-mc-app Minor
@commercetools-frontend/jest-stylelint-runner Minor
@commercetools-frontend/l10n Minor
@commercetools-frontend/mc-dev-authentication Minor
@commercetools-frontend/mc-html-template Minor
@commercetools-frontend/mc-scripts Minor
@commercetools-frontend/notifications Minor
@commercetools-frontend/permissions Minor
@commercetools-frontend/react-notifications Minor
@commercetools-frontend/sdk Minor
@commercetools-frontend/sentry Minor
@commercetools-frontend/url-utils Minor
@commercetools-local/playground Minor
@commercetools-local/visual-testing-app Minor
@commercetools-website/components-playground Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 94.88372% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.61%. Comparing base (831970f) to head (b4e2921).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3961      +/-   ##
==========================================
+ Coverage   71.91%   72.61%   +0.70%     
==========================================
  Files         263      264       +1     
  Lines        6801     7016     +215     
  Branches     2104     2192      +88     
==========================================
+ Hits         4891     5095     +204     
- Misses       1889     1898       +9     
- Partials       21       23       +2     
Components Coverage Δ
Application Components 81.18% <ø> (ø)
Application Shell 74.54% <ø> (ø)
Application Shell Connectors 77.54% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 831970f...b4e2921. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nima-ct nima-ct self-assigned this Apr 2, 2026
@nima-ct nima-ct marked this pull request as ready for review April 2, 2026 08:17
@nima-ct nima-ct requested a review from a team as a code owner April 2, 2026 08:17
@nima-ct nima-ct requested a review from a team April 2, 2026 08:17
misama-ct and others added 4 commits April 8, 2026 11:54
Use Jest projects in jest.test.config.js so custom ESLint rule tests
run in a node environment alongside the existing jsdom test suite.
Covers intl.formatNumber, destructured/aliased variants, Intl.NumberFormat,
variable-resolved options, spread elements, and <FormattedNumber /> from
react-intl. Includes cases proving the false-positive bug where non-currency
<FormattedNumber /> usage (percent, decimal, no style) is incorrectly flagged.
The eslint-rules project inherits Babel config resolution which loads
babel-plugin-istanbul, conflicting with Jest's own coverage instrumentation.
Setting transform: {} avoids this since the rule files are plain CommonJS.
@nima-ct nima-ct merged commit 8efed36 into main Apr 8, 2026
21 checks passed
@nima-ct nima-ct deleted the FEC-753-no-direct-currency-formatting-rule branch April 8, 2026 11:56
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.

4 participants