-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Repo: address issues introduced by updated nx
configuration
#11229
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
Comments
I am discussing with the team about supporting a way to explicitly disabled an inferred target, because obviously this
The mixing of executor and inference plugin points I made still stand, the setup did not make sense before. |
|
|
I think I got it, seems like all We have to do is:
Yeah, I'll add project level configs.
I agree, I won't be adding anymore executors, We'll stick with one or the other. |
@aryaemami59 No, sadly that simply sets up a target called "false" and makes it do the typechecking, so it's confusing either way, so probably reverting it to the I'll keep chatting with the team about addressing this |
If the @typescript-eslint/triage-team really prefers not having the project level configs which simply inherit from the root one, we could remove the eslint inference plugin and simply have lint scripts inline on the projects, but yeah I think having the project level configs is clearer about the intent to run linting on a project level personally |
My only question with the project-level configs is - won't the root eslint config still apply to the projects/workspaces when executing eslint? Or does nx infer a lint task for the root that excludes subprojects that have an eslint config? |
The project level eslint --config=${PROJECT_CWD}/eslint.config.mjs ${INIT_CWD} |
My concern is that executing that verbatim will lint the typescript-eslint/project.json Line 20 in 1c0e1ae
and before that, typescript-eslint/project.json Line 12 in b2be3dc
|
Here is what they would look like: In our Our root Our root Our project-level Our project-level |
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
For example,
@nx/vite/plugin
has a defaulttypecheckTargetName
of"typecheck"
, which overrides thetargetName
we explicitly set for@nx/js/typescript
.Initially, this was mitigated by explicitly overriding the value:
However, the current config no longer specifies that override:
This results in the
@nx/vite/plugin
inferring atypecheck
target by detectingvitest.config.mts
, which overrides the one from@nx/js/typescript
.You can clearly see this misalignment in the output from
nx graph
:Current (Incorrect):
Expected (Correct):
This is a serious issue since running
tsc -p tsconfig.json --noEmit
ends up type-checking nothing, because ourtsconfig.json
uses emptyfiles
andinclude
arrays, relying instead on project references. You can confirm this by introducing a type error and rerunningtypecheck
.2.
@nx/eslint:lint
– Config Path Was Correctoptions.eslintConfig
(set to{workspaceRoot}/eslint.config.mjs
) is incorrect. However, this was in fact correct. We only have a singleeslint.config.mjs
file, and it's at the root of the workspace.3. Type Tests and Why
utils:test
Depends onbuild
andtypecheck
utils:test
depends on^build
. This dependency, along withtypecheck
, was actually intentional and necessary for running type-tests usingvitest
. These tests require the workspace's dependencies to be built beforehand, hence the original configuration:Currently, only a few packages (e.g.,
ast-spec
,utils
) include type tests. In those workspaces:typecheck.enabled
was previously set totrue
invitest.config.mts
.typecheck.tsconfig
was previously set to the localtsconfig.spec.json
.While
vitest
's type-checker is essentially a wrapper aroundtsc
, there are some differences, which is why the scope of files to check was narrowed in the rootvitest.config.base.mts
file.4. Missing
--config=vitest.config.mts
Flag--config=vitest.config.mts
flag was not carried over into the updatednx.json
. While not strictly required, re-adding it would avoidvitest
's config file lookup and offer a slight performance improvement.Additional Info
I will submit a PR for this shortly.
The text was updated successfully, but these errors were encountered: