Eslint-plugin-jest提供";ESLint堆栈跟踪:TypeError:无法读取未定义";的属性';meta&39;
将jest
插件添加到.eslintrc.js
时,出现以下堆栈错误:
TypeError: Cannot read property 'meta' of undefined
- 使用
react-native
CLI创建新的Reaction本机项目 - 安装eslint并运行
./node_modules/.bin/eslint --init
- 安装eslint-plugin-jest
- 将
jest
添加到.eslintrc.js
中的插件数组
.eslintrc.js
module.exports = {
env: {
browser: true,
es6: true
},
extends: ["standard", "plugin:jest/recommended"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
},
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: "module"
},
plugins: ["react", "jest"],
rules: {}
};
我预计eslint会选择eslint-plugin-jest插件,但我得到的却是
[Error - 18:38:16] ESLint stack trace:
[Error - 18:38:16] TypeError: Cannot read property 'meta' of undefined
at c.isFunction.H.handled.has.p.getRules.forEach (/home/bob/.vscode/extensions/dbaeumer.vscode-eslint-1.9.0/server/out/eslintServer.js:1:55431)
at Map.forEach (<anonymous>)
at /home/bob/.vscode/extensions/dbaeumer.vscode-eslint-1.9.0/server/out/eslintServer.js:1:55413
at W.E.get.N.then.n (/home/bob/.vscode/extensions/dbaeumer.vscode-eslint-1.9.0/server/out/eslintServer.js:1:55555)
解决方案
这是22.6至22.6.2中的临时问题。它现在已经在今天发布的22.6.3中得到了修复。只需更新程序包。
相关文章