@nx/eslint-plugin 22.5.2 → 22.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint-plugin",
|
|
3
|
-
"version": "22.5.
|
|
3
|
+
"version": "22.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
|
6
6
|
"repository": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "22.5.
|
|
38
|
-
"@nx/js": "22.5.
|
|
37
|
+
"@nx/devkit": "22.5.4",
|
|
38
|
+
"@nx/js": "22.5.4",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
40
40
|
"@typescript-eslint/type-utils": "^8.0.0",
|
|
41
41
|
"@typescript-eslint/utils": "^8.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"tslib": "^2.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"nx": "22.5.
|
|
50
|
+
"nx": "22.5.4"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-module-boundaries.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint-plugin/src/rules/enforce-module-boundaries.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAGL,aAAa,EAmBd,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,cAAc,EAAE,aAAa,EAAE,CAAC;QAChC,6BAA6B,EAAE,OAAO,CAAC;QACvC,2BAA2B,EAAE,OAAO,CAAC;QACrC,2BAA2B,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACrD,kCAAkC,EAAE,MAAM,EAAE,CAAC;QAC7C,yBAAyB,EAAE,OAAO,CAAC;QACnC,0BAA0B,EAAE,OAAO,CAAC;KACrC;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAClB,4CAA4C,GAC5C,+BAA+B,GAC/B,4BAA4B,GAC5B,wBAAwB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,iCAAiC,GACjC,gCAAgC,GAChC,0CAA0C,GAC1C,gCAAgC,GAChC,sCAAsC,GACtC,0BAA0B,GAC1B,6BAA6B,GAC7B,kCAAkC,GAClC,4BAA4B,CAAC;AACjC,eAAO,MAAM,SAAS,8BAA8B,CAAC;;AAErD,
|
|
1
|
+
{"version":3,"file":"enforce-module-boundaries.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint-plugin/src/rules/enforce-module-boundaries.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAGL,aAAa,EAmBd,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,cAAc,EAAE,aAAa,EAAE,CAAC;QAChC,6BAA6B,EAAE,OAAO,CAAC;QACvC,2BAA2B,EAAE,OAAO,CAAC;QACrC,2BAA2B,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACrD,kCAAkC,EAAE,MAAM,EAAE,CAAC;QAC7C,yBAAyB,EAAE,OAAO,CAAC;QACnC,0BAA0B,EAAE,OAAO,CAAC;KACrC;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAClB,4CAA4C,GAC5C,+BAA+B,GAC/B,4BAA4B,GAC5B,wBAAwB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,iCAAiC,GACjC,gCAAgC,GAChC,0CAA0C,GAC1C,gCAAgC,GAChC,sCAAsC,GACtC,0BAA0B,GAC1B,6BAA6B,GAC7B,kCAAkC,GAClC,4BAA4B,CAAC;AACjC,eAAO,MAAM,SAAS,8BAA8B,CAAC;;AAErD,wBAstBG"}
|
|
@@ -196,13 +196,37 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
196
196
|
// process each potential entry point and try to find the imports
|
|
197
197
|
const importsToRemap = [];
|
|
198
198
|
for (const entryPointPath of indexTsPaths) {
|
|
199
|
+
// Resolve wildcard paths before passing to getRelativeImportPath
|
|
200
|
+
let resolvedPath = entryPointPath.path;
|
|
201
|
+
let targetImportScope = entryPointPath.importScope;
|
|
202
|
+
if (resolvedPath.includes('*')) {
|
|
203
|
+
// For wildcard paths resolve using the actual file path from the relative import
|
|
204
|
+
// Step 1: Resolve the relative import to an absolute path
|
|
205
|
+
// Example: imp='../../models/user', fileName='/root/libs/mylib/src/main.ts'
|
|
206
|
+
// => absoluteImportPath='/root/libs/models/user'
|
|
207
|
+
const absoluteImportPath = (0, path_1.resolve)((0, path_1.dirname)(fileName), imp);
|
|
208
|
+
// Step 2: Get the path relative to project path (which is the workspace root in practice)
|
|
209
|
+
// Example: absoluteImportPath='/root/libs/models/user', projectPath='/root'
|
|
210
|
+
// => workspaceRelativePath='libs/models/user'
|
|
211
|
+
const workspaceRelativePath = (0, devkit_1.normalizePath)((0, path_1.relative)(projectPath, absoluteImportPath));
|
|
212
|
+
// Step 3: Extract the dynamic part after the base path
|
|
213
|
+
// Example: resolvedPath='libs/models/*', workspaceRelativePath='libs/models/user'
|
|
214
|
+
// => basePath='libs/models/', dynamicPart='user'
|
|
215
|
+
// => resolvedPath='libs/models/user', targetImportScope='@myorg/models/user'
|
|
216
|
+
const basePath = resolvedPath.replace('*', '');
|
|
217
|
+
if (workspaceRelativePath.startsWith(basePath)) {
|
|
218
|
+
const dynamicPart = workspaceRelativePath.substring(basePath.length);
|
|
219
|
+
resolvedPath = resolvedPath.replace('*', dynamicPart);
|
|
220
|
+
targetImportScope = targetImportScope.replace('*', dynamicPart);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
199
223
|
for (const importMember of imports) {
|
|
200
|
-
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0, path_1.join)(devkit_1.workspaceRoot,
|
|
224
|
+
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0, path_1.join)(devkit_1.workspaceRoot, resolvedPath));
|
|
201
225
|
// we cannot remap, so leave it as is
|
|
202
226
|
if (importPath) {
|
|
203
227
|
importsToRemap.push({
|
|
204
228
|
member: importMember,
|
|
205
|
-
importPath:
|
|
229
|
+
importPath: targetImportScope,
|
|
206
230
|
});
|
|
207
231
|
}
|
|
208
232
|
}
|