@nx/eslint 22.7.0-beta.10 → 22.7.0-beta.12

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/executors.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "lint": {
4
4
  "implementation": "./src/executors/lint/lint.impl",
5
5
  "schema": "./src/executors/lint/schema.json",
6
- "hasher": "./src/executors/lint/hasher",
7
6
  "description": "Run ESLint on a project."
8
7
  }
9
8
  }
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { lintProjectGenerator } from './src/generators/lint-project/lint-project';
2
2
  export { lintInitGenerator } from './src/generators/init/init';
3
3
  export { Linter, LinterType } from './src/generators/utils/linter';
4
- export { hasRulesRequiringTypeChecking } from './src/utils/rules-requiring-type-checking';
5
4
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
package/index.js CHANGED
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasRulesRequiringTypeChecking = exports.Linter = exports.lintInitGenerator = exports.lintProjectGenerator = void 0;
3
+ exports.Linter = exports.lintInitGenerator = exports.lintProjectGenerator = void 0;
4
4
  var lint_project_1 = require("./src/generators/lint-project/lint-project");
5
5
  Object.defineProperty(exports, "lintProjectGenerator", { enumerable: true, get: function () { return lint_project_1.lintProjectGenerator; } });
6
6
  var init_1 = require("./src/generators/init/init");
7
7
  Object.defineProperty(exports, "lintInitGenerator", { enumerable: true, get: function () { return init_1.lintInitGenerator; } });
8
8
  var linter_1 = require("./src/generators/utils/linter");
9
9
  Object.defineProperty(exports, "Linter", { enumerable: true, get: function () { return linter_1.Linter; } });
10
- // @nx/angular needs it for the Angular CLI workspace migration to Nx to
11
- // infer whether a config is using type aware rules and set the
12
- // `hasTypeAwareRules` option of the `@nx/eslint:lint` executor.
13
- var rules_requiring_type_checking_1 = require("./src/utils/rules-requiring-type-checking");
14
- Object.defineProperty(exports, "hasRulesRequiringTypeChecking", { enumerable: true, get: function () { return rules_requiring_type_checking_1.hasRulesRequiringTypeChecking; } });
package/migrations.json CHANGED
@@ -9,6 +9,11 @@
9
9
  "version": "20.3.0-beta.1",
10
10
  "description": "Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)",
11
11
  "implementation": "./src/migrations/update-20-3-0/add-file-extensions-to-overrides"
12
+ },
13
+ "update-executor-lint-inputs": {
14
+ "version": "22.7.0-beta.12",
15
+ "description": "Add missing inputs to @nx/eslint:lint executor target defaults",
16
+ "implementation": "./src/migrations/update-21-6-0/update-executor-lint-inputs"
12
17
  }
13
18
  },
14
19
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "22.7.0-beta.10",
3
+ "version": "22.7.0-beta.12",
4
4
  "private": false,
5
5
  "description": "The ESLint plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
6
6
  "repository": {
@@ -36,14 +36,14 @@
36
36
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
37
37
  },
38
38
  "dependencies": {
39
- "@nx/devkit": "22.7.0-beta.10",
40
- "@nx/js": "22.7.0-beta.10",
39
+ "@nx/devkit": "22.7.0-beta.12",
40
+ "@nx/js": "22.7.0-beta.12",
41
41
  "semver": "^7.6.3",
42
42
  "tslib": "^2.3.0",
43
43
  "typescript": "~5.9.2"
44
44
  },
45
45
  "devDependencies": {
46
- "nx": "22.7.0-beta.10"
46
+ "nx": "22.7.0-beta.12"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@zkochan/js-yaml": {
@@ -8,7 +8,7 @@ const path_1 = require("path");
8
8
  const config_file_1 = require("../../utils/config-file");
9
9
  const eslint_utils_1 = require("./utility/eslint-utils");
10
10
  async function run(options, context) {
11
- // this is only used for the hasher
11
+ // hasTypeAwareRules is deprecated and no longer used, delete it so it's not passed to ESLint
12
12
  delete options.hasTypeAwareRules;
13
13
  const systemRoot = context.root;
14
14
  // eslint resolves files relative to the current working directory.
@@ -15,7 +15,9 @@ export interface Schema extends JsonObject {
15
15
  maxWarnings: number;
16
16
  quiet: boolean;
17
17
  ignorePath: string | null;
18
- hasTypeAwareRules: boolean;
18
+
19
+ /** @deprecated No longer has any effect. Will be removed in Nx v23. */
20
+ hasTypeAwareRules?: boolean;
19
21
  cacheStrategy: 'content' | 'metadata' | null;
20
22
  rulesdir: string[];
21
23
  resolvePluginsRelativeTo: string | null;
@@ -106,7 +106,8 @@
106
106
  },
107
107
  "hasTypeAwareRules": {
108
108
  "type": "boolean",
109
- "description": "When set to `true`, the linter will invalidate its cache when any of its dependencies changes."
109
+ "description": "Deprecated. No longer has any effect.",
110
+ "x-deprecated": "No longer has any effect. Will be removed in Nx v23."
110
111
  },
111
112
  "cacheStrategy": {
112
113
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kBAAkB,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACpC;AA6CD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAwF5B;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,8BAG3B"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kBAAkB,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACpC;AA+CD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAwF5B;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,8BAG3B"}
@@ -27,9 +27,11 @@ function addTargetDefaults(tree, format) {
27
27
  nxJson.targetDefaults['@nx/eslint:lint'].cache ??= true;
28
28
  nxJson.targetDefaults['@nx/eslint:lint'].inputs ??= [
29
29
  'default',
30
+ '^default',
30
31
  `{workspaceRoot}/.eslintrc.json`,
31
32
  `{workspaceRoot}/.eslintignore`,
32
33
  `{workspaceRoot}/eslint.config.${format}`,
34
+ '{workspaceRoot}/tools/eslint-rules/**/*',
33
35
  ];
34
36
  (0, devkit_1.updateNxJson)(tree, nxJson);
35
37
  }
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=update-executor-lint-inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-executor-lint-inputs.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/migrations/update-21-6-0/update-executor-lint-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAyC,MAAM,YAAY,CAAC;AAE9E,yBAA+B,IAAI,EAAE,IAAI,iBA0BxC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const devkit_1 = require("@nx/devkit");
5
+ async function default_1(tree) {
6
+ const nxJson = (0, devkit_1.readNxJson)(tree);
7
+ const executor = '@nx/eslint:lint';
8
+ if (!nxJson.targetDefaults?.[executor]?.inputs) {
9
+ return;
10
+ }
11
+ const inputs = nxJson.targetDefaults[executor].inputs;
12
+ if (!inputs.includes('^default')) {
13
+ // Add after 'default' if present, otherwise at the beginning
14
+ const defaultIndex = inputs.indexOf('default');
15
+ if (defaultIndex !== -1) {
16
+ inputs.splice(defaultIndex + 1, 0, '^default');
17
+ }
18
+ else {
19
+ inputs.unshift('^default');
20
+ }
21
+ }
22
+ if (!inputs.includes('{workspaceRoot}/tools/eslint-rules/**/*')) {
23
+ inputs.push('{workspaceRoot}/tools/eslint-rules/**/*');
24
+ }
25
+ (0, devkit_1.updateNxJson)(tree, nxJson);
26
+ await (0, devkit_1.formatFiles)(tree);
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAMd,MAAM,YAAY,CAAC;AAmBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAqHD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CA0E1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAMd,MAAM,YAAY,CAAC;AAwBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAuHD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CAoF1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
@@ -4,7 +4,9 @@ exports.createNodesV2 = exports.createNodes = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
6
  const js_1 = require("@nx/js");
7
+ const internal_1 = require("@nx/js/src/internal");
7
8
  const node_fs_1 = require("node:fs");
9
+ const node_path_1 = require("node:path");
8
10
  const posix_1 = require("node:path/posix");
9
11
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
10
12
  const cache_directory_1 = require("nx/src/utils/cache-directory");
@@ -38,7 +40,7 @@ function readTargetsCache(cachePath) {
38
40
  function writeTargetsToCache(cachePath, results) {
39
41
  (0, devkit_1.writeJsonFile)(cachePath, results);
40
42
  }
41
- const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot, pmc) => {
43
+ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, tsconfigChainsByProjectRoot, projectsCache, hashByRoot, pmc) => {
42
44
  const configDir = (0, posix_1.dirname)(configFilePath);
43
45
  const eslintVersion = ESLint.version;
44
46
  let sharedEslint;
@@ -77,7 +79,7 @@ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, p
77
79
  projectsCache[hash] = {};
78
80
  return;
79
81
  }
80
- const project = getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc);
82
+ const project = getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc, tsconfigChainsByProjectRoot.get(projectRoot) ?? []);
81
83
  if (project) {
82
84
  projects[projectRoot] = project;
83
85
  // Store project into the cache
@@ -102,10 +104,16 @@ exports.createNodes = [
102
104
  const targetsCache = readTargetsCache(cachePath);
103
105
  const { eslintConfigFiles, projectRoots, projectRootsByEslintRoots } = splitConfigFiles(configFiles);
104
106
  const lintableFilesPerProjectRoot = await collectLintableFilesByProjectRoot(projectRoots, options, context);
107
+ const tsconfigChainsByProjectRoot = collectTsconfigChainsByProjectRoot(projectRoots, context.workspaceRoot);
105
108
  const lockFilePattern = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
106
109
  const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, options, context, projectRoots.map((root) => {
107
110
  const parentConfigs = eslintConfigFiles.filter((eslintConfig) => isSubDir(root, (0, posix_1.dirname)(eslintConfig)));
108
- return [...parentConfigs, (0, posix_1.join)(root, '.eslintignore'), lockFilePattern];
111
+ return [
112
+ ...parentConfigs,
113
+ (0, posix_1.join)(root, '.eslintignore'),
114
+ lockFilePattern,
115
+ ...(tsconfigChainsByProjectRoot.get(root) ?? []),
116
+ ];
109
117
  }));
110
118
  const hashByRoot = new Map(projectRoots.map((r, i) => [r, hashes[i]]));
111
119
  try {
@@ -121,7 +129,7 @@ exports.createNodes = [
121
129
  const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
122
130
  useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(rootConfig ?? eslintConfigFiles[0]),
123
131
  });
124
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(ESLint, configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache, hashByRoot, pmc), eslintConfigFiles, options, context);
132
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(ESLint, configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, tsconfigChainsByProjectRoot, targetsCache, hashByRoot, pmc), eslintConfigFiles, options, context);
125
133
  }
126
134
  finally {
127
135
  writeTargetsToCache(cachePath, targetsCache);
@@ -161,6 +169,59 @@ function groupProjectRootsByEslintRoots(eslintConfigFiles, projectRoots) {
161
169
  }
162
170
  return projectRootsByEslintRoots;
163
171
  }
172
+ /**
173
+ * For each project root that has a `tsconfig.json`, resolves its `extends`
174
+ * chain and returns the workspace-relative paths of every reachable file
175
+ * that lives OUTSIDE the project root. Files inside the project root are
176
+ * already covered by `default` (`{projectRoot}/**\/*`); files resolved
177
+ * inside `node_modules` are invalidated via the lockfile; files that
178
+ * escape the workspace cannot be expressed as `{workspaceRoot}/...`.
179
+ *
180
+ * Root projects (`.`) are skipped — everything reachable from a root
181
+ * project's tsconfig is inside the project root by definition.
182
+ */
183
+ function collectTsconfigChainsByProjectRoot(projectRoots, workspaceRoot) {
184
+ const jsonCache = new Map();
185
+ const result = new Map();
186
+ // The root tsconfig (tsconfig.base.json or tsconfig.json) is already
187
+ // handled by the native selective hasher (TsConfiguration hash
188
+ // instruction) which only hashes the path aliases relevant to each
189
+ // project. Adding it as an explicit file input would bypass that
190
+ // optimization and cause every project to be affected on any change.
191
+ const rootTsConfigName = (0, js_1.getRootTsConfigFileName)();
192
+ for (const projectRoot of projectRoots) {
193
+ if (projectRoot === '.')
194
+ continue;
195
+ const tsconfigPath = (0, posix_1.join)(projectRoot, 'tsconfig.json');
196
+ if (!(0, node_fs_1.existsSync)((0, posix_1.join)(workspaceRoot, tsconfigPath)))
197
+ continue;
198
+ const outside = [];
199
+ const projectPrefix = `${projectRoot}/`;
200
+ (0, internal_1.walkTsconfigExtendsChain)((0, posix_1.join)(workspaceRoot, tsconfigPath), (absolutePath) => {
201
+ const wsRelative = (0, node_path_1.relative)(workspaceRoot, absolutePath)
202
+ .split(node_path_1.sep)
203
+ .join('/');
204
+ if (wsRelative.startsWith('../') || wsRelative === '..') {
205
+ return 'continue'; // escapes workspace
206
+ }
207
+ if (wsRelative.startsWith('node_modules/') ||
208
+ wsRelative.includes('/node_modules/')) {
209
+ return 'continue'; // external package, lockfile invalidates
210
+ }
211
+ if (wsRelative === projectRoot ||
212
+ wsRelative.startsWith(projectPrefix)) {
213
+ return 'continue'; // inside project root, covered by `default`
214
+ }
215
+ if (wsRelative === rootTsConfigName) {
216
+ return 'continue'; // handled by native selective hasher
217
+ }
218
+ outside.push(wsRelative);
219
+ return 'continue';
220
+ }, { jsonCache });
221
+ result.set(projectRoot, outside);
222
+ }
223
+ return result;
224
+ }
164
225
  async function collectLintableFilesByProjectRoot(projectRoots, options, context) {
165
226
  const lintableFilesPerProjectRoot = new Map();
166
227
  const lintableFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [
@@ -187,7 +248,7 @@ function getRootForDirectory(directory, roots) {
187
248
  }
188
249
  return roots.has(currentPath) ? currentPath : null;
189
250
  }
190
- function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc) {
251
+ function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc, tsconfigChainOutsideProjectRoot) {
191
252
  const rootEslintConfig = [
192
253
  config_file_1.baseEsLintConfigFile,
193
254
  ...config_file_1.BASE_ESLINT_CONFIG_FILENAMES,
@@ -212,10 +273,10 @@ function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion,
212
273
  eslintConfigs.unshift(rootEslintConfig);
213
274
  }
214
275
  return {
215
- targets: buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, context.workspaceRoot, options, pmc, standaloneSrcPath),
276
+ targets: buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, context.workspaceRoot, options, pmc, standaloneSrcPath, tsconfigChainOutsideProjectRoot),
216
277
  };
217
278
  }
218
- function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspaceRoot, options, pmc, standaloneSrcPath) {
279
+ function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspaceRoot, options, pmc, standaloneSrcPath, tsconfigChainOutsideProjectRoot = []) {
219
280
  const isRootProject = projectRoot === '.';
220
281
  const targets = {};
221
282
  const targetConfig = {
@@ -232,6 +293,9 @@ function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspace
232
293
  ...((0, node_fs_1.existsSync)((0, posix_1.join)(workspaceRoot, projectRoot, '.eslintignore'))
233
294
  ? [(0, posix_1.join)('{workspaceRoot}', projectRoot, '.eslintignore')]
234
295
  : []),
296
+ // Tsconfig files reached via `extends` that live outside the project
297
+ // root — declared so the cache invalidates on upstream changes.
298
+ ...tsconfigChainOutsideProjectRoot.map((file) => `{workspaceRoot}/${file}`),
235
299
  '{workspaceRoot}/tools/eslint-rules/**/*',
236
300
  { externalDependencies: ['eslint'] },
237
301
  ],
@@ -1,9 +0,0 @@
1
- import { Hash, ProjectGraph, ProjectsConfigurations, Task, TaskGraph, TaskHasher } from '@nx/devkit';
2
- export default function run(task: Task, context: {
3
- hasher: TaskHasher;
4
- projectGraph: ProjectGraph;
5
- taskGraph: TaskGraph;
6
- projectsConfigurations: ProjectsConfigurations;
7
- env: NodeJS.ProcessEnv;
8
- }): Promise<Hash>;
9
- //# sourceMappingURL=hasher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/executors/lint/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,sBAAsB,EACtB,IAAI,EACJ,SAAS,EACT,UAAU,EAEX,MAAM,YAAY,CAAC;AAEpB,wBAA8B,GAAG,CAC/B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB,GACA,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = run;
4
- const devkit_1 = require("@nx/devkit");
5
- async function run(task, context) {
6
- const res = await context.hasher.hashTask(task, context.taskGraph, context.env);
7
- if (task.overrides['hasTypeAwareRules'] === true) {
8
- return res;
9
- }
10
- const deps = allDeps(task.id, context.taskGraph, context.projectGraph);
11
- const tags = (0, devkit_1.hashArray)(deps.map((d) => (context.projectsConfigurations.projects[d].tags || []).join('|')));
12
- const command = res.details['command'];
13
- let selfSource = '';
14
- for (let n of Object.keys(res.details)) {
15
- if (n.startsWith(`${task.target.project}:`)) {
16
- selfSource = res.details.nodes[n];
17
- }
18
- }
19
- const nodes = {};
20
- const hashes = [];
21
- for (const d of Object.keys(res.details.nodes).sort()) {
22
- if (d.indexOf('$fileset') === -1) {
23
- nodes[d] = res.details.nodes[d];
24
- hashes.push(res.details.nodes[d]);
25
- }
26
- }
27
- const hashResult = {
28
- value: (0, devkit_1.hashArray)([command, selfSource, ...hashes, tags]),
29
- details: {
30
- command,
31
- nodes: { [task.target.project]: selfSource, tags, ...nodes },
32
- },
33
- };
34
- hashResult['name'] = 'eslint-hasher';
35
- return hashResult;
36
- }
37
- function allDeps(taskId, taskGraph, projectGraph) {
38
- if (!taskGraph.tasks) {
39
- return [];
40
- }
41
- const project = taskGraph.tasks[taskId].target.project;
42
- return projectGraph.dependencies[project]
43
- .filter((d) => !!projectGraph.nodes[d.target])
44
- .map((d) => d.target);
45
- }