在我的下一个/React/Typescript/Jest项目中,我正在尝试配置我的eslint配置。更新到版本8.x (当前为8.0.1)后,linter抛出以下错误:
Error: .eslintrc.js » ./eslint/config.js:
Environment key "jest/globals" is unknown
然后,我将'plugin:jest/recommended'
添加到我的config.js
中的extends
数组中,这导致了这个错误:
TypeError: Failed to load plugin 'jest' declared in '.eslintrc.js » ./eslint/config.js': Class extends value undefined is not a constructor or null
该插件已安装在我的package.json
中。甚至有几个npm ci
在这一点上也没有帮到我。
会很欣赏你的想法!
发布于 2021-10-20 20:45:43
你在使用其他的eslint插件吗?如果是这样,npm是否警告过您任何对等依赖问题?
我在升级到eslint v8.0.1时遇到了同样的问题。在5月份的情况下,一个插件I列出了@typescript-eslint/eslint-plugin
的一个早期版本作为直接依赖(@typescript-eslint/eslint-plugin
也是eslint-plugin-jest
的对等依赖)。此早期版本的@typescript-eslint/eslint-plugin
与eslint
v8.0.1不兼容。所以我选择降级到v7.32.0
如果你能控制你使用的其他插件,你可以升级它们的依赖关系并发布一个新的版本。否则,你可能不得不在你的项目中降级eslint
。
https://stackoverflow.com/questions/69612449
复制相似问题