Skip to content

Conversation

iamAmer
Copy link
Contributor

@iamAmer iamAmer commented Aug 27, 2025

Fixes #2582

Summary

This PR fixes the French VAT number validation.

Changes

  • Updated the regex for FR VAT numbers to only allow the correct format: FR + 2 digits + 9 digits (SIREN).
  • Updated/added test cases to match the correct specification.

Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (eee525c) to head (1fa4aa4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2584   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2536      2536           
  Branches       642       642           
=========================================
  Hits          2536      2536           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

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

For future improvement we might want to look at some leniency for whitespaces in between the 'segments' (so something like FR 12 345678912 might be valid as well) but on a quick search I didn't find good resources for that. For now this is already an improvement.

I do also see all resources pointing towards requiring FR at the start, so that's also a change I'm approving

@WikiRik WikiRik requested a review from rubiin August 27, 2025 13:56
@iamAmer
Copy link
Contributor Author

iamAmer commented Aug 27, 2025

Thanks for the review! I agree — adding leniency for whitespaces could be a useful future improvement. For now, I’ll leave it strict since that’s what most resources confirm.

@rubiin rubiin merged commit 3c85708 into validatorjs:master Aug 27, 2025
13 checks passed
@iamAmer iamAmer deleted the fix-french-vat-regex branch August 27, 2025 14:08
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.

French VAT number
3 participants