storybookjs / eslint-plugin-storybook

🎗Official ESLint plugin for Storybook
MIT License
248 stars 56 forks source link

Error: Rules with suggestions must set the meta.hasSuggestions property to true. #54

Closed otsuky closed 2 years ago

otsuky commented 2 years ago

Describe the bug I get the following in the ESLint output:

Oops! Something went wrong! :(

ESLint: 8.3.0

Error: Rules with suggestions must set the `meta.hasSuggestions` property to `true`.
Occurred while linting /src/components/MyComponent/index.stories.tsx:1
Rule: "storybook/prefer-pascal-case"
    at Object.report (/node_modules/eslint/lib/linter/linter.js:948:35)
    at checkAndReportError (/node_modules/eslint-plugin-storybook/dist/rules/prefer-pascal-case.js:54:25)
    at /node_modules/eslint-plugin-storybook/dist/rules/prefer-pascal-case.js:122:49
    at Array.forEach (<anonymous>)
    at Program:exit (/node_modules/eslint-plugin-storybook/dist/rules/prefer-pascal-case.js:122:34)
    at ruleErrorHandler (/node_modules/eslint/lib/linter/linter.js:966:28)
    at /node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/node_modules/eslint/lib/linter/node-event-generator.js:297:26)

To Reproduce Steps to reproduce the behavior:

  1. install eslint-plugin-storybook.

npm install eslint-plugin-storybook --save-dev

Here's my deps related to eslint and storybook from package.json

{
   "dependecies": {
       "@storybook/addon-a11y": "6.4.0",
        "@storybook/addon-console": "1.2.3",
        "@storybook/addon-essentials": "6.4.0",
        "@storybook/addon-links": "6.4.0",
        "@storybook/addon-storyshots": "6.4.0",
        "@storybook/react": "6.4.0",
        "eslint": "8.3.0",
        "eslint-config-next": "12.0.4",
        "eslint-config-prettier": "8.3.0",
        "eslint-plugin-import": "2.25.3",
        "eslint-plugin-react": "7.27.1",
        "eslint-plugin-storybook": "0.5.0",
}
  1. add plugin:storybook/recommended to the extends section of .eslintrc.json.
  2. run eslint

Expected behavior Complete eslint without error.

yannbf commented 2 years ago

Hey @otsuky thank you so much for opening this issue! I believe it's a compatibility issue with Eslint 8. I'll get back to you once I have a fix. Thanks!!

yannbf commented 2 years ago

Hey @otsuky can you try version 0.5.1? Should be fixed now!

otsuky commented 2 years ago

@yannbf I installed version 0.5.1, and It's working fine in my project. Thank you so much!!!