Eslint 'rxjs/operators' 应该列在项目的依赖项中 [英] Eslint 'rxjs/operators' should be listed in the project's dependencies
本文介绍了Eslint 'rxjs/operators' 应该列在项目的依赖项中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我在我的文件中有这个导入
So i have this import on my file
import { catchError, finalize } from 'rxjs/operators';
当我运行 eslint 时,我收到此错误:
And when i run eslint i get this error:
error 'rxjs/operators' should be listed in the project's dependencies. Run 'npm i -S rxjs/operators' to add it import/no-extraneous-dependencies
我在 package.json 依赖项列表中有 rxjs,但似乎 eslint 认为 'rxjs/operators' 是另一个包.
I have rxjs in the package.json dependencies list, but it seems eslint thinks 'rxjs/operators' is another package instead.
在我的 eslintrc 文件中,我有这个规则:
In my eslintrc file, i have this rule:
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": ["**/*.test.ts", "**/*.test.tsx"]
}
],
推荐答案
我遇到了同样的问题并修复了以下问题:这个通过添加
I had the same problem and fixed it following: this by adding
...
"settings": {
"import/core-modules": ["rxjs/operators"]
},
...
在我的 .eslintrc.json 配置文件中.
in my .eslintrc.json config file.
这篇关于Eslint 'rxjs/operators' 应该列在项目的依赖项中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文