gpt4 book ai didi

javascript - Storybook js 未找到规则 '@typescript-eslint/no-implicit-any' 的定义

转载 作者:行者123 更新时间:2023-11-30 19:00:37 26 4
gpt4 key购买 nike

当我更改运行 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 规则,因此在 Storybook 重新加载任何类型的更改时,会发生缺少规则错误

enter image description here

最佳答案

听起来您缺少描述规则的 .eslintrc.json 文件。您可以在此处阅读有关文件格式和选项的更多信息:https://eslint.org/docs/user-guide/configuring

例子:

{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": "error"
}
}

如果错误仍然存​​在,请尝试配置 no-implicit-any 规则。

关于javascript - Storybook js 未找到规则 '@typescript-eslint/no-implicit-any' 的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59549122/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com