storybookjs / eslint-plugin-storybook

🎗Official ESLint plugin for Storybook
MIT License
238 stars 42 forks source link

Add meta-satisfies-type rule #124

Open NotWoods opened 1 year ago

NotWoods commented 1 year ago

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:

Change Type

Indicate the type of change your pull request is:

yannbf commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Looks good!

NotWoods commented 1 year ago

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

kasperpeulen commented 1 year ago

cc @yannbf

hjoelh commented 10 months ago

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 commented 10 months ago

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

yannbf commented 10 months ago

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

NotWoods commented 4 months ago

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