Skip to content

isMigrationToMonorepoNeeded uses graph and not getProjects #34531

@willyboy

Description

@willyboy

Current Behavior

When generating an eslint project, the code runs isMigrationToMonorepoNeeded to see if it should split a root eslint.config.mjs into eslint.config.mjs and eslint.base.config.mjs. This means that conversion to monorepo will not happen if you create a workspace with a root project.json and a new project before committing the tree. This results in a delay for when that file is created. Additionally, when base is created, it does not copy custom rules from the original file. This means that any code that adds rules to the root eslint file needs to know when base is created so that it can move rules over.

Expected Behavior

isMigrationToMonorepoNeeded should use getProjects instead of the project graph. getProjects accurately reflects the state of the project in the working tree. projectGraph only reflects the graph as it is on the filesystem. Since nx has access to the tree here and only needs properties available from getProjects, that's what it should use.

GitHub Repo

No response

Steps to Reproduce

  1. Create an nx 20.8.4 workspace with a root project.json file that does not have a lint target
  2. Run a generator that calls the lint project generator on the root project
  3. In that same generator, add a new project (addProjectConfiguration)
  4. Run the lint generator on the new project
  5. Note that the eslint.config.mjs does not get split up
    The tree should have written now
  6. Now run the lint generator again on the new project - magically it splits the file now

Nx Report

nx, et.al. at 20.8.4

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

No response

Metadata

Metadata

Assignees

Labels

communityThis is a good first issue for contributingpriority: lowLow Priority (does not affect many people or not severely or has an easy workaround)scope: linterIssues related to Eslint support in Nxtype: bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions