Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

NX 13+ removes projects from nx.json. Workspace-lint introduces it and causes errors #152

@kpaxton

Description

@kpaxton

With the later NX versions, the workspace-lint command causes issues due to it adding projects back to nx.json.

The problematic code is linked below.

projects: sortItems(file?.projects),

my suggestion is to wrap the projects property in an iif statement.

....(file?.projects ? { projects: sortItems(file?.projects) } : {})

As well as the same for packageJson and compiler options

...(file?.compilerOptions
      ? {
          compilerOptions: {
            ...file?.compilerOptions,
            paths: sortItems(file?.compilerOptions?.paths)
          }
        }
      : {})

...(file?.scripts ? { scripts: sortItems(file?.scripts) } : {})

That way, if the property doesn't exist, it won't add it back in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions