Describe the bug
When spreading in an object into the default export of a stories-file, I noticed that at least the title property must be set directly, or else the eslint process will throw an error: Cannot read property 'name' of undefined and the whole linting process is terminated.
To Reproduce
A minimal reproduction can be achieved by exporting the default export like this:
const storyTemplate = {
title: "My Component",
component: "my-component", // this line is not even necessary
};
export default {
...storyTemplate,
};
When running eslint, this will throw an error: Cannot read property 'name' of undefined (pointing to the line of the default export).
Linting will not break if you add in the "title" field:
export default {
title: storyTemplate.title, // without this line, eslint rules for storybook will break
...storyTemplate,
};
Linting will also break, if the above title line is added after the spreaded-in ...storyTemplate:
export default {
...storyTemplate,
title: storyTemplate.title, // this will break
};
Expected behavior
Linting should not throw an Error
Additional context
I'm using Storybook 6.4.9 for web-components and eslint-plugin-storybook 0.5.6
Describe the bug When spreading in an object into the default export of a stories-file, I noticed that at least the
title
property must be set directly, or else the eslint process will throw an error:Cannot read property 'name' of undefined
and the whole linting process is terminated.To Reproduce A minimal reproduction can be achieved by exporting the default export like this:
When running eslint, this will throw an error:
Cannot read property 'name' of undefined
(pointing to the line of the default export).Linting will not break if you add in the "title" field:
Linting will also break, if the above
title
line is added after the spreaded-in...storyTemplate
:Expected behavior Linting should not throw an Error
Additional context I'm using Storybook 6.4.9 for web-components and eslint-plugin-storybook 0.5.6