@nx/eslint-plugin 17.1.0-beta.2 → 17.1.0-beta.3
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 +4 -4
- package/src/utils/ast-utils.js +11 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint-plugin",
|
|
3
|
-
"version": "17.1.0-beta.
|
|
3
|
+
"version": "17.1.0-beta.3",
|
|
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": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nx/devkit": "17.1.0-beta.
|
|
37
|
-
"@nx/js": "17.1.0-beta.
|
|
36
|
+
"@nx/devkit": "17.1.0-beta.3",
|
|
37
|
+
"@nx/js": "17.1.0-beta.3",
|
|
38
38
|
"@typescript-eslint/type-utils": "^6.9.1",
|
|
39
39
|
"@typescript-eslint/utils": "^6.9.1",
|
|
40
40
|
"chalk": "^4.1.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"jsonc-eslint-parser": "^2.1.0",
|
|
43
43
|
"semver": "7.5.3",
|
|
44
44
|
"tslib": "^2.3.0",
|
|
45
|
-
"@nrwl/eslint-plugin-nx": "17.1.0-beta.
|
|
45
|
+
"@nrwl/eslint-plugin-nx": "17.1.0-beta.3"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
package/src/utils/ast-utils.js
CHANGED
|
@@ -79,7 +79,17 @@ function hasMemberExport(exportedMember, filePath) {
|
|
|
79
79
|
return ((0, js_1.findNodes)(sourceFile, ts.SyntaxKind.Identifier).filter((identifier) => identifier.text === exportedMember).length > 0);
|
|
80
80
|
}
|
|
81
81
|
function getRelativeImportPath(exportedMember, filePath, basePath) {
|
|
82
|
-
|
|
82
|
+
const status = (0, fs_1.lstatSync)(filePath, {
|
|
83
|
+
throwIfNoEntry: false,
|
|
84
|
+
});
|
|
85
|
+
if (!status /*not existed, but probably not full file with an extension*/) {
|
|
86
|
+
// try to find an extension that exists
|
|
87
|
+
const ext = ['.ts', '.tsx', '.js', '.jsx'].find((ext) => (0, fs_1.lstatSync)(filePath + ext, { throwIfNoEntry: false }));
|
|
88
|
+
if (ext) {
|
|
89
|
+
filePath += ext;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (status.isDirectory()) {
|
|
83
93
|
const file = (0, fs_1.readdirSync)(filePath).find((file) => /^index\.[jt]sx?$/.exec(file));
|
|
84
94
|
if (file) {
|
|
85
95
|
filePath = (0, devkit_1.joinPathFragments)(filePath, file);
|
|
@@ -88,15 +98,6 @@ function getRelativeImportPath(exportedMember, filePath, basePath) {
|
|
|
88
98
|
return;
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
|
-
else if (!(0, fs_1.lstatSync)(filePath, {
|
|
92
|
-
throwIfNoEntry: false,
|
|
93
|
-
}) /*not folder, but probably not full file with an extension either*/) {
|
|
94
|
-
// try to find an extension that exists
|
|
95
|
-
const ext = ['.ts', '.tsx', '.js', '.jsx'].find((ext) => (0, fs_1.lstatSync)(filePath + ext, { throwIfNoEntry: false }));
|
|
96
|
-
if (ext) {
|
|
97
|
-
filePath += ext;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
101
|
const fileContent = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
101
102
|
// use the TypeScript AST to find the path to the file where exportedMember is defined
|
|
102
103
|
const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
|