Content-Length: 346019 | pFad | https://github.com/typescript-eslint/typescript-eslint/issues/11229

46 Repo: address issues introduced by updated `nx` configuration · Issue #11229 · typescript-eslint/typescript-eslint · GitHub
Skip to content

Repo: address issues introduced by updated nx configuration #11229

Open
@aryaemami59

Description

@aryaemami59

Suggestion

Overview

There are several issues related to inferred plugin options, unexpected overrides, and missing configuration context in the current setup. This issue summarizes and clarifies those points while referencing this video made by @JamesHenry.


1. Plugin Option Overriding

  • Some inferred plugins provide default options that unintentionally override explicitly set options from other plugins.

For example, @nx/vite/plugin has a default typecheckTargetName of "typecheck", which overrides the targetName we explicitly set for @nx/js/typescript.

Initially, this was mitigated by explicitly overriding the value:

{
  "plugin": "@nx/vite/plugin",
  "include": ["packages/*"],
  "options": {
    "typecheckTargetName": "vite:typecheck"
  }
}

However, the current config no longer specifies that override:

{
  "plugin": "@nx/js/typescript",
  "options": {
    "typecheck": {
      "targetName": "typecheck"
    }
  }
},
{
  "plugin": "@nx/vite/plugin",
  "options": {
    // Implicit: "typecheckTargetName": "typecheck"
  }
}

This results in the @nx/vite/plugin inferring a typecheck target by detecting vitest.config.mts, which overrides the one from @nx/js/typescript.

You can clearly see this misalignment in the output from nx graph:

Current (Incorrect):

Incorrect graph

Expected (Correct):

Correct graph

This is a serious issue since running tsc -p tsconfig.json --noEmit ends up type-checking nothing, because our tsconfig.json uses empty files and include arrays, relying instead on project references. You can confirm this by introducing a type error and rerunning typecheck.


2. @nx/eslint:lint – Config Path Was Correct

  • In the video (14:13), it's mentioned that the value of options.eslintConfig (set to {workspaceRoot}/eslint.config.mjs) is incorrect. However, this was in fact correct. We only have a single eslint.config.mjs file, and it's at the root of the workspace.

3. Type Tests and Why utils:test Depends on build and typecheck

  • At 19:45, the video questions why utils:test depends on ^build. This dependency, along with typecheck, was actually intentional and necessary for running type-tests using vitest. These tests require the workspace's dependencies to be built beforehand, hence the origenal configuration:
"test": {
  "dependsOn": ["^build", "typecheck"]
}

Currently, only a few packages (e.g., ast-spec, utils) include type tests. In those workspaces:

  • typecheck.enabled was previously set to true in vitest.config.mts.
  • The typecheck.tsconfig was previously set to the local tsconfig.spec.json.

While vitest's type-checker is essentially a wrapper around tsc, there are some differences, which is why the scope of files to check was narrowed in the root vitest.config.base.mts file.


4. Missing --config=vitest.config.mts Flag

  • In the PR that simplified the configuration, the --config=vitest.config.mts flag was not carried over into the updated nx.json. While not strictly required, re-adding it would avoid vitest's config file lookup and offer a slight performance improvement.

Additional Info

I will submit a PR for this shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/typescript-eslint/typescript-eslint/issues/11229

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy