Why eslint consider JSX or some react @types undefined, since upgrade typescript-eslint/parser to version 4.0.0

I had the same issue when trying to declare variables as of type JSX.Element in typescript. I added "JSX":"readonly" to globals in .eslintrc.json and the problem was gone. In your case it would be:

globals: {
    React: true,
    google: true,
    mount: true,
    mountWithRouter: true,
    shallow: true,
    shallowWithRouter: true,
    context: true,
    expect: true,
    jsdom: true,
    JSX: true,
},

From the following link, I got that you actually use several options after JSX. You could use true,false, writable or readonly (but not off).

https://eslint.org/docs/user-guide/configuring

Leave a Comment