Skip to content
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

refactor: reduce JSON schema and options duplication #339

Open
wants to merge 6 commits into
base: next
Choose a base branch
from

Conversation

hugop95
Copy link
Contributor

@hugop95 hugop95 commented Oct 25, 2024

Description

This PR reduces code duplication in 2 ways:

  • Each rule has duplicated defaultOptions. Creates a single constant for that per rule.
  • All rules share some similar JSON schemas, for type, order, etc. Put these in common in a utils/common-json-schemas.ts file.

Here is the list of JSON schemas attributes put in common:

  • type
  • order
  • matcher
  • ignoreCase
  • specialCharacters
  • groups
  • customGroups (Object-based API)
  • partitionByComment

No other code logic or tests have been touched.

Other changes

  • Makes complete return a new object rather than using Object.assign.

What is the purpose of this pull request?

  • Other

@hugop95 hugop95 marked this pull request as ready for review October 25, 2024 08:28
@hugop95 hugop95 marked this pull request as draft October 25, 2024 08:32
* ...rather than use `Object.assign`
@hugop95 hugop95 marked this pull request as ready for review October 25, 2024 09:54
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