Javascript 规则'的定义@typescript eslint/no隐式any';在Storybook js中找不到
当我通过运行Javascript 规则'的定义@typescript eslint/no隐式any';在Storybook js中找不到,javascript,reactjs,typescript,eslint,storybook,Javascript,Reactjs,Typescript,Eslint,Storybook,当我通过运行Storybook.js对生成的代码进行更改时,会出现此错误。这些是我遵循的指示 但由于我正在将StorybookJS添加到现有项目中,所以我只运行了以下命令: $ npx -p @storybook/cli@next sb init --story-format=csf-ts $ yarn add @storybook/addon-docs@next --dev 运行故事书会产生此错误 ERROR in ./src/stories/0-Welcome.stories.tsx M
Storybook.js
对生成的代码进行更改时,会出现此错误。这些是我遵循的指示
但由于我正在将StorybookJS
添加到现有项目中,所以我只运行了以下命令:
$ npx -p @storybook/cli@next sb init --story-format=csf-ts
$ yarn add @storybook/addon-docs@next --dev
运行故事书会产生此错误
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服务器运行正常,但只要我对某些文本进行更改并且storybook
尝试重新加载更改,就会出现上面所示的错误
在create react app
的幕后有很多神奇的事情发生,所以我不知道如何精确定位和修复这个错误。我的猜测是缺少eslint类型脚本规则
,因此在Storybook
重新加载任何类型的更改时,会出现缺少规则的错误
听起来您缺少描述规则的.eslintrc.json
文件。您可以在此处阅读有关文件格式和选项的更多信息:
例如:
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": "error"
}
}
如果错误仍然发生,请尝试配置no implicit any
规则 你看到这个了吗?另外,如果你能找到你的json文件eslint,你只需添加规则,看看这是否解决。@mwilson Withcreate react app
我想.eslintrc
文件对我来说是隐藏的。所以我只需要找到那个JSON文件并添加规则?是的,我不确定那个应用程序是否使用了不同的东西,但通常有一个名为tslint.JSON
的文件,它只是一个带有TypeScript lint规则的JSON文件。如果你在回购协议的某个地方有这样的信息,我可以看一看错误信息有点让人困惑。ES高呼JavaScript,但是没有任何隐式的是一种类型脚本。因为它挂在@typescript eslint
路径上,所以我假设您正在使用TypeScript@mwilson我添加了.eslintrc.json,它成功了!你回答这个问题,我会记下来的!非常感谢。