Skip to content

Conversation

@brc-dd
Copy link
Member

@brc-dd brc-dd commented Sep 1, 2025

closes #597

This pull request refactors type checking throughout the codebase to use native JavaScript operators like typeof and instanceof instead 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

  • Replaced usage of custom utility functions such as isString, isBlob, isFile, isFormData, isError, isRequest, and isResponse with 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

  • Removed deprecated and redundant utility functions from Utils.ts and refactored remaining functions to use native checks; marked isNumber and isString as deprecated.
  • Simplified and improved file extension and size formatting logic in File.ts.
  • Removed unnecessary mapping objects and type-checking helpers from Day.ts, and refactored date/time creation functions for clarity and conciseness. [1] [2] [3] [4]

Error Handling Improvements

  • Improved the error message extraction logic in Error.ts to handle more cases and avoid reliance on custom error type guards.

Validation Rule Standardization

  • Updated validation rule messages for clarity and consistency in English, and simplified validation logic by removing unnecessary checks and using more direct validation functions (Rule.ts, rules/decimal.ts, rules/email.ts, rules/negativeInteger.ts, rules/positiveInteger.ts). [1] [2] [3] [4] [5] [6]

Dependency Reduction

  • Removed usage of Lodash utility functions throughout the codebase, further reducing external dependencies and simplifying the implementation.

@netlify
Copy link

netlify bot commented Sep 1, 2025

Deploy Preview for sefirot-story ready!

Name Link
🔨 Latest commit 9ede668
🔍 Latest deploy log https://app.netlify.com/projects/sefirot-story/deploys/68ebfd23030e5d0008226408
😎 Deploy Preview https://deploy-preview-648--sefirot-story.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Sep 1, 2025

Deploy Preview for sefirot-docs ready!

Name Link
🔨 Latest commit 9ede668
🔍 Latest deploy log https://app.netlify.com/projects/sefirot-docs/deploys/68ebfd23681394000816ee01
😎 Deploy Preview https://deploy-preview-648--sefirot-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@brc-dd brc-dd requested a review from Copilot September 10, 2025 10:46
Copy link
Contributor

Copilot AI left a 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() to it() 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.

@brc-dd brc-dd requested a review from Copilot September 15, 2025 06:16
Copy link
Contributor

Copilot AI left a 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'
Copy link
Member

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.

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.

[Validation] Review validators and rewrite corresponding tests

3 participants