38 Commits

Author SHA1 Message Date
Miroslav Jonaš
cd55dfcb3e
feat(linter): add support for package based secondary entry points (#30809)
This PR adds support for package.json based secondary entry points and
implements fix for situation when package imports base entry point as
dynamic dependency and secondary entry point as static dependency.

## Current Behavior
When the package is imported from itself, check for a secondary entry
point checks only Angular-style secondary entry points.

When package is importing from the same library as dynamic import from
root and static import from secondary entry point we still get linter
errror.

## Expected Behavior
Check for secondary entry points should also support standard
package.json-based entry points.

Importing from the same library as dynamic import from root and static
import from secondary entry point should be allowed.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18552
2025-04-25 14:31:33 +02:00
Michal Jez
1163eb5c50
cleanup(linter): remove unused basePath parameter (#28549)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

I was looking at the source to understand how `sourceRoot` is used and
saw it was referenced in the eslint-plugin but it turns out it isn't
actually used

## Current Behavior

This parameter isn't used

## Expected Behavior

The parameter should be removed
2024-11-14 08:20:21 +01:00
Miroslav Jonaš
c4c8b0150d
feat(linter): add option to exclude projects from circular deps check (#27504)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2024-09-03 14:33:41 -04:00
Leosvel Pérez Espinosa
b699207070
fix(linter): update the @nx/dependency-checks rule to read the package.json content from the rule context (#27476)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The `@nx/dependency-checks` rule sometimes doesn't apply all identified
fixes and wrongly succeeds. ESLint performs multiple passes to try to
apply fixes, and in each pass the rule receives the updated source code
with the previously applied fixes. This allows merging different fixes,
but the `@nx/dependency-checks` rule always reads the `package.json`
file from the filesystem, caches it globally, and mutates it. It never
uses the updated source code provided in the rule context.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The `@nx/dependency-checks` rule should apply all identified fixes [as
long as they don't
conflict](https://eslint.org/docs/latest/extend/custom-rules#conflicting-fixes).

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27412
2024-08-16 17:14:09 +02:00
Leosvel Pérez Espinosa
ffea1d5c6d
fix(linter): handle paths correctly in enforce-module-boundaries eslint rule (#26373)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21889
2024-06-05 12:38:21 +02:00
James Henry
7001e350af
fix(core): prefer project specific external deps (#23307)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

We only ever discover one version of an external dependency for the
file-map.json. This means the `@nx/dependency-checks` lint rule can
produce incorrect failures when multiple copies of a dependency exist
within a workspace.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

In the file-map.json the project specific version of a package (if
multiple exist) is preferred and therefore the lint rule produces
accurate results.

---

For example, in a repo where the root package.json has lodash@4.0.0
(which becomes `npm:lodash` on graph) and the foo project has
lodash@3.0.0:

**Before**


![image](https://github.com/nrwl/nx/assets/900523/fa0b3711-5004-4abc-9904-0433a37bc3cf)

**After**


![image](https://github.com/nrwl/nx/assets/900523/d0527368-44b4-486f-aa7a-79d996a20ef4)

## Performance

`NX_ISOLATE_PLUGINS=true NX_PERF_LOGGING=true NX_DAEMON=false nx show
project nx --json false`


** Before **

Time for 'build typescript dependencies' 505.52144700009376

** After **

Time for 'build typescript dependencies' 701.247584999539
2024-05-30 10:23:47 -04:00
James Henry
8cfc0a0c08
fix(linter): support eslint v9 (#24632) 2024-05-22 19:27:06 +04:00
Jack Hsu
bc43243498
chore(repo): add eslint and jest plugins to use inferred targets (#22946) 2024-04-23 21:52:13 -04:00
Miroslav Jonaš
ce933132d0
cleanup(linter): refactor code for dynamic/static imports check (#20897) 2024-02-25 20:59:51 +04:00
Miroslav Jonaš
f79aabba46
fix(linter): adjust terminal run check for crystal (#21638) 2024-02-06 15:32:54 +01:00
Miroslav Jonaš
a0ae902e4e
fix(linter): prevent dep-checks leaking when used outside nx (#21404) 2024-02-02 14:22:52 +01:00
Miroslav Jonaš
cbcd2ecddc
fix(linter): fix import of chalk for reporting (#21201) 2024-01-18 15:23:25 +01:00
Miroslav Jonaš
3981c90fe8
fix(linter): ensure angular entry point checks are correct (#20859) 2023-12-20 18:16:58 +01:00
JounQin
b2868657a6
fix(linter): catch lstatSync issues on ast utils (#19749) 2023-11-06 09:38:04 +01:00
Miroslav Jonaš
79c9233553
feat(linter): update typescript-eslint to v6 (#19548)
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2023-11-02 10:09:40 +01:00
Miroslav Jonaš
bf7e663168
feat(linter): add app import exception for remotes (#19301) 2023-09-28 00:25:11 +00:00
Craigory Coppola
f213976281
feat(core): include non-project files on fileMap and filesToProcess (#19217) 2023-09-19 21:46:01 -04:00
Craigory Coppola
de2824a450
feat(devkit): add method for tree-aware glob search (#19128) 2023-09-13 17:39:45 -04:00
Miroslav Jonaš
2bc7031017
fix(linter): fix dep-checks projPackageJsonDeps caching for IDE (#18935) 2023-09-06 10:19:50 +02:00
Jack Hsu
9ffea2bb1b
fix(linter): error on dependencies that are only in devDependencies instead of production dependencies (#18780) 2023-08-22 23:05:53 +02:00
jogelin
1f9b3c4a5c
fix(linter): Normalize paths when in getSourceFilePath (#18601)
Co-authored-by: jgelin <jgelin@seligent.com>
2023-08-17 11:28:52 +02:00
Miroslav Jonaš
5634d556a5
fix(linter): ensure package detection works in PnP (#18394) 2023-08-03 11:32:36 -04:00
Igor Loskutov
9c7ded0b1a
feat(linter): support path wildcards in enforce-module-boundaries autofix (#18316) 2023-07-31 16:18:00 +02:00
Emily Xiong
2e6592c533
fix(devkit): use Workspace in devkit for backwards compatibility (#18246) 2023-07-21 16:54:30 -04:00
Emily Xiong
717a8dd027
chore(core): move readNxJson out of Workspaces (#18127) 2023-07-21 10:07:34 -04:00
Jack Hsu
ae773d547e
fix(linter): skip verifying deps of deps by default in package.json (#18058) 2023-07-12 20:59:36 -04:00
Miroslav Jonaš
28a071f243
fix(js): ignore dependencies from non-index root files for create-package-json (#17930) 2023-07-05 17:47:49 +02:00
Miroslav Jonaš
6b82a2ff59
feat(linter): allow banning of deep/secondary paths (#17755) 2023-07-03 14:41:45 +02:00
Eric Yancey Dauenhauer
576262bb03
feat(linter): allow globs in onlyDependOnLibsWithTags eslint-plugin configuration option (#17530)
Co-authored-by: Miroslav Jonas <missing.manual@gmail.com>
2023-06-30 21:17:12 +02:00
Miroslav Jonaš
ef8c4ed095
feat(linter): add rule for dependency checking (#17581) 2023-06-23 10:26:44 -04:00
Miloš Lajtman
ef5813a7b7
fix(linter): improve error message for forbidden imports of lazy-loaded libs (#17635)
Co-authored-by: Miroslav Jonas <missing.manual@gmail.com>
2023-06-19 17:33:15 +02:00
Miroslav Jonaš
a21ab98ca8
fix(linter): fix relative path detection (#17592) 2023-06-14 12:18:44 -04:00
Victor Savkin
0848031dd9 feat(core): move task hashing into daemon 2023-05-17 11:37:57 -04:00
Miroslav Jonaš
62fb39de02
fix(linter): support directories for relative path fix (#16854) 2023-05-08 16:57:10 +02:00
Miroslav Jonaš
e328bfa90a
feat(linter): support custom build targets for buildability check (#16743) 2023-05-04 13:13:38 +02:00
Leosvel Pérez Espinosa
f45aa076da
feat(angular): support angular v16 (#15592) 2023-05-03 11:02:07 -04:00
Miroslav Jonaš
d47df3d676
fix(linter): ensure target project locator is using stale graph in IDE (#16534) 2023-04-25 23:50:12 +02:00
Jason Jean
739b4c2924
feat(linter): rename @nx/eslint-plugin-nx to @nx/eslint-plugin (#16420) 2023-04-20 13:25:56 -04:00