-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
ESLint: Only apply csf-strict rules on stories files #31963
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
Merged
yannbf
merged 4 commits into
storybookjs:next
from
cylewaitforit:csf-strict-on-stories-files
Nov 7, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e9c4f86
fix(csf-strict): apply csf-strict rules on stories files
cylewaitforit 01fe23d
Merge branch 'next' into csf-strict-on-stories-files
cylewaitforit 195d2ea
Merge branch 'next' into csf-strict-on-stories-files
cylewaitforit 47d8e38
Merge branch 'next' into csf-strict-on-stories-files
yannbf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there @cylewaitforit, thanks for your contribution!
Won't this block users from specifying their own files to apply these rules? As it now has hardcode file paths? Perhaps we can do differently and leave things as they were, and only move these general, conflicting rules to a new entry that's always added, and has the hardcoded paths:
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @yannbf, thanks for reviewing. This updates csf-strict to follow the same pattern used by the other configs (see https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/src/configs/recommended.ts and https://github.com/storybookjs/storybook/blob/next/code/lib/eslint-plugin/src/configs/csf.ts). Users should still have the ability to make any overrides in their own config after extending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yannbf Another option, if you’re concerned about this legacy config, might be to only leave the fix for the Flat Config and instead mark the legacy config options as deprecated for removal in V10 of this storybook eslint plugin.
Overriding files types for a config on the user side is very straight forward in the flat config and can be easily verified with the eslint config inspector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yannbf Are the legacy configs staying in eslint for Storybook 10 or will they be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there, I'm so sorry this has become stale for so long.
We don't have plans to drop ESLint v8 support as there are still tons of users on that version.
Additionally, I spent some time today on this PR and made changes to address my concern, by separating the normal rules (without any overrides) to the extra overrides (which would use the overrides), so that users can define any file name for stories.. but to be honest, this plugin's purpose is to help users follow standards, and the story file name is a standard 😅 so I'll just go on and accept your PR as is! Thank you so much for your contribution 🙏
If users report this as a breaking change I'll revisit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yannbf! Appreciate the time and thoughtfulness you gave to the review.