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 no-trailing-zeros rule #236

Merged
merged 10 commits into from May 7, 2023
Merged

feat: add no-trailing-zeros rule #236

merged 10 commits into from May 7, 2023

Conversation

sxyazi
Copy link
Contributor

@sxyazi sxyazi commented May 5, 2023

Since YAML treats both 1.2 and 1.20 as 1.2, trailing zeros for numbers is not necessary, this rule enforces it.

There are some bugs that arise from one getting the difference between 1.2 and 1.20 wrong.

Such as setting the Go version in GitHub Actions to have to use "1.20" instead of 1.20/1.2, which indicates the 20th version of Go, not of 2nd, this rule can discover and report it.

See also (Chinese): https://twitter.com/haoel/status/1654074716968357888

@changeset-bot
Copy link

changeset-bot bot commented May 5, 2023

🦋 Changeset detected

Latest commit: d0059bc

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-yml 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

@sxyazi
Copy link
Contributor Author

sxyazi commented May 6, 2023

So weird, the test did not pass, it totally works on my side, I just changed some docs. 🤷

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 for this PR.
I made some comments.

docs/rules/no-trailing-zeros.md Outdated Show resolved Hide resolved
src/rules/no-trailing-zeros.ts Outdated Show resolved Hide resolved
src/rules/no-trailing-zeros.ts Outdated Show resolved Hide resolved
src/rules/no-trailing-zeros.ts Outdated Show resolved Hide resolved
@sxyazi sxyazi requested a review from ota-meshi May 7, 2023 14:19
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.

LGTM!

@ota-meshi ota-meshi merged commit 7e34b77 into ota-meshi:master May 7, 2023
8 checks passed
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.

None yet

2 participants