Skip to content

refactor: use actively maintained json-schema-migrate-x instead #378

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

Merged
merged 5 commits into from
Apr 4, 2025

Conversation

JounQin
Copy link
Collaborator

@JounQin JounQin commented Apr 3, 2025

See https://github.com/un-ts/json-schema-migrate-x

The fork started because I discovered ajv-validator/json-schema-migrate#9 in current repo, which is annoying in VSCode.

I also added clean-pkg-json for cleaning up package.json before publish.

eslint-compat-utils is also bumped, some types errors are gone thanks to ota-meshi/eslint-compat-utils#65.

Summary by CodeRabbit

  • Chores

    • Updated project configurations with improved build, lint, and release scripts.
    • Upgraded dependencies by replacing outdated packages with actively maintained alternatives.
    • Enhanced code formatting settings with a newly integrated formatting plugin.
    • Minor version change for eslint-plugin-json-schema-validator.
  • Refactor

    • Streamlined internal module organization for improved maintainability and consistency.

@JounQin JounQin requested review from ota-meshi and Copilot April 3, 2025 09:15
Copy link

changeset-bot bot commented Apr 3, 2025

🦋 Changeset detected

Latest commit: 94e44c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-json-schema-validator Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@Copilot 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 PR refactors the code to use the actively maintained "@unts/json-schema-migrate" package for JSON schema migration while incorporating a cleanup process for package.json using clean‑pkg‑json. Key changes include:

  • Removing unnecessary @ts‑expect‑error comments from test files.
  • Updating import statements in validator‑factory.ts and schema.ts to reference the new migration package.
  • Tidying up import ordering and eliminating duplicate or outdated code.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
tests/src/rules/no-invalid.ts Removed redundant @ts‑expect‑error comments to reflect updated types.
tests/src/eslint-plugin.ts Removed outdated @ts‑expect‑error comments related to ESLint typing bugs.
src/utils/validator-factory.ts Updated imports to use "@unts/json-schema-migrate" and removed duplicates.
src/utils/schema.ts Reordered and updated imports, adopting the new JSON schema migration.
Files not reviewed (1)
  • package.json: Language not supported

@JounQin
Copy link
Collaborator Author

JounQin commented Apr 3, 2025

@ota-meshi I recommend you to try https://coderabbit.ai

@JounQin JounQin force-pushed the refactor/json-schema-migrate branch from edadf7d to 87a9fbc Compare April 3, 2025 09:28
Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

The changes update configuration files, code imports, scripts, and dependency references. A new changeset entry documents a minor version bump and a migration from json-schema-migrate to json-schema-migrate-x. The Prettier configuration now includes a plugin, and package scripts along with dependency versions in package.json have been revised. Import statements in source files were reorganized, and TypeScript error suppression comments have been removed from test files.

Changes

File(s) Change Summary
.changeset/poor-dolphins-exist.md Added a changeset entry for a minor version bump and documented the migration from json-schema-migrate to json-schema-migrate-x.
.prettierrc.json Updated configuration by adding "plugins": ["prettier-plugin-pkg"].
package.json Added "packageManager": "[email protected]", introduced a new prelint script, modified the release script, updated dependency versions (e.g., eslint-compat-utils to ^0.6.5), replaced json-schema-migrate with json-schema-migrate-x, and changed eslint-plugin-json-schema-validator to a local link.
src/utils/schema.ts Reordered and updated imports to use json-schema-migrate-x instead of json-schema-migrate, adjusted type imports, and repositioned import statements.
src/utils/validator-factory.ts Reordered and updated imports to use json-schema-migrate-x instead of json-schema-migrate, adjusted type imports, and repositioned import statements.
tests/src/eslint-plugin.ts Removed TypeScript error suppression comments from ESLint configuration.
tests/src/no-invalid.ts Removed TypeScript error suppression comments from test cases.

Poem

In lines of code I hop and play,
Fixing imports in a cheerful way.
Configs gleam with a fresh new glow,
As scripts and tests in harmony flow.
I nibble bugs with a joyful cheer,
A rabbit’s delight in changes so dear! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/utils/schema.ts

Oops! Something went wrong! :(

ESLint: 9.23.0

ESLint couldn't find the plugin "eslint-plugin-json-schema-validator".

(The package "eslint-plugin-json-schema-validator" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-json-schema-validator@latest --save-dev

The plugin "eslint-plugin-json-schema-validator" was referenced from the config file in " » plugin:@ota-meshi/recommended#overrides[0] » /node_modules/@ota-meshi/eslint-plugin/lib/configs/json-schema/config.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.

src/utils/validator-factory.ts

Oops! Something went wrong! :(

ESLint: 9.23.0

ESLint couldn't find the plugin "eslint-plugin-json-schema-validator".

(The package "eslint-plugin-json-schema-validator" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-json-schema-validator@latest --save-dev

The plugin "eslint-plugin-json-schema-validator" was referenced from the config file in " » plugin:@ota-meshi/recommended#overrides[0] » /node_modules/@ota-meshi/eslint-plugin/lib/configs/json-schema/config.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 375ae28 and 94e44c2.

📒 Files selected for processing (4)
  • .changeset/poor-dolphins-exist.md (1 hunks)
  • package.json (5 hunks)
  • src/utils/schema.ts (1 hunks)
  • src/utils/validator-factory.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/poor-dolphins-exist.md
  • src/utils/validator-factory.ts
  • src/utils/schema.ts
  • package.json

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@JounQin JounQin changed the title refactor: use actively maintained @unts/json-schema-migrate instead refactor: use actively maintained json-schema-migrate-x instead Apr 3, 2025
@JounQin
Copy link
Collaborator Author

JounQin commented Apr 3, 2025

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

@coderabbitai This repository use yarn for dependencies, specifically eslint-plugin-json-schema-validator is installed as linked itself, that's totally fine.

Copy link

coderabbitai bot commented Apr 3, 2025

Tip

For best results, initiate chat on the files or code changes.

@JounQin Thank you for the clarification. You're absolutely right - using link:. for the eslint-plugin-json-schema-validator dependency in a yarn project is a perfectly valid approach, especially during development of the plugin itself. I'll make note of this configuration pattern for future reviews of this repository.

🐰✨

✏️ Learnings added
Learnt from: JounQin
URL: https://github.com/ota-meshi/eslint-plugin-json-schema-validator/pull/378

Timestamp: 2025-04-03T13:27:02.349Z
Learning: In the eslint-plugin-json-schema-validator repository, the package.json configuration using yarn with self-referential link:. dependency for eslint-plugin-json-schema-validator is intentional and valid. This pattern is used for local development and testing of the plugin itself.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@JounQin JounQin force-pushed the refactor/json-schema-migrate branch from 375ae28 to 94e44c2 Compare April 3, 2025 13:35
Copy link
Owner

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

Thank you!

@ota-meshi ota-meshi merged commit 83346cb into main Apr 4, 2025
12 checks passed
@ota-meshi ota-meshi deleted the refactor/json-schema-migrate branch April 4, 2025 00:14
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.

2 participants