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

[Graph] targetDefaults non-named inputs broken as of Nx v18 #23271

Open
1 of 4 tasks
warnellw opened this issue May 9, 2024 · 3 comments
Open
1 of 4 tasks

[Graph] targetDefaults non-named inputs broken as of Nx v18 #23271

warnellw opened this issue May 9, 2024 · 3 comments
Assignees
Labels
scope: core core nx functionality type: bug

Comments

@warnellw
Copy link

warnellw commented May 9, 2024

Current Behavior

As of Nx v18 (also v19), inputs provided to targetDefaults that are not a namedInput group are not correctly used when calculating affected.

Note useInferencePlugins is set to false

Expected Behavior

Non-named/grouped inputs are used when calculating affected, just as they were in Nx v17.

GitHub Repo

https://github.com/warnellw/nx-bug

Steps to Reproduce

Clone the linked repo. Modify the .eslintrc.json file or the jest.preset.js file. Note no projects are affected.

Here is a basic example using the @nx/eslint:lint target:

"useInferencePlugins": false,
"targetDefaults": {
  "@nx/eslint:lint": {
      "inputs": [
        "default",
        "^production",
        "{workspaceRoot}/.eslintrc.json" // when modified, does not affect
      ],
      "cache": true
    },
}

As per the comment, modifying the .eslintrc.json file in this example does not affect any projects. There are a few caveats to this:

  1. If there are no named groups present affected is calculated correctly (i.e. only "{workspaceRoot}/.eslintrc.json" is present).
  2. Only named groups are used. The following example seems to work correctly:
"useInferencePlugins": false,
"targetDefaults": {
  "@nx/eslint:lint": {
      "inputs": [
        "rootESLint",
        "default",
        "^production"
      ],
      "cache": true
    },
},
"namedInputs": {
  "default": [...],
  "production": [...],
  "rootESLint": [
    "{workspaceRoot}/.eslintrc.json" 
  ]
}

Nx Report

Issue also present in Nx v19

Node   : 20.12.2
OS     : darwin-x64
npm    : 10.5.0

nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/jest           : 18.3.4
@nx/linter         : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/devkit         : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nx/nest           : 18.3.4
@nx/node           : 18.3.4
@nrwl/tao          : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

@warnellw
Copy link
Author

warnellw commented May 9, 2024

I updated the original report with a GitHub Repo. The repo was generated via npx create-nx-workspace@18.3.4, and the @nx/nest plugin added and initialized, and new app generated. Cloning the repo and modifying either the .eslintrc.json file or the jest.preset.js file does not affect any targets (as expected).

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label May 9, 2024
@warnellw
Copy link
Author

warnellw commented May 10, 2024

In addition to workspace root files not working correctly, I also noticed that excluded inputs (those starting with a !) were broken. There is another related issue filed #22930

@paulhobbel
Copy link

paulhobbel commented May 16, 2024

We seem to experience similar issues in our repo. It started because Nx fails to pickup dependency changes from other languages then JS. So we've tried to add the Cargo.lock and Cargo.toml inputs and it seems to not pick up the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core core nx functionality type: bug
Projects
None yet
Development

No branches or pull requests

4 participants