@nx/eslint 20.0.0-canary.20240926-529ab94 → 20.0.0-canary.20241001-8fa7065

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "20.0.0-canary.20240926-529ab94",
3
+ "version": "20.0.0-canary.20241001-8fa7065",
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": {
@@ -35,12 +35,11 @@
35
35
  "eslint": "^8.0.0 || ^9.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "20.0.0-canary.20240926-529ab94",
39
- "@nx/js": "20.0.0-canary.20240926-529ab94",
38
+ "@nx/devkit": "20.0.0-canary.20241001-8fa7065",
39
+ "@nx/js": "20.0.0-canary.20241001-8fa7065",
40
40
  "semver": "^7.5.3",
41
41
  "tslib": "^2.3.0",
42
- "typescript": "~5.4.2",
43
- "@nx/linter": "20.0.0-canary.20240926-529ab94"
42
+ "typescript": "~5.4.2"
44
43
  },
45
44
  "peerDependenciesMeta": {
46
45
  "@zkochan/js-yaml": {
@@ -49,6 +49,7 @@ async function lintProjectGeneratorInternal(tree, options) {
49
49
  if (lintFilePatterns &&
50
50
  lintFilePatterns.length &&
51
51
  lintFilePatterns.some((p) => !['./src', '{projectRoot}', projectConfig.root].includes(p))) {
52
+ projectConfig.targets ??= {};
52
53
  projectConfig.targets['lint'] = {
53
54
  command: `eslint ${lintFilePatterns
54
55
  .join(' ')
@@ -57,6 +58,7 @@ async function lintProjectGeneratorInternal(tree, options) {
57
58
  }
58
59
  }
59
60
  else {
61
+ projectConfig.targets ??= {};
60
62
  projectConfig.targets['lint'] = {
61
63
  executor: '@nx/eslint:lint',
62
64
  };
@@ -148,12 +148,16 @@ function replaceOverride(content, root, lookup, update) {
148
148
  changes.push({
149
149
  type: devkit_1.ChangeType.Insert,
150
150
  index: start,
151
- text: JSON.stringify(updatedData, null, 2)
152
- // restore any parser require calls that were stripped during JSON parsing
153
- .replace(/"parser": "([^"]+)"/g, (_, parser) => {
154
- return `"parser": require('${parser}')`;
155
- })
156
- .slice(2, -2), // remove curly braces and start/end line breaks since we are injecting just properties
151
+ // NOTE: Indentation added to format without formatting tools like Prettier.
152
+ text: ' ' +
153
+ JSON.stringify(updatedData, null, 2)
154
+ // restore any parser require calls that were stripped during JSON parsing
155
+ .replace(/"parser": "([^"]+)"/g, (_, parser) => {
156
+ return `"parser": require('${parser}')`;
157
+ })
158
+ .slice(2, -2) // remove curly braces and start/end line breaks since we are injecting just properties
159
+ // Append indentation so file is formatted without Prettier
160
+ .replaceAll(/\n/g, '\n '),
157
161
  });
158
162
  }
159
163
  }
@@ -282,7 +286,10 @@ function addBlockToFlatConfigExport(content, config, options = {
282
286
  // base config was not generated by Nx.
283
287
  if (!exportsArray)
284
288
  return content;
285
- const insert = printer.printNode(ts.EmitHint.Expression, config, source);
289
+ const insert = ' ' +
290
+ printer
291
+ .printNode(ts.EmitHint.Expression, config, source)
292
+ .replaceAll(/\n/g, '\n ');
286
293
  if (options.insertAtTheEnd) {
287
294
  const index = exportsArray.length > 0
288
295
  ? exportsArray.at(exportsArray.length - 1).end
@@ -301,7 +308,7 @@ function addBlockToFlatConfigExport(content, config, options = {
301
308
  {
302
309
  type: devkit_1.ChangeType.Insert,
303
310
  index,
304
- text: `\n${insert},`,
311
+ text: `\n${insert},\n`,
305
312
  },
306
313
  ]);
307
314
  }