-
Notifications
You must be signed in to change notification settings - Fork 16
feat: rewrite validators and tests #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for sefirot-story ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for sefirot-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: Haoqun Jiang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors type checking throughout the codebase to use native JavaScript operators and modernizes validation tests. The changes simplify the code, reduce dependencies, and improve maintainability by replacing custom utility functions with native checks and restructuring test files for better clarity.
- Replaces custom type checking functions (
isString,isBlob, etc.) with native JavaScript operators (typeof,instanceof) - Modernizes test files by converting
test()toit()and reorganizing test cases for better readability - Moves configuration constants to the top of files for better organization
Reviewed Changes
Copilot reviewed 284 out of 288 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Moves ignore array declaration to top of file |
| tests/validation/validators/*.spec.ts | Modernizes test syntax and improves test organization |
| tests/validation/rules/*.spec.ts | Updates test syntax from test() to it() |
| tests/support/*.spec.ts | Converts test syntax and improves descriptions |
| tests/components/*.spec.ts | Standardizes test syntax and descriptions |
| stories/components/*.story.vue | Reorganizes template attribute order |
| tests/Utils.ts | Adds utility function and simplifies code |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 284 out of 288 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,21 @@ | |||
| // @ts-check | |||
| import globalbrain from '@globalbrain/eslint-config' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to cherry-pick the ESLint update into a separate PR?
I think that would greatly narrow down the scope of this PR and make it easier to review.
closes #597
This pull request refactors type checking throughout the codebase to use native JavaScript operators like
typeofandinstanceofinstead of custom utility functions, removes deprecated and redundant code, and improves error handling and file utilities. It also standardizes validation rule messages and logic. These changes simplify the code, reduce dependencies, and improve maintainability.Type Checking Refactor
isString,isBlob,isFile,isFormData,isError,isRequest, andisResponsewith native JavaScript checks (typeof,instanceof) across multiple files, including components, composables, and HTTP utilities (SInputAddon.vue,SInputNumber.vue,SInputText.vue,Error.ts,Image.ts,Utils.ts,Http.ts). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]Utility and Support Code Cleanup
Utils.tsand refactored remaining functions to use native checks; markedisNumberandisStringas deprecated.File.ts.Day.ts, and refactored date/time creation functions for clarity and conciseness. [1] [2] [3] [4]Error Handling Improvements
Error.tsto handle more cases and avoid reliance on custom error type guards.Validation Rule Standardization
Rule.ts,rules/decimal.ts,rules/email.ts,rules/negativeInteger.ts,rules/positiveInteger.ts). [1] [2] [3] [4] [5] [6]Dependency Reduction