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

feat: Add custom ESLint plugin for YAML sorting #630

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

mshojaei-txfusion
Copy link
Collaborator

@mshojaei-txfusion mshojaei-txfusion commented Feb 28, 2025

Description

Added a custom ESLint plugin that enforces consistent sorting in YAML files. The plugin specifically targets arrays in chain and deployment configuration files, sorting:

  • tokens arrays by chainName
  • tokens[].connections arrays by token

This improves readability, reduces merge conflicts, and makes changes to these arrays more predictable and consistent.

Also added a convenience npm script sort-yaml to easily format all YAML files.

Related issues

hyperlane-xyz/hyperlane-monorepo#5547

Backward compatibility

Yes. This change only affects linting rules and doesn't modify any runtime behavior.

Testing

The plugin has been tested against existing YAML files in the chains and deployments directories. The sorting logic properly preserves all data while reorganizing it consistently.

Copy link

changeset-bot bot commented Feb 28, 2025

🦋 Changeset detected

Latest commit: a2a23c9

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

This PR includes changesets to release 1 package
Name Type
@hyperlane-xyz/registry 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

- http: https://alephzero.drpc.org
- http: https://rpc.alephzero.raas.gelato.cloud
Copy link
Contributor

Choose a reason for hiding this comment

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

We should exclude RPC urls from sorting (because there might be a reason to sort these according to reliability

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, I was not aware of it.
fixed also did same for block explorers

@mshojaei-txfusion
Copy link
Collaborator Author

what worries me is this PR removes yaml files comments.
@ltyu can you please take a look at PR first then let me know if it worth it working on this comments thing or not

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