Eslint-plugin-jest提供"ESLint堆栈跟踪:TypeError:无法读取未定义"的属性'meta&39;

2022-03-30 00:00:00 javascript eslint jestjs

jest插件添加到.eslintrc.js时,出现以下堆栈错误:

TypeError: Cannot read property 'meta' of undefined

  1. 使用react-nativeCLI创建新的Reaction本机项目
  2. 安装eslint并运行./node_modules/.bin/eslint --init
  3. 安装eslint-plugin-jest
  4. 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中得到了修复。只需更新程序包。

相关文章