1

When adding the jest plugin to .eslintrc.js, I get the following stack error:

TypeError: Cannot read property 'meta' of undefined

  1. Create new react native project using react-native CLI
  2. Install eslint and run ./node_modules/.bin/eslint --init
  3. Install eslint-plugin-jest
  4. Add jest to the plugin array in .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: {}
};

I expect that eslint picks up the eslint-plugin-jest plugin, but instead I get

[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)
skyboyer
  • 22,209
  • 7
  • 57
  • 64
Ryu Kent
  • 661
  • 5
  • 7
  • 1
    https://github.com/jest-community/eslint-plugin-jest/issues/268 – jonrsharpe May 22 '19 at 17:52
  • Issue raised on their github issues list. Someone suggested downgrading to 22.5.1 but while that solves the problem, more issues arise with the location of eslint-plugin-jest/lib/index.js. Still no solution at the moment. – Ryu Kent May 22 '19 at 18:20
  • Still, we can't help you fix problems in third party code, that's what their issue tracker is for. – jonrsharpe May 22 '19 at 18:21
  • Yeah, understood. Left the message here for anyone else who finds this page. Package maintainers are aware of the issue and plan to release an update later today I think. – Ryu Kent May 22 '19 at 19:03

1 Answers1

1

This was a temporary issue in 22.6 up to 22.6.2. It has now been fixed in 22.6.3 released today. Just need to update the package.

Ryu Kent
  • 661
  • 5
  • 7