Open AndreaPontrandolfo opened 1 year ago
The most obvious thing that needs to happen is to publish TypeScript typings for the package, so that you can programmatically import and use this ESLint plugin with type safety when your eslint.config.js
file is type-checked:
// @ts-check
// Currently `any` :(
// Even worse, it's actually a TypeScript error if `compilerOptions.moduleResolution`
// is configured to `bundler` instead of `nodenext`, about there being no default export.
import eslintPluginStorybook from "eslint-plugin-storybook";
Hey there! Thanks for opening this issue.
Are you willing to contribute to make this happen? I'm happy to guide in the process if needed!
@yannbf I'm interested in helping with this. I don't think it'll be too complicated.
Would the approach be a major version bump and go all in on the change, or do we somehow offer support for both formats and make it opt-in for projects using flag configs?
I would love to contribute but i also have my hands-full with OSS projects right now.
Hey @AndreaPontrandolfo @waldemarfm contributions are definitely welcome. If this change can be done in a backwards compatible way, that'd be definitely preferred! If you know what are the steps to support this format, describing those would already be quite helpful as well!
Some more information: Plugin Migration to Flat Config - ESLint
Do we have any new updates on this issue?
Hey everyone! There is a canary version that introduced support to the flat config file while trying to maintain it backwards compatible. We are not 100% confident of merging it yet, so please give it a try:
npm install eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
# or
yarn add eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
Feedback is truly appreciated.
@yannbf Tested on project and linting works with flat config, only thing to improve is types but that's already mentioned in PR
eslint-plugin-storybook@0.9.0--canary.156.da7873a.0 Works for me with eslint 8.57
canary has been working for us with eslint 9 & flat config
Hey everyone! There is a canary version that introduced support to the flat config file while trying to maintain it backwards compatible. We are not 100% confident of merging it yet, so please give it a try:
npm install eslint-plugin-storybook@0.9.0--canary.156.da7873a.0 # or yarn add eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
Feedback is truly appreciated.
hello,could you tell how to configure this plugin in the flat config?
eslint.config.js
:
import eslintPluginStorybook from "eslint-plugin-storybook"
export default [
// other config here
...eslintPluginStorybook.configs["flat/recommended"],
// more config
]
Not sure if anyone is running into this, but it seems I had to make this change when using eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
in dist/configs/flat/recommended.js
{
name: 'storybook:recommended:stories-rules',
- files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
+ files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
Not sure if anyone is running into this, but it seems I had to make this change when using
eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
indist/configs/flat/recommended.js
{ name: 'storybook:recommended:stories-rules', - files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'], + files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
we have the same problem, it's already mentioned in the flat-config PR #156
Thank you for updating this package to support flat config.
However, I encountered an issue as this package depends on a very old version of @typescript-eslint/utils
^5.62.0
.
That version of @typescript-eslint/utils
does not support ESLint 9, which causes yarn dependency resolution to fail
Not sure if anyone is running into this, but it seems I had to make this change when using
eslint-plugin-storybook@0.9.0--canary.156.da7873a.0
indist/configs/flat/recommended.js
{ name: 'storybook:recommended:stories-rules', - files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'], + files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
we have the same problem, it's already mentioned in the flat-config PR #156
Ah great didn't catch that, thanks!
Any plans to support the new Eslint FlatConfig format,
eslint.config.js
? In the next major release of Eslint, the new format is gonna be the default and the old format deprecated, so it should be updated.