31953 Added new validators package#301
Conversation
- created validators folder - added index file - added initial package file - added ValidatePostalCode file
| @@ -0,0 +1,12 @@ | |||
| { | |||
| "name": "@bcrs-shared-components/validators", | |||
| "version": "0.0.0", | |||
There was a problem hiding this comment.
Lerna will update this when I run it after merging this change.
There was a problem hiding this comment.
I'll choose 1.0.0 for the first published version :)
| "src/services", | ||
| "src/types", | ||
| "src/services" | ||
| "src/validators" |
There was a problem hiding this comment.
I followed my own instructions here:
https://github.com/bcgov/bcrs-shared-components/blob/main/README.md#special-procedures
There was a problem hiding this comment.
Pull request overview
Adds a new @bcrs-shared-components/validators package to the monorepo and introduces an initial postal code validator, wiring the new package into Lerna so it can be versioned/published alongside existing packages.
Changes:
- Created new
src/validatorspackage with anindex.tsbarrel export. - Added
validatePostalCodeimplementation for Canadian postal code format validation. - Updated
lerna.jsonto include the newsrc/validatorspackage (and re-ordered package paths).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/validators/validate-postal-code.ts | Introduces validatePostalCode using a Canada postal code regex. |
| src/validators/index.ts | Exposes validator(s) via a barrel export. |
| src/validators/package.json | Defines the new Lerna-managed package metadata. |
| lerna.json | Registers src/validators as a Lerna package path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
loneil
left a comment
There was a problem hiding this comment.
Makes sense right now to ignore copilot comments about the validator as they are tested and in-use already on multiple UI projects so don't want to change behavior IMO (just commonize for now)
As long as the "required" validator is used before the "validatePostalCode" validator, it should behave the same before and now. I've made a mental note to test this once it's imported in to Create UI :) |
- added unit tests
2c850d7 to
65eadbc
Compare
Tested and works fine in Create UI. |
Issue #: bcgov/entity#31953
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the business-filings-ui license (Apache 2.0).