Skip to content

[2.4.0 stack 6/7] 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 6/7] 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 6 of 7 of the 2.4.0 release stack (main <- stack/01-tooling <- ... <- stack/07-docs). 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)

  • aa0e783 feat: export public types from the package root
  • 53c80ee ci(test): enforce 100% coverage and type-aware lint

How to review and merge

Stack

Summary by CodeRabbit

  • New Features

    • Expanded the public API with utilities for business-day calculations, number/date/currency-to-words conversion, Mercosul license plates, and Brazilian document, banking, address, timezone, and payment data.
    • Added formatting, generation, validation, parsing, and lookup helpers for numerous identification and financial formats.
    • Added comprehensive public type exports to improve TypeScript support and developer experience.
  • Tests

    • Expanded API coverage and validation testing, including safer handling of invalid inputs.

@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: 48c7f41a-7411-4110-ae0b-6582a36a3e37

📥 Commits

Reviewing files that changed from the base of the PR and between 3db81d2 and 53c80ee.

📒 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; 2 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. Lint type checking 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. Lint type checking and 100% coverage thresholds are enabled.

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

Merge Risk: ⚪ Minimal · up to 53c80

The package-root API is expanded with matching runtime and type-surface checks, while linting and coverage validation are strengthened. No merge-blocking risk remains.

🚥 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: package-root exports and public types, 100% coverage enforcement, and type-aware linting gates.
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: 202515 B to 202653 B (+0.1%, gzip 66986 B). Full import on head: 627889 B (gzip 162278 B).

name base head delta bytes delta % gzip head
formatCNPJ 521 559 +38 +7.3% 378
formatCnpj 521 559 +38 +7.3% 378
formatBoleto 544 578 +34 +6.3% 356
formatCEP 374 408 +34 +9.1% 295
formatCPF 417 451 +34 +8.2% 321
formatCep 374 408 +34 +9.1% 295
formatCnh 377 411 +34 +9.0% 295
formatCpf 417 451 +34 +8.2% 321
formatLegalNature 355 389 +34 +9.6% 287
formatPhone 1833 1867 +34 +1.9% 942
formatPis 379 413 +34 +9.0% 298
formatProcessoJuridico 390 424 +34 +8.7% 301
formatVoterId 435 469 +34 +7.8% 319
generatePhone 681 715 +34 +5.0% 430
getAddressInfoByCep 3229 3263 +34 +1.1% 1337
getCepInfoByAddress 3791 3825 +34 +0.9% 1363
isValidBankAccount 5996 6030 +34 +0.6% 2202
parseBoleto 157 191 +34 +21.7% 176
parseCep 109 143 +34 +31.2% 142
parseCnh 110 144 +34 +30.9% 142
parseCnpj 214 248 +34 +15.9% 197
parseCpf 110 144 +34 +30.9% 142
parseLegalNature 109 143 +34 +31.2% 141
parsePhone 281 315 +34 +12.1% 243
parsePis 110 144 +34 +30.9% 142
parseProcessoJuridico 110 144 +34 +30.9% 142
parseVoterId 204 238 +34 +16.7% 204
isValidIE 6189 6222 +33 +0.5% 2026
isValidIe 6189 6222 +33 +0.5% 2026
GetAddressInfoByCepError 112 142 +30 +26.8% 147
GetAddressInfoByCepNotFoundError 205 235 +30 +14.6% 163
GetAddressInfoByCepServiceError 204 234 +30 +14.7% 161
GetAddressInfoByCepValidationError 203 233 +30 +14.8% 166
GetCepInfoByAddressError 112 142 +30 +26.8% 147
GetCepInfoByAddressNotFoundError 205 235 +30 +14.6% 163
GetCepInfoByAddressValidationError 203 233 +30 +14.8% 166
capitalize 622 652 +30 +4.8% 416
formatCurrency 1005 1035 +30 +3.0% 619
formatLicensePlate 628 658 +30 +4.8% 380
formatPassport 142 172 +30 +21.1% 168
generateBoleto 1219 1249 +30 +2.5% 679
generateCNPJ 1021 1051 +30 +2.9% 581
generateCPF 807 837 +30 +3.7% 533
generateCep 130 160 +30 +23.1% 153
generateCnh 567 597 +30 +5.3% 361
generateCnpj 1021 1051 +30 +2.9% 581
generateCpf 807 837 +30 +3.7% 533
generateLegalNature 5030 5060 +30 +0.6% 1612
generateLicensePlate 231 261 +30 +13.0% 225
generatePassport 226 256 +30 +13.3% 209
generatePis 346 376 +30 +8.7% 287
generateProcessoJuridico 528 558 +30 +5.7% 376
generateVoterId 830 860 +30 +3.6% 552
getBoletoInfo 2338 2368 +30 +1.3% 1217
getCities 157095 157125 +30 +0.0% 50429
getLegalNatures 5055 5085 +30 +0.6% 1628
getMunicipality 157629 157659 +30 +0.0% 50824
getStates 2203 2233 +30 +1.4% 552
isValidBoleto 1600 1630 +30 +1.9% 871
isValidCEP 130 160 +30 +23.1% 160
isValidCNPJ 1191 1221 +30 +2.5% 605
isValidCPF 617 647 +30 +4.9% 364
isValidCep 130 160 +30 +23.1% 160
isValidCnh 619 649 +30 +4.8% 386
isValidCnpj 1191 1221 +30 +2.5% 605
isValidCpf 617 647 +30 +4.9% 364
isValidEmail 157 187 +30 +19.1% 174
isValidLandlinePhone 686 716 +30 +4.4% 464
isValidLegalNature 5077 5107 +30 +0.6% 1652
isValidMobilePhone 736 766 +30 +4.1% 497
isValidPIS 677 707 +30 +4.4% 432
isValidPassport 165 195 +30 +18.2% 186
isValidPis 677 707 +30 +4.4% 432
isValidProcessoJuridico 404 434 +30 +7.4% 309
isValidRenavam 396 426 +30 +7.6% 311
isValidVoterId 797 827 +30 +3.8% 471
parseCurrency 653 683 +30 +4.6% 441
parsePassport 142 172 +30 +21.1% 168
getFormatLicensePlate 327 353 +26 +8.0% 259
getHolidays 4504 4530 +26 +0.6% 1880
isHoliday 4825 4851 +26 +0.5% 1995
isValidLicensePlate 348 374 +26 +7.5% 268
parseLicensePlate 142 168 +26 +18.3% 167
isValidPhone 1788 1810 +22 +1.2% 852

New exports

  • addBusinessDays: 5314 B (gzip 2185 B)
  • convertCurrencyToWords: 2135 B (gzip 1099 B)
  • convertDateToWords: 2605 B (gzip 1321 B)
  • convertLicensePlateToMercosul: 543 B (gzip 357 B)
  • convertNumberToWords: 1781 B (gzip 908 B)
  • differenceInBusinessDays: 5375 B (gzip 2199 B)
  • formatCaepf: 433 B (gzip 313 B)
  • formatCei: 430 B (gzip 312 B)
  • formatCertidao: 447 B (gzip 307 B)
  • formatCnae: 408 B (gzip 300 B)
  • formatCno: 430 B (gzip 312 B)
  • formatCns: 417 B (gzip 297 B)
  • formatIban: 262 B (gzip 229 B)
  • formatNcm: 402 B (gzip 294 B)
  • formatNfeKey: 442 B (gzip 295 B)
  • generatePixPayload: 5819 B (gzip 2413 B)
  • getAreaCodeInfo: 3028 B (gzip 931 B)
  • getAreaCodesByState: 780 B (gzip 440 B)
  • getBankByCode: 28341 B (gzip 7520 B)
  • getBankByIspb: 28345 B (gzip 7522 B)
  • getBanks: 28122 B (gzip 7351 B)
  • getCbo: 112153 B (gzip 28131 B)
  • getCfop: 56138 B (gzip 5541 B)
  • getCnae: 95428 B (gzip 21180 B)
  • getLegalNature: 5165 B (gzip 1683 B)
  • getMunicipalities: 159371 B (gzip 50956 B)
  • getMunicipalityByCode: 159445 B (gzip 51014 B)
  • getStateByIbgeCode: 2390 B (gzip 645 B)
  • getStateCodeByName: 2462 B (gzip 683 B)
  • getStateNameByCode: 2349 B (gzip 621 B)
  • getTimezoneByState: 755 B (gzip 343 B)
  • isBusinessDay: 4865 B (gzip 2040 B)
  • isValidCaepf: 745 B (gzip 460 B)
  • isValidCbo: 112126 B (gzip 28106 B)
  • isValidCei: 683 B (gzip 446 B)
  • isValidCertidao: 777 B (gzip 482 B)
  • isValidCfop: 56105 B (gzip 5512 B)
  • isValidCnae: 95094 B (gzip 20852 B)
  • isValidCno: 687 B (gzip 447 B)
  • isValidCns: 671 B (gzip 434 B)
  • isValidCreditCard: 402 B (gzip 289 B)
  • isValidCsosn: 242 B (gzip 201 B)
  • isValidCst: 792 B (gzip 444 B)
  • isValidIban: 429 B (gzip 339 B)
  • isValidNcm: 115874 B (gzip 24252 B)
  • isValidNfeKey: 919 B (gzip 631 B)
  • isValidPixKey: 4389 B (gzip 1750 B)
  • isValidPixPayload: 1633 B (gzip 857 B)
  • isValidRegistroProfissional: 2793 B (gzip 857 B)
  • isValidServicePhone: 733 B (gzip 386 B)
  • isValidVin: 775 B (gzip 525 B)
  • parseCertidao: 1074 B (gzip 624 B)
  • parseIban: 668 B (gzip 468 B)
  • parseNfeKey: 1293 B (gzip 785 B)
  • parsePixKey: 4285 B (gzip 1718 B)
  • parsePixPayload: 1616 B (gzip 847 B)
  • removeAccents: 146 B (gzip 153 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 (3db81d2) to head (53c80ee).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           stack/05-new-utils      #512      +/-   ##
=======================================================
+ Coverage               98.73%   100.00%   +1.26%     
=======================================================
  Files                     150       150              
  Lines                    2135      2135              
  Branches                  646       646              
=======================================================
+ Hits                     2108      2135      +27     
+ Misses                      3         0       -3     
+ Partials                   24         0      -24     
Flag Coverage Δ
node 100.00% <ø> (+1.26%) ⬆️

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