@nx/eslint 19.1.0-canary.20240510-1a85787 → 19.1.0-canary.20240511-f7dcf43

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",
3
- "version": "19.1.0-canary.20240510-1a85787",
3
+ "version": "19.1.0-canary.20240511-f7dcf43",
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": {
@@ -33,12 +33,12 @@
33
33
  "js-yaml": "4.1.0"
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "19.1.0-canary.20240510-1a85787",
37
- "@nx/js": "19.1.0-canary.20240510-1a85787",
36
+ "@nx/devkit": "19.1.0-canary.20240511-f7dcf43",
37
+ "@nx/js": "19.1.0-canary.20240511-f7dcf43",
38
38
  "eslint": "^8.0.0",
39
39
  "tslib": "^2.3.0",
40
40
  "typescript": "~5.4.2",
41
- "@nx/linter": "19.1.0-canary.20240510-1a85787"
41
+ "@nx/linter": "19.1.0-canary.20240511-f7dcf43"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "js-yaml": {
@@ -4,6 +4,11 @@ exports.generateAst = exports.mapFilePaths = exports.generateFlatOverride = expo
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const ts = require("typescript");
6
6
  const path_utils_1 = require("./path-utils");
7
+ /**
8
+ * Supports direct identifiers, and those nested within an object (of arbitrary depth)
9
+ * E.g. `...foo` and `...foo.bar.baz.qux` etc
10
+ */
11
+ const SPREAD_ELEMENTS_REGEXP = /\s*\.\.\.[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*,?\n?/g;
7
12
  /**
8
13
  * Remove all overrides from the config file
9
14
  */
@@ -58,11 +63,13 @@ function hasOverride(content, lookup) {
58
63
  let objSource;
59
64
  if (ts.isObjectLiteralExpression(node)) {
60
65
  objSource = node.getFullText();
66
+ // strip any spread elements
67
+ objSource = objSource.replace(SPREAD_ELEMENTS_REGEXP, '');
61
68
  }
62
69
  else {
63
70
  const fullNodeText = node['expression'].arguments[0].body.expression.getFullText();
64
71
  // strip any spread elements
65
- objSource = fullNodeText.replace(/\s*\.\.\.[a-zA-Z0-9_]+,?\n?/, '');
72
+ objSource = fullNodeText.replace(SPREAD_ELEMENTS_REGEXP, '');
66
73
  }
67
74
  const data = (0, devkit_1.parseJson)(objSource
68
75
  // ensure property names have double quotes so that JSON.parse works
@@ -76,7 +83,6 @@ function hasOverride(content, lookup) {
76
83
  return false;
77
84
  }
78
85
  exports.hasOverride = hasOverride;
79
- const STRIP_SPREAD_ELEMENTS = /\s*\.\.\.[a-zA-Z0-9_]+,?\n?/g;
80
86
  function parseTextToJson(text) {
81
87
  return (0, devkit_1.parseJson)(text
82
88
  // ensure property names have double quotes so that JSON.parse works
@@ -105,7 +111,7 @@ function replaceOverride(content, root, lookup, update) {
105
111
  else {
106
112
  const fullNodeText = node['expression'].arguments[0].body.expression.getFullText();
107
113
  // strip any spread elements
108
- objSource = fullNodeText.replace(STRIP_SPREAD_ELEMENTS, '');
114
+ objSource = fullNodeText.replace(SPREAD_ELEMENTS_REGEXP, '');
109
115
  start =
110
116
  node['expression'].arguments[0].body.expression.properties.pos +
111
117
  (fullNodeText.length - objSource.length);
@@ -283,7 +289,7 @@ function removePlugin(content, pluginName, pluginImport) {
283
289
  const pluginsArray = pluginsElem.initializer;
284
290
  const plugins = parseTextToJson(pluginsElem.initializer
285
291
  .getText()
286
- .replace(STRIP_SPREAD_ELEMENTS, ''));
292
+ .replace(SPREAD_ELEMENTS_REGEXP, ''));
287
293
  if (plugins.length > 1) {
288
294
  changes.push({
289
295
  type: devkit_1.ChangeType.Delete,