@nx/eslint 0.0.0-pr-31231-180f614 → 0.0.0-pr-31222-862e973

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.
Files changed (52) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/migrations.json +112 -69
  4. package/package.json +7 -6
  5. package/src/executors/lint/utility/eslint-utils.js +0 -6
  6. package/src/generators/convert-to-flat-config/converters/json-converter.d.ts +1 -1
  7. package/src/generators/convert-to-flat-config/converters/json-converter.js +18 -10
  8. package/src/generators/convert-to-flat-config/generator.js +17 -18
  9. package/src/generators/convert-to-flat-config/schema.d.ts +0 -2
  10. package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -2
  11. package/src/generators/init/global-eslint-config.d.ts +1 -1
  12. package/src/generators/init/global-eslint-config.js +6 -17
  13. package/src/generators/init/init-migration.d.ts +1 -1
  14. package/src/generators/init/init-migration.js +13 -18
  15. package/src/generators/init/init.d.ts +0 -1
  16. package/src/generators/init/init.js +6 -31
  17. package/src/generators/lint-project/lint-project.d.ts +0 -1
  18. package/src/generators/lint-project/lint-project.js +15 -37
  19. package/src/generators/lint-project/setup-root-eslint.d.ts +0 -1
  20. package/src/generators/lint-project/setup-root-eslint.js +1 -2
  21. package/src/generators/utils/eslint-file.d.ts +2 -3
  22. package/src/generators/utils/eslint-file.js +28 -160
  23. package/src/generators/utils/flat-config/ast-utils.d.ts +4 -12
  24. package/src/generators/utils/flat-config/ast-utils.js +63 -412
  25. package/src/generators/utils/linter.d.ts +0 -3
  26. package/src/generators/utils/linter.js +2 -2
  27. package/src/generators/workspace-rules-project/workspace-rules-project.js +1 -3
  28. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  29. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  30. package/src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files.d.ts +2 -0
  31. package/src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files.js +44 -0
  32. package/src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint.d.ts +2 -0
  33. package/src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint.js +47 -0
  34. package/src/migrations/update-17-1-0/update-typescript-eslint.d.ts +2 -0
  35. package/src/migrations/update-17-1-0/update-typescript-eslint.js +74 -0
  36. package/src/migrations/update-17-2-0/simplify-eslint-patterns.d.ts +2 -0
  37. package/src/migrations/update-17-2-0/simplify-eslint-patterns.js +46 -0
  38. package/src/migrations/update-17-2-9/move-options-to-target-defaults.d.ts +2 -0
  39. package/src/migrations/update-17-2-9/move-options-to-target-defaults.js +107 -0
  40. package/src/plugins/plugin.js +10 -21
  41. package/src/utils/config-file.d.ts +1 -3
  42. package/src/utils/config-file.js +2 -5
  43. package/src/utils/flat-config.d.ts +0 -1
  44. package/src/utils/flat-config.js +3 -9
  45. package/src/utils/version-utils.d.ts +0 -1
  46. package/src/utils/version-utils.js +9 -13
  47. package/src/utils/versions.d.ts +2 -3
  48. package/src/utils/versions.js +3 -4
  49. package/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.d.ts +0 -2
  50. package/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.js +0 -23
  51. package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.d.ts +0 -2
  52. package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.js +0 -49
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const ts = require("typescript");
5
- const js_1 = require("@nx/js");
6
- async function default_1(tree) {
7
- let rootConfig;
8
- // NOTE: we don't support generating ESM base config currently so they are not handled.
9
- for (const candidate of ['eslint.config.js', 'eslint.config.cjs']) {
10
- if (tree.exists(candidate)) {
11
- rootConfig = candidate;
12
- break;
13
- }
14
- }
15
- if (!rootConfig)
16
- return;
17
- updateOverrideFileExtensions(tree, rootConfig, 'plugin:@nx/typescript', [`'**/*.ts'`, `'**/*.tsx'`], [`'**/*.cts'`, `'**/*.mts'`]);
18
- updateOverrideFileExtensions(tree, rootConfig, 'plugin:@nx/javascript', [`'**/*.js'`, `'**/*.jsx'`], [`'**/*.cjs'`, `'**/*.mjs'`]);
19
- }
20
- function updateOverrideFileExtensions(tree, configFile, plugin, matchingExts, newExts) {
21
- const content = tree.read(configFile, 'utf-8');
22
- const source = ts.createSourceFile('', content, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
23
- let compatNode;
24
- const spreadElementNodes = (0, js_1.findNodes)(source, ts.SyntaxKind.SpreadElement);
25
- for (const a of spreadElementNodes) {
26
- const assignmentNodes = (0, js_1.findNodes)(a, ts.SyntaxKind.PropertyAssignment);
27
- if (assignmentNodes.length === 0)
28
- continue;
29
- for (const b of assignmentNodes) {
30
- if (b.name.getText() === 'extends' &&
31
- b.initializer.getText().includes(plugin)) {
32
- compatNode = a;
33
- break;
34
- }
35
- }
36
- }
37
- if (compatNode) {
38
- const arrayNodes = (0, js_1.findNodes)(compatNode, ts.SyntaxKind.ArrayLiteralExpression);
39
- for (const a of arrayNodes) {
40
- if (matchingExts.every((ext) => a.elements.some((e) => e.getText() === ext))) {
41
- const exts = new Set(a.elements.map((e) => e.getText()));
42
- for (const ext of newExts) {
43
- exts.add(ext);
44
- }
45
- (0, js_1.replaceChange)(tree, source, configFile, a.getStart(a.getSourceFile()), `[${Array.from(exts).join(', ')}]`, a.getText()).getText();
46
- }
47
- }
48
- }
49
- }