You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance no-renderer-packages rule documentation and implementation
- Updated the documentation for the `no-renderer-packages` rule to include specific framework package suggestions based on the renderer being used.
- Refactored the rule's implementation to utilize a mapping of renderer packages to their corresponding framework packages, improving clarity and maintainability.
- Added additional framework-specific package links in the documentation for better guidance.
Copy file name to clipboardExpand all lines: docs/rules/no-renderer-packages.md
+20-4Lines changed: 20 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,20 @@
10
10
11
11
This rule prevents importing Storybook renderer packages directly in stories. Instead, you should use framework-specific packages that are designed for your build tool (e.g., Vite, webpack).
12
12
13
+
The rule will suggest appropriate framework packages based on which renderer you're trying to use:
14
+
15
+
- For `@storybook/html`: Use `@storybook/html-vite` or `@storybook/html-webpack5`
16
+
- For `@storybook/preact`: Use `@storybook/preact-vite` or `@storybook/preact-webpack5`
17
+
- For `@storybook/react`: Use `@storybook/nextjs`, `@storybook/react-vite`, `@storybook/react-webpack5`, `@storybook/react-native-web-vite`, or `@storybook/experimental-nextjs-vite`
18
+
- For `@storybook/server`: Use `@storybook/server-webpack5`
19
+
- For `@storybook/svelte`: Use `@storybook/svelte-vite`, `@storybook/svelte-webpack5`, or `@storybook/sveltekit`
20
+
- For `@storybook/vue3`: Use `@storybook/vue3-vite` or `@storybook/vue3-webpack5`
21
+
- For `@storybook/web-components`: Use `@storybook/web-components-vite` or `@storybook/web-components-webpack5`
// Do use the appropriate framework package for your build tool
36
+
import { something } from'@storybook/react-vite'// For Vite
37
+
import { something } from'@storybook/vue3-webpack5'// For Webpack 5
38
+
import { something } from'@storybook/web-components-vite'// For Vite
39
+
import { something } from'@storybook/nextjs'// For Next.js
27
40
```
28
41
29
42
## When Not To Use It
30
43
31
-
If you have a specific need to use renderer packages directly in your stories, you can disable this rule. However, it's recommended to use the framework-specific packages as they are optimized for your build tool.
44
+
If you have a specific need to use renderer packages directly in your stories, you can disable this rule. However, it's recommended to use the framework-specific packages as they are optimized for your build tool and provide better integration with your development environment.
32
45
33
46
## Further Reading
34
47
@@ -37,3 +50,6 @@ For more information about Storybook's framework-specific packages and build too
37
50
-[Storybook for React](https://storybook.js.org/docs/react/get-started/install)
38
51
-[Storybook for Vue](https://storybook.js.org/docs/vue/get-started/install)
39
52
-[Storybook for Web Components](https://storybook.js.org/docs/web-components/get-started/install)
53
+
-[Storybook for Svelte](https://storybook.js.org/docs/svelte/get-started/install)
54
+
-[Storybook for HTML](https://storybook.js.org/docs/html/get-started/install)
55
+
-[Storybook for Preact](https://storybook.js.org/docs/preact/get-started/install)
0 commit comments