-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Is your feature request related to a problem? Please describe.
Whenever users register addons in main.js, there's a possibility of:
1 - having typos
2 - registering addons that are not installed (not in package.json)
In either scenario, the users get this current error when running Storybook, which is not helpful at all:
WARN Failed to load preset: {"type":"presets"} on level 1
ERR! TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of Object
Describe the solution you'd like
There should be an eslint rule that warns users that addons were registered in main.js but they are not installed.
1 - Process main.js files
2 - Identify the addons
field from it
3 - Go through each addon and check whether they exist in package.json
(Ideally read once and cached or something like that)
4 - If the addon is not in package.json, report to users
Possible
Additional context
It's important to know the ways you can register an addon:
// .storybook/main.js
module.exports = {
addons: [
// default way of registering an addon
'@storybook/addon-essentials',
// advanced way of registering an addon
{
name: '@storybook/addon-essentials',
options: { docs: false }
}
]
}