通过运行Storybook.js
对生成的代码进行更改时,出现此错误。这些是我要遵循的指示
https://gist.github.com/shilman/bc9cbedb2a7efb5ec6710337cbd20c0c
但是因为我要向现有项目添加StorybookJS
,所以我运行的唯一命令是:
$ npx -p @storybook/cli@next sb init --story-format=csf-ts
$ yarn add @storybook/addon-docs@next --dev
运行yarn storybook
会产生此错误。
ERROR in ./src/stories/0-Welcome.stories.tsx
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):
Line 5:1: Definition for rule '@typescript-eslint/no-implicit-any' was not found @typescript-eslint/no-implicit-any
Line 24:1: Definition for rule '@typescript-eslint/no-implicit-any' was not found @typescript-eslint/no-implicit-any
故事书服务器运行正常,但是当我对某些文本进行更改并且Storybook
尝试重新加载更改后,我得到了上面看到的错误。
create-react-app
的幕后发生了许多魔术,因此我不知道如何查明和解决此错误。我的猜测是缺少eslint typescript rule
,因此Storybook
重新加载任何类型的更改后,就会发生丢失的规则错误
答案 0 :(得分:1)
听起来您好像缺少描述规则的.eslintrc.json
文件。您可以在此处了解有关文件格式和选项的更多信息:https://eslint.org/docs/user-guide/configuring
示例:
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": "error"
}
}
如果错误仍然存在,请尝试配置no-implicit-any
规则。