I enabled the csf-strict config in my project by adding plugin:storybook/csf-strict to the extends array in .eslintrc.js.
When running ESLint, it fails with an exception:
TypeError: Cannot use 'in' operator to search for 'name' in undefined
Occurred while linting <snip>/packages/<snip>/src/index.js:12
at <snip>/node_modules/eslint-plugin-storybook/dist/rules/no-title-property-in-meta.js:35:127
at Array.find (<anonymous>)
at ExportDefaultDeclaration (<snip>/node_modules/eslint-plugin-storybook/dist/rules/no-title-property-in-meta.js:35:51)
at <snip>/node_modules/eslint/lib/util/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (<snip>/node_modules/eslint/lib/util/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (<snip>/node_modules/eslint/lib/util/node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (<snip>/node_modules/eslint/lib/util/node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (<snip>/node_modules/eslint/lib/util/node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (<snip>/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
This filename (src/index.js) doesn't match the patterns used by other configs (like in the csf config) so the csf-strict config must not be inheriting the scoping logic when it extends csf.
To Reproduce
Not sure exactly what syntax repros the error, but to confirm that the csf-strict config runs in non-story files, you can:
Create a project with ESLint and eslint-plugin-storybook, extending the csf-strict config.
Create a file in the project that does match a story file name (example: src/index.js)
Export an anonymous object containing a title field.
See an error due to the failing no-title-property-in-meta rule.
Describe the bug
I enabled the
csf-strict
config in my project by addingplugin:storybook/csf-strict
to theextends
array in.eslintrc.js
.When running ESLint, it fails with an exception:
This filename (
src/index.js
) doesn't match the patterns used by other configs (like in the csf config) so thecsf-strict
config must not be inheriting the scoping logic when it extendscsf
.To Reproduce Not sure exactly what syntax repros the error, but to confirm that the csf-strict config runs in non-story files, you can:
csf-strict
config.src/index.js
)title
field.no-title-property-in-meta
rule.Expected behavior No failing ESLint rules.
Screenshots n/a
Additional context
eslint-plugin-storybook version 0.6.12