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

Support for the new FlatConfig format #135

Open
Tracked by #18093 ...
AndreaPontrandolfo opened this issue Jul 22, 2023 · 17 comments · May be fixed by #156
Open
Tracked by #18093 ...

Support for the new FlatConfig format #135

AndreaPontrandolfo opened this issue Jul 22, 2023 · 17 comments · May be fixed by #156

Comments

@AndreaPontrandolfo
Copy link

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.

@jaydenseric
Copy link

jaydenseric commented Aug 17, 2023

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";

@yannbf
Copy link
Member

yannbf commented Aug 21, 2023

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!

@waldemarfm
Copy link

@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?

@AndreaPontrandolfo
Copy link
Author

I would love to contribute but i also have my hands-full with OSS projects right now.

@yannbf
Copy link
Member

yannbf commented Oct 8, 2023

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!

@mheob
Copy link

mheob commented Jan 26, 2024

Some more information: Plugin Migration to Flat Config - ESLint

@xdebbie
Copy link

xdebbie commented Jun 19, 2024

Do we have any new updates on this issue?

@yannbf
Copy link
Member

yannbf commented Jun 21, 2024

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 [email protected]
# or 
yarn add [email protected]

Feedback is truly appreciated.

@jerkovicl
Copy link

@yannbf Tested on project and linting works with flat config, only thing to improve is types but that's already mentioned in PR

@Adamlb
Copy link

Adamlb commented Jun 21, 2024

[email protected]
Works for me with eslint 8.57

@bmulholland
Copy link

canary has been working for us with eslint 9 & flat config

@rikisamurai
Copy link

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 [email protected]
# or 
yarn add [email protected]

Feedback is truly appreciated.

hello,could you tell how to configure this plugin in the flat config?

@bmulholland
Copy link

eslint.config.js:

import eslintPluginStorybook from "eslint-plugin-storybook"

export default [
   // other config here
  ...eslintPluginStorybook.configs["flat/recommended"],
  // more config
]

@stevezhu

This comment was marked as resolved.

@kuschti
Copy link

kuschti commented Jun 27, 2024

Not sure if anyone is running into this, but it seems I had to make this change when using [email protected] 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)'],

we have the same problem, it's already mentioned in the flat-config PR #156

@maxpatiiuk
Copy link

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

@stevezhu
Copy link

Not sure if anyone is running into this, but it seems I had to make this change when using [email protected] 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)'],

we have the same problem, it's already mentioned in the flat-config PR #156

Ah great didn't catch that, thanks!

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 a pull request may close this issue.