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

plugin generator fails when using certain syntax in flat confg eslint.config.js #23080

Open
4 tasks
philipjfulcher opened this issue Apr 29, 2024 · 0 comments
Open
4 tasks
Assignees
Labels
scope: linter Issues related to Eslint support in Nx type: bug

Comments

@philipjfulcher
Copy link
Collaborator

Current Behavior

When defining variables outside config in a flat config eslint.config.js, the @nx/plugin:plugin generator fails.

Expected Behavior

When defining variables outside config in a flat config eslint.config.js, the @nx/plugin:plugin generator succeeds.

GitHub Repo

https://github.com/philipjfulcher/eslint-flat-config-repro

Steps to Reproduce

  1. Clone https://github.com/philipjfulcher/eslint-flat-config-repro and install packages
  2. Run npx nx g plugin my-plugin -d and observe that it succeeds.
  3. Checkout branch flat-config where flat config migration has been run.
  4. Run npx nx g plugin my-plugin -d and observe that it succeeds.
  5. Checkout branch plugin-generator where eslint.config.js has been changed to introduce a variable.
  6. Run npx nx g plugin my-plugin -d and observe that it fails with InvalidSymbol in JSON error.

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : darwin-arm64
npm    : 10.2.4

nx                 : 18.2.4
@nx/js             : 18.2.4
@nx/jest           : 18.2.4
@nx/linter         : 18.2.4
@nx/eslint         : 18.2.4
@nx/workspace      : 18.2.4
@nx/angular        : 18.2.4
@nx/devkit         : 18.2.4
@nx/eslint-plugin  : 18.2.4
@nx/plugin         : 18.2.4
@nrwl/tao          : 18.2.4
@nx/web            : 18.2.4
@nx/webpack        : 18.2.4
typescript         : 5.4.5

Failure Logs

NX   InvalidSymbol in JSON at 10:11

   8 |           "enforceBuildableLibDependency":  true,
   9 |           "allow":  [],
> 10 |           depConstraints
     |           ^^^^^^^^^^^^^^
  11 |         },
  12 |       ],
  13 |     },

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The problem is not isolated to just the shorthand assignment syntax. Changing it to depConstraints: depConstraints has the same problem.

Other generators may have this problem if they also interact with the eslint.config.js file, but I haven't had a chance to check any other.

@philipjfulcher philipjfulcher added type: bug scope: linter Issues related to Eslint support in Nx labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: linter Issues related to Eslint support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

2 participants