@nx/eslint-plugin 17.1.0-beta.2 → 17.1.0-beta.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": "17.1.0-beta.2",
3
+ "version": "17.1.0-beta.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": {
@@ -33,8 +33,8 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "17.1.0-beta.2",
37
- "@nx/js": "17.1.0-beta.2",
36
+ "@nx/devkit": "17.1.0-beta.4",
37
+ "@nx/js": "17.1.0-beta.4",
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.2"
45
+ "@nrwl/eslint-plugin-nx": "17.1.0-beta.4"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
@@ -1,4 +1,3 @@
1
- import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
1
  import { ESLintUtils } from '@typescript-eslint/utils';
3
2
  export type Options = [
4
3
  {
@@ -13,5 +12,5 @@ export type Options = [
13
12
  ];
14
13
  export type MessageIds = 'missingDependency' | 'obsoleteDependency' | 'versionMismatch' | 'missingDependencySection';
15
14
  export declare const RULE_NAME = "dependency-checks";
16
- declare const _default: RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
15
+ declare const _default: ESLintUtils.RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
17
16
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import { DepConstraint } from '../utils/runtime-lint-utils';
2
- import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
3
2
  import { ESLintUtils } from '@typescript-eslint/utils';
4
3
  type Options = [
5
4
  {
@@ -15,5 +14,5 @@ type Options = [
15
14
  ];
16
15
  export type MessageIds = 'noRelativeOrAbsoluteImportsAcrossLibraries' | 'noSelfCircularDependencies' | 'noCircularDependencies' | 'noImportsOfApps' | 'noImportsOfE2e' | 'noImportOfNonBuildableLibraries' | 'noImportsOfLazyLoadedLibraries' | 'projectWithoutTagsCannotHaveDependencies' | 'bannedExternalImportsViolation' | 'nestedBannedExternalImportsViolation' | 'noTransitiveDependencies' | 'onlyTagsConstraintViolation' | 'emptyOnlyTagsConstraintViolation' | 'notTagsConstraintViolation';
17
16
  export declare const RULE_NAME = "enforce-module-boundaries";
18
- declare const _default: RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
17
+ declare const _default: ESLintUtils.RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
19
18
  export default _default;
@@ -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
- if ((0, fs_1.lstatSync)(filePath).isDirectory()) {
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);