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

Add meta-satisfies-type rule #124

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

Conversation

NotWoods
Copy link

@NotWoods NotWoods commented Apr 17, 2023

Issue: #123

What Changed

Added a new rule to check that meta is always followed by satisfies Meta.

This probably needs a new configuration (ie csf-typescript) for TypeScript-only rules. I'm not sure if ESLint has a way to check the file extension or not.

Checklist

Check the ones applicable to your change:

  • Ran yarn update-all
  • Tests are updated
  • Documentation is updated

Change Type

Indicate the type of change your pull request is:

  • maintenance
  • documentation
  • patch
  • minor
  • major

@yannbf
Copy link
Member

yannbf commented Apr 18, 2023

Hey @NotWoods thanks a lot for your contribution! Looks pretty cool. I think it needs more thought indeed, regarding a new category or something, as we don't want this to be enforced by default. We could potentially introduce the rule disabled by default, so users can enable when they want.

@kasperpeulen I believe you might be interested in this!

@NotWoods
Copy link
Author

I removed the current requirement that a rule has at least one category. That should let this rule be included without getting enabled by default :)

@kasperpeulen
Copy link
Contributor

Looks good!

@NotWoods
Copy link
Author

Hello! Just checking in, is there any changes I need to make to this rule?

@kasperpeulen
Copy link
Contributor

cc @yannbf

@hjoelh
Copy link
Contributor

hjoelh commented Aug 8, 2023

Looks great @NotWoods 🚀

Do you think we'd need a separate rule for enforcing StoryObj<typeof meta> instead of StoryObj<typeof YourComponent> to get full safety? (thats the only way I can get TS to complain about required props/args)

Btw, it looks like the pr contains a duplicate test file?
tests/lib/rules/meta-safisfies-type.test.ts
tests/lib/rules/meta-satisfies-type.test.ts

@NotWoods
Copy link
Author

NotWoods commented Aug 8, 2023

Yeah, I think that should be added as a separate rule. I'll look into fixing the duplicate file.

@yannbf
Copy link
Member

yannbf commented Aug 15, 2023

Hey there, I'll be checking this with @kasperpeulen this week, thanks for your patience 🙏

@NotWoods
Copy link
Author

NotWoods commented Feb 2, 2024

Hi folks, are there any changes I need to make here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Empathy Backlog
Development

Successfully merging this pull request may close these issues.

4 participants