Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TypeError: Cannot read properties of undefined (reading 'parserOptions') #3519

Closed
2 tasks done
chenxsan opened this issue Jan 12, 2023 · 3 comments
Closed
2 tasks done
Labels

Comments

@chenxsan
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

I'm trying to use the latest eslint-plugin-react 7.32.0 within the new ESLint configuration file and ran into TypeError: Cannot read properties of undefined (reading 'parserOptions') error.

You can see a reproduction here https://stackblitz.com/edit/node-zkuutt?file=package.json,eslint.config.js.

Just run npx eslint . in the terminal:

❯ npx eslint .
(node:5) Warning: Accessing non-existent property 'languageOptions' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:5) Warning: Accessing non-existent property 'languageOptions' of module exports inside circular dependency

Oops! Something went wrong! :(

ESLint: 8.31.0

TypeError: Cannot read properties of undefined (reading 'parserOptions')
    at Object.eval (file:///home/projects/node-zkuutt/node_modules/eslint-plugin-react/configs/jsx-runtime.js:7:58)
    at Object.function (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:15:143858)
    at Module._compile (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:219079)
    at Module._extensions..js (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:219743)
    at Module.load (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:217769)
    at Module._load (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:215340)
    at Module.require (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:218087)
    at i (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:415284)
    at _0x3eb0e0 (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:15:143113)
    at Object.eval (file:///home/projects/node-zkuutt/node_modules/eslint-plugin-react/index.js:8:23)

Expected Behavior

No problem using the latest eslint-plugin-react with new ESLint configuration.

eslint-plugin-react version

7.32.0

eslint version

8.3.10

node version

18.12.1

@chenxsan chenxsan added the bug label Jan 12, 2023
@alexey-koran
Copy link
Contributor

Same behavior

@alexey-koran
Copy link
Contributor

@ljharb Hello. You are trying to get all rules here, while the 'all' obj is empty, due to the circular dependency

languageOptions: Object.assign({}, all.languageOptions, {

@alexey-koran
Copy link
Contributor

alexey-koran commented Jan 14, 2023

Is there an existing issue for this?

* [x]  I have searched the existing issues and my issue is unique

* [x]  My issue appears in the command-line and not only in the text editor

Description Overview

I'm trying to use the latest eslint-plugin-react 7.32.0 within the new ESLint configuration file and ran into TypeError: Cannot read properties of undefined (reading 'parserOptions') error.

You can see a reproduction here https://stackblitz.com/edit/node-zkuutt?file=package.json,eslint.config.js.

Just run npx eslint . in the terminal:

❯ npx eslint .
(node:5) Warning: Accessing non-existent property 'languageOptions' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:5) Warning: Accessing non-existent property 'languageOptions' of module exports inside circular dependency

Oops! Something went wrong! :(

ESLint: 8.31.0

TypeError: Cannot read properties of undefined (reading 'parserOptions')
    at Object.eval (file:///home/projects/node-zkuutt/node_modules/eslint-plugin-react/configs/jsx-runtime.js:7:58)
    at Object.function (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:15:143858)
    at Module._compile (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:219079)
    at Module._extensions..js (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:219743)
    at Module.load (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:217769)
    at Module._load (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:215340)
    at Module.require (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:218087)
    at i (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:6:415284)
    at _0x3eb0e0 (https://nodezkuutt-lqq5.w-corp.staticblitz.com/blitz.66cf64d5daaa658854f44d80ebff4b4ffb72d9a1.js:15:143113)
    at Object.eval (file:///home/projects/node-zkuutt/node_modules/eslint-plugin-react/index.js:8:23)

Expected Behavior

No problem using the latest eslint-plugin-react with new ESLint configuration.

eslint-plugin-react version

7.32.0

eslint version

8.3.10

node version

18.12.1

As a workaround right now u can import reactPlugin previously

const reactPlugin = require('eslint-plugin-react');
const reactConfig = require('eslint-plugin-react/configs/recommended');

plugins: {
  react: reactPlugin,
},

rules: {
  ...reactConfig.rules,
}

ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 14, 2023
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 14, 2023
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 15, 2023
@ljharb ljharb closed this as completed in a847c84 Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants