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 missing-directive-value rule #322

Merged
merged 4 commits into from
Mar 24, 2024

Conversation

oanaOM
Copy link
Contributor

@oanaOM oanaOM commented Mar 12, 2024

According to Astro docs, client:only directive is required to have a value which represent the correct framework so I think it would be useful to have a rule about this to remind ourselves about this.

Astro docs reference: https://docs.astro.build/en/reference/directives-reference/#clientonly

Copy link

changeset-bot bot commented Mar 12, 2024

🦋 Changeset detected

Latest commit: f6f48cb

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

@ota-meshi
Copy link
Owner

I noticed that I haven't written any instructions on how to contribute to this repository.
I added CONTRIBUTING.md earlier, so please check it out.

https://github.com/ota-meshi/eslint-plugin-astro/blob/main/CONTRIBUTING.md

@oanaOM oanaOM force-pushed the missing-directive-value-rule branch from 5bba417 to 3373d4e Compare March 23, 2024 12:37
@oanaOM oanaOM force-pushed the missing-directive-value-rule branch from 3373d4e to c84c87a Compare March 23, 2024 12:40
@oanaOM oanaOM changed the title wip: add new rule feat: add missing-directive-value rule Mar 23, 2024
@oanaOM oanaOM marked this pull request as ready for review March 23, 2024 12:47
@oanaOM
Copy link
Contributor Author

oanaOM commented Mar 23, 2024

thanks for sharing that @ota-meshi! Sorry for my delayed reply, I think this PR is ready for your review, please.

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 think the rule name need to be a little more clear.
This rule targets the client:only directive, so a name like missing-client-only-directive-value would be a good. What do you think?

docs/rules/missing-client-directive-value.md Outdated Show resolved Hide resolved
docs/rules/missing-client-directive-value.md Outdated Show resolved Hide resolved
src/rules/missing-client-directive-value.ts Outdated Show resolved Hide resolved
.changeset/slimy-pillows-change.md Outdated Show resolved Hide resolved
@oanaOM
Copy link
Contributor Author

oanaOM commented Mar 24, 2024

Thanks for your review @ota-meshi ! I've pushed the changes mentioned after your review

Thank you for this PR!

I think the rule name need to be a little more clear. This rule targets the client:only directive, so a name like missing-client-only-directive-value would be a good. What do you think?

That was my initial thought as well but then was thinking it to name it more generic in case in the future Astro team introduces a new directive that needs to satisfy the same condition.

@ota-meshi
Copy link
Owner

ota-meshi commented Mar 24, 2024

That was my initial thought as well but then was thinking it to name it more generic in case in the future Astro team introduces a new directive that needs to satisfy the same condition.

Hmm. I cannot agree with your opinion.
If this rule is a rule that verifies that the client:* directive is correct, I think a rule might report a value that has no effect, like <MyComponent client:idle="off" />. It's not that the value is missing. That is, the rule name missing-client-directive-value is already not generic.

Also, I like rule implementation to be as simple as possible, so I think it's better to create new rules for rules that report something different.

.changeset/slimy-pillows-change.md Outdated Show resolved Hide resolved
@oanaOM
Copy link
Contributor Author

oanaOM commented Mar 24, 2024

That was my initial thought as well but then was thinking it to name it more generic in case in the future Astro team introduces a new directive that needs to satisfy the same condition.

Hmm. I cannot agree with your opinion. If this rule is a rule that verifies that the client:* directive is correct, I think a rule might report a value that has no effect, like <MyComponent client:idle="off" />. It's not that the value is missing. That is, the rule name missing-client-directive-value is already not generic.

Also, I like rule implementation to be as simple as possible, so I think it's better to create new rules for rules that report something different.

fair points. I don't mind changing it so I'll go ahead and change it to missing-client-only-directive-value

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! Thank you for your contribution!

@ota-meshi ota-meshi merged commit d55a51e into ota-meshi:main Mar 24, 2024
9 checks passed
@oanaOM
Copy link
Contributor Author

oanaOM commented Mar 24, 2024

great! It was my pleasure :D

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