@nx/eslint-plugin 19.2.0-rc.0 → 19.2.0-rc.1
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": "19.2.0-rc.
|
|
3
|
+
"version": "19.2.0-rc.1",
|
|
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": "19.2.0-rc.
|
|
38
|
-
"@nx/js": "19.2.0-rc.
|
|
37
|
+
"@nx/devkit": "19.2.0-rc.1",
|
|
38
|
+
"@nx/js": "19.2.0-rc.1",
|
|
39
39
|
"@typescript-eslint/type-utils": "^7.3.0",
|
|
40
40
|
"@typescript-eslint/utils": "^7.3.0",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"jsonc-eslint-parser": "^2.1.0",
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
|
-
"@nrwl/eslint-plugin-nx": "19.2.0-rc.
|
|
46
|
+
"@nrwl/eslint-plugin-nx": "19.2.0-rc.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -186,7 +186,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
186
186
|
const importsToRemap = [];
|
|
187
187
|
for (const entryPointPath of indexTsPaths) {
|
|
188
188
|
for (const importMember of imports) {
|
|
189
|
-
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0,
|
|
189
|
+
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0, path_1.join)(devkit_1.workspaceRoot, entryPointPath.path), sourceProject.data.sourceRoot);
|
|
190
190
|
// we cannot remap, so leave it as is
|
|
191
191
|
if (importPath) {
|
|
192
192
|
importsToRemap.push({
|
|
@@ -262,7 +262,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
262
262
|
const importsToRemap = [];
|
|
263
263
|
for (const entryPointPath of indexTsPaths) {
|
|
264
264
|
for (const importMember of imports) {
|
|
265
|
-
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0,
|
|
265
|
+
const importPath = (0, ast_utils_1.getRelativeImportPath)(importMember, (0, path_1.join)(devkit_1.workspaceRoot, entryPointPath), sourceProject.data.sourceRoot);
|
|
266
266
|
if (importPath) {
|
|
267
267
|
// resolve the import path
|
|
268
268
|
const relativePath = (0, path_1.relative)((0, path_1.dirname)(fileName), (0, path_1.dirname)(importPath));
|
package/src/utils/ast-utils.js
CHANGED
|
@@ -9,7 +9,7 @@ const path_1 = require("path");
|
|
|
9
9
|
const ts = require("typescript");
|
|
10
10
|
function tryReadBaseJson() {
|
|
11
11
|
try {
|
|
12
|
-
return (0, devkit_1.readJsonFile)((0,
|
|
12
|
+
return (0, devkit_1.readJsonFile)((0, path_1.join)(devkit_1.workspaceRoot, 'tsconfig.base.json'));
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
15
|
devkit_1.logger.warn(`Error reading "tsconfig.base.json": \n${JSON.stringify(e)}`);
|
|
@@ -92,7 +92,7 @@ function getRelativeImportPath(exportedMember, filePath, basePath) {
|
|
|
92
92
|
else if (status.isDirectory()) {
|
|
93
93
|
const file = (0, fs_1.readdirSync)(filePath).find((file) => /^index\.[jt]sx?$/.exec(file));
|
|
94
94
|
if (file) {
|
|
95
|
-
filePath = (0,
|
|
95
|
+
filePath = (0, path_1.join)(filePath, file);
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
98
|
return;
|
|
@@ -187,25 +187,25 @@ function getRelativeImportPath(exportedMember, filePath, basePath) {
|
|
|
187
187
|
const modulePath = exportDeclaration.moduleSpecifier.text;
|
|
188
188
|
let moduleFilePath;
|
|
189
189
|
if (modulePath.endsWith('.js') || modulePath.endsWith('.jsx')) {
|
|
190
|
-
moduleFilePath = (0,
|
|
190
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), modulePath);
|
|
191
191
|
if (!(0, fs_1.existsSync)(moduleFilePath)) {
|
|
192
192
|
const tsifiedModulePath = modulePath.replace(/\.js(x?)$/, '.ts$1');
|
|
193
|
-
moduleFilePath = (0,
|
|
193
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), `${tsifiedModulePath}`);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
else if (modulePath.endsWith('.ts') || modulePath.endsWith('.tsx')) {
|
|
197
|
-
moduleFilePath = (0,
|
|
197
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), modulePath);
|
|
198
198
|
}
|
|
199
199
|
else {
|
|
200
|
-
moduleFilePath = (0,
|
|
200
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), `${modulePath}.ts`);
|
|
201
201
|
if (!(0, fs_1.existsSync)(moduleFilePath)) {
|
|
202
202
|
// might be a tsx file
|
|
203
|
-
moduleFilePath = (0,
|
|
203
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), `${modulePath}.tsx`);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
if (!(0, fs_1.existsSync)(moduleFilePath)) {
|
|
207
207
|
// might be an index.ts
|
|
208
|
-
moduleFilePath = (0,
|
|
208
|
+
moduleFilePath = (0, path_1.join)((0, path_1.dirname)(filePath), `${modulePath}/index.ts`);
|
|
209
209
|
}
|
|
210
210
|
if (hasMemberExport(exportedMember, moduleFilePath)) {
|
|
211
211
|
const foundFilePath = getRelativeImportPath(exportedMember, moduleFilePath, basePath);
|
|
@@ -340,7 +340,7 @@ function getAngularEntryPoint(file, projectRoot) {
|
|
|
340
340
|
while (parent !== `${projectRoot}/`) {
|
|
341
341
|
// we need to find closest existing ng-package.json
|
|
342
342
|
// in order to determine if the file matches the secondary entry point
|
|
343
|
-
const ngPackageContent = (0, fileutils_1.readFileIfExisting)(
|
|
343
|
+
const ngPackageContent = (0, fileutils_1.readFileIfExisting)(path.join(devkit_1.workspaceRoot, parent, 'ng-package.json'));
|
|
344
344
|
if (ngPackageContent) {
|
|
345
345
|
// https://github.com/ng-packagr/ng-packagr/blob/23c718d04eea85e015b4c261310b7bd0c39e5311/src/ng-package.schema.json#L54
|
|
346
346
|
const entryFile = (0, devkit_1.parseJson)(ngPackageContent)?.lib?.entryFile;
|
|
@@ -354,8 +354,8 @@ function getAngularEntryPoint(file, projectRoot) {
|
|
|
354
354
|
* Returns true if the given project contains MFE config with "exposes:" section
|
|
355
355
|
*/
|
|
356
356
|
function appIsMFERemote(project) {
|
|
357
|
-
const mfeConfig = (0, fileutils_1.readFileIfExisting)(
|
|
358
|
-
(0, fileutils_1.readFileIfExisting)(
|
|
357
|
+
const mfeConfig = (0, fileutils_1.readFileIfExisting)(path.join(devkit_1.workspaceRoot, project.data.root, 'module-federation.config.js')) ||
|
|
358
|
+
(0, fileutils_1.readFileIfExisting)(path.join(devkit_1.workspaceRoot, project.data.root, 'module-federation.config.ts'));
|
|
359
359
|
if (mfeConfig) {
|
|
360
360
|
return !!mfeConfig.match(/('|")?exposes('|")?:/);
|
|
361
361
|
}
|