Skip to content

[2.4.0 stack 7/18] Public API: root exports, types, 100% coverage and type-aware lint gates - #512

Open
hyanmandian wants to merge 2 commits into
stack/05-new-utilsfrom
stack/06-public-api
Open

[2.4.0 stack 7/18] Public API: root exports, types, 100% coverage and type-aware lint gates#512
hyanmandian wants to merge 2 commits into
stack/05-new-utilsfrom
stack/06-public-api

Conversation

@hyanmandian

@hyanmandian hyanmandian commented Sep 9, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Part 7 of 18 of the 2.4.0 release stack (main <- stack/01-tooling <- ... <- stack/11-testing). The package-root exports (src/index.ts, 124 exports plus 10 deprecated aliases kept for compatibility), the public type re-exports and the Bun/Deno test runtime shim refresh. Closes with the commit that turns on type-aware lint with type checking and the 100% coverage thresholds, now that the whole tree meets them.

Commits in this part (2)

  • 6c67309 feat: export public types from the package root
  • 17a50c9 ci(test): enforce 100% coverage and type-aware lint

How to review and merge

  • Review each part on its own; the diff of this PR is exactly the commits above.
  • Every part is green on its own: each branch builds, lints, passes the tests on Node 20/22/24/26, Bun, Deno and the four browsers, and passes the tree-shaking check against the part below it.
  • Do not merge the lower parts individually. When all eighteen are approved, retarget [2.4.0 stack 18/18] Review rounds 3 to 5: holidays, date-fns business days, capitalize defaults, currency, words, CEP typed errors, subpath types, citations #520 to main and merge it with a merge commit: the reviewed commits land unchanged and GitHub marks the seventeen parts below as merged.
  • Zero breaking changes: every existing signature, export, entry point and error message is preserved. Twelve output corrections were validated against the published 2.3.0 tarball and are listed in CHANGELOG.md (part 7); the build of every later part is compared export by export against the part below it.

Stack

@hyanmandian
hyanmandian added this pull request to stack #514 September 9, 2026 17:56
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2c5b58d7-61d9-4b6a-9c84-e24b18f52685

📥 Commits

Reviewing files that changed from the base of the PR and between 1abbd8c and 17a50c9.

📒 Files selected for processing (3)
  • src/index.test.ts
  • src/index.ts
  • vite.config.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The barrel export now exposes additional helpers and public types. API tests verify the complete runtime and type surface, duplicate-free exports, and non-throwing behavior for invalid inputs. Type-aware linting and 100% coverage thresholds are enabled.

Changes

Public API expansion

Layer / File(s) Summary
Expanded barrel exports
src/index.ts
The package exports new business-day, conversion, formatting, generation, lookup, validation, and parsing helpers. It also re-exports their public types and options. Deprecated aliases now use single-line JSDoc comments.
Public API contract validation
src/index.test.ts, vite.config.ts
Tests compare the exact runtime export list, check documented type exports and duplicates, and call non-network functions with invalid inputs. Type-aware linting and 100% coverage thresholds are enabled.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 17a50

The public API expansion and its validation changes have no identified actionable merge risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: public root exports and types, 100% coverage enforcement, and type-aware lint gates. The stack identifier provides release context without making the tit…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stack/06-public-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Tree-shaking report

Fails when a pre-existing export grows more than 20% and more than 256 B, or when importing every export that already existed on the base grows more than 5%. New exports never count as a regression.

Pre-existing exports: 202766 B to 203016 B (+0.1%, gzip 67153 B). Full import on head: 628788 B (gzip 162664 B).

name base head delta bytes delta % gzip head
formatCNPJ 521 671 +150 +28.8% 447
formatCnpj 521 671 +150 +28.8% 447
isValidIE 6189 6337 +148 +2.4% 2101
isValidIe 6189 6337 +148 +2.4% 2101
formatBoleto 544 690 +146 +26.8% 435
formatCEP 374 520 +146 +39.0% 374
formatCPF 417 563 +146 +35.0% 400
formatCep 374 520 +146 +39.0% 374
formatCnh 377 523 +146 +38.7% 374
formatCpf 417 563 +146 +35.0% 400
formatLegalNature 355 501 +146 +41.1% 365
formatPhone 1971 2117 +146 +7.4% 1078
formatPis 379 525 +146 +38.5% 377
formatProcessoJuridico 390 536 +146 +37.4% 379
formatVoterId 488 634 +146 +29.9% 436
generatePhone 681 827 +146 +21.4% 514
getAddressInfoByCep 3258 3404 +146 +4.5% 1426
getCepInfoByAddress 3782 3928 +146 +3.9% 1440
isValidBankAccount 5996 6142 +146 +2.4% 2286
parseBoleto 157 303 +146 +93.0% 255
parseCep 109 255 +146 +133.9% 222
parseCnh 110 256 +146 +132.7% 223
parseCnpj 214 360 +146 +68.2% 272
parseCpf 110 256 +146 +132.7% 223
parseLegalNature 109 255 +146 +133.9% 222
parsePhone 281 427 +146 +52.0% 321
parsePis 110 256 +146 +132.7% 223
parseProcessoJuridico 110 256 +146 +132.7% 223
parseVoterId 204 350 +146 +71.6% 281
GetAddressInfoByCepError 112 254 +142 +126.8% 229
GetAddressInfoByCepNotFoundError 205 347 +142 +69.3% 247
GetAddressInfoByCepServiceError 204 346 +142 +69.6% 244
GetAddressInfoByCepValidationError 203 345 +142 +70.0% 249
GetCepInfoByAddressError 112 254 +142 +126.8% 229
GetCepInfoByAddressNotFoundError 205 347 +142 +69.3% 247
GetCepInfoByAddressValidationError 203 345 +142 +70.0% 249
capitalize 622 764 +142 +22.8% 491
formatCurrency 1005 1147 +142 +14.1% 692
formatLicensePlate 628 770 +142 +22.6% 456
formatPassport 142 284 +142 +100.0% 243
generateBoleto 1219 1361 +142 +11.6% 759
generateCNPJ 1021 1163 +142 +13.9% 659
generateCPF 807 949 +142 +17.6% 610
generateCep 130 272 +142 +109.2% 236
generateCnh 567 709 +142 +25.0% 441
generateCnpj 1021 1163 +142 +13.9% 659
generateCpf 807 949 +142 +17.6% 610
generateLegalNature 5034 5176 +142 +2.8% 1706
generateLicensePlate 231 373 +142 +61.5% 302
generatePassport 226 368 +142 +62.8% 287
generatePis 346 488 +142 +41.0% 364
generateProcessoJuridico 528 670 +142 +26.9% 453
generateVoterId 812 954 +142 +17.5% 619
getBoletoInfo 2338 2480 +142 +6.1% 1297
getCities 157095 157237 +142 +0.1% 50570
getLegalNatures 5055 5197 +142 +2.8% 1723
getMunicipality 157620 157762 +142 +0.1% 50938
getStates 2203 2345 +142 +6.4% 639
isValidBoleto 1600 1742 +142 +8.9% 948
isValidCEP 130 272 +142 +109.2% 237
isValidCNPJ 1191 1333 +142 +11.9% 681
isValidCPF 617 759 +142 +23.0% 441
isValidCep 130 272 +142 +109.2% 237
isValidCnh 619 761 +142 +22.9% 465
isValidCnpj 1191 1333 +142 +11.9% 681
isValidCpf 617 759 +142 +23.0% 441
isValidEmail 157 299 +142 +90.4% 243
isValidLandlinePhone 686 828 +142 +20.7% 548
isValidLegalNature 5077 5219 +142 +2.8% 1745
isValidMobilePhone 736 878 +142 +19.3% 578
isValidPIS 677 819 +142 +21.0% 513
isValidPassport 165 307 +142 +86.1% 259
isValidPis 677 819 +142 +21.0% 513
isValidProcessoJuridico 404 546 +142 +35.1% 387
isValidRenavam 396 538 +142 +35.9% 391
isValidVoterId 771 913 +142 +18.4% 534
parseCurrency 653 795 +142 +21.7% 516
parsePassport 142 284 +142 +100.0% 245
getFormatLicensePlate 327 465 +138 +42.2% 334
getHolidays 4577 4715 +138 +3.0% 1973
isHoliday 4898 5036 +138 +2.8% 2089
isValidLicensePlate 348 486 +138 +39.7% 344
parseLicensePlate 142 280 +138 +97.2% 242
isValidPhone 1906 2040 +134 +7.0% 988

New exports

  • addBusinessDays: 5612 B (gzip 2316 B)
  • convertCurrencyToWords: 2247 B (gzip 1176 B)
  • convertDateToWords: 2717 B (gzip 1397 B)
  • convertLicensePlateToMercosul: 655 B (gzip 429 B)
  • convertNumberToWords: 1893 B (gzip 985 B)
  • differenceInBusinessDays: 5658 B (gzip 2330 B)
  • formatCaepf: 545 B (gzip 391 B)
  • formatCei: 542 B (gzip 389 B)
  • formatCertidao: 559 B (gzip 384 B)
  • formatCnae: 520 B (gzip 377 B)
  • formatCno: 542 B (gzip 389 B)
  • formatCns: 529 B (gzip 376 B)
  • formatIban: 374 B (gzip 302 B)
  • formatNcm: 514 B (gzip 372 B)
  • formatNfeKey: 554 B (gzip 373 B)
  • generatePixPayload: 6134 B (gzip 2553 B)
  • getAreaCodeInfo: 3140 B (gzip 1016 B)
  • getAreaCodesByState: 892 B (gzip 519 B)
  • getBankByCode: 28502 B (gzip 7654 B)
  • getBankByIspb: 28506 B (gzip 7656 B)
  • getBanks: 28234 B (gzip 7466 B)
  • getCbo: 112310 B (gzip 28291 B)
  • getCfop: 56242 B (gzip 5586 B)
  • getCnae: 95585 B (gzip 21345 B)
  • getLegalNature: 5274 B (gzip 1779 B)
  • getMunicipalities: 159483 B (gzip 51084 B)
  • getMunicipalityByCode: 159557 B (gzip 51134 B)
  • getStateByIbgeCode: 2502 B (gzip 729 B)
  • getStateCodeByName: 2565 B (gzip 760 B)
  • getStateNameByCode: 2461 B (gzip 707 B)
  • getTimezoneByState: 879 B (gzip 438 B)
  • isBusinessDay: 5081 B (gzip 2138 B)
  • isValidCaepf: 857 B (gzip 534 B)
  • isValidCbo: 112238 B (gzip 28228 B)
  • isValidCei: 795 B (gzip 522 B)
  • isValidCertidao: 889 B (gzip 558 B)
  • isValidCfop: 56209 B (gzip 5557 B)
  • isValidCnae: 95206 B (gzip 20974 B)
  • isValidCno: 799 B (gzip 521 B)
  • isValidCns: 754 B (gzip 494 B)
  • isValidCreditCard: 514 B (gzip 366 B)
  • isValidCsosn: 354 B (gzip 280 B)
  • isValidCst: 904 B (gzip 522 B)
  • isValidIban: 541 B (gzip 411 B)
  • isValidNcm: 115986 B (gzip 24398 B)
  • isValidNfeKey: 1073 B (gzip 732 B)
  • isValidPixKey: 4626 B (gzip 1859 B)
  • isValidPixPayload: 1788 B (gzip 956 B)
  • isValidRegistroProfissional: 2905 B (gzip 935 B)
  • isValidServicePhone: 845 B (gzip 472 B)
  • isValidVin: 887 B (gzip 601 B)
  • parseCertidao: 1186 B (gzip 702 B)
  • parseIban: 780 B (gzip 538 B)
  • parseNfeKey: 1447 B (gzip 886 B)
  • parsePixKey: 4521 B (gzip 1827 B)
  • parsePixPayload: 1771 B (gzip 945 B)
  • removeAccents: 249 B (gzip 227 B)

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1abbd8c) to head (17a50c9).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           stack/05-new-utils      #512      +/-   ##
=======================================================
+ Coverage               98.75%   100.00%   +1.24%     
=======================================================
  Files                     152       152              
  Lines                    2161      2161              
  Branches                  664       664              
=======================================================
+ Hits                     2134      2161      +27     
+ Misses                      3         0       -3     
+ Partials                   24         0      -24     
Flag Coverage Δ
node 100.00% <ø> (+1.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@hyanmandian hyanmandian changed the title [2.4.0 stack 6/7] Public API: root exports, types and runtime shims [2.4.0 stack 6/7] Public API: root exports, types, 100% coverage and type-aware lint gates Sep 9, 2026
@hyanmandian
hyanmandian force-pushed the stack/06-public-api branch 2 times, most recently from 53c80ee to c6d1290 Compare September 11, 2026 20:34
@hyanmandian hyanmandian changed the title [2.4.0 stack 6/7] Public API: root exports, types, 100% coverage and type-aware lint gates [2.4.0 stack 6/11] Public API: root exports, types, 100% coverage and type-aware lint gates Sep 12, 2026
@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

Export State, StateCode, StateName, AddressInfo, CepProvider, BoletoInfo,
GetBoletoInfoOptions, GenerateBoletoOptions, GenerateLicensePlateFormat, Holiday,
HolidayType, PhoneMask, PhoneVersion, PhoneType, ParseCurrencyOptions,
ParseCnpjOptions, IsValidCnpjOptions and every new util'"'"'s public types.
Turn on oxlint's type-aware rules with type checking and require 100% statement,
branch, function and line coverage now that every source file meets both.
@hyanmandian
hyanmandian removed this pull request from stack #514 September 12, 2026 22:57
@hyanmandian
hyanmandian added this pull request to stack #524 September 12, 2026 22:58
@hyanmandian hyanmandian changed the title [2.4.0 stack 6/11] Public API: root exports, types, 100% coverage and type-aware lint gates [2.4.0 stack 7/14] Public API: root exports, types, 100% coverage and type-aware lint gates Sep 12, 2026
@hyanmandian
hyanmandian removed this pull request from stack #524 September 13, 2026 01:17
@hyanmandian
hyanmandian added this pull request to stack #527 September 13, 2026 01:17
@hyanmandian hyanmandian changed the title [2.4.0 stack 7/14] Public API: root exports, types, 100% coverage and type-aware lint gates [2.4.0 stack 7/16] Public API: root exports, types, 100% coverage and type-aware lint gates Sep 13, 2026
@hyanmandian
hyanmandian removed this pull request from stack #527 September 13, 2026 03:44
@hyanmandian
hyanmandian added this pull request to stack #530 September 13, 2026 03:44
@hyanmandian hyanmandian changed the title [2.4.0 stack 7/16] Public API: root exports, types, 100% coverage and type-aware lint gates [2.4.0 stack 7/18] Public API: root exports, types, 100% coverage and type-aware lint gates Sep 13, 2026
@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 28 minutes.

@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

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.

1 participant