@nx/eslint 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba

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 (35) hide show
  1. package/LICENSE +1 -1
  2. package/generators.json +5 -0
  3. package/migrations.json +17 -12
  4. package/package.json +12 -10
  5. package/plugin.d.ts +1 -1
  6. package/plugin.js +2 -1
  7. package/src/executors/lint/lint.impl.d.ts +1 -1
  8. package/src/executors/lint/lint.impl.js +23 -18
  9. package/src/executors/lint/utility/eslint-utils.js +4 -17
  10. package/src/generators/convert-to-flat-config/generator.d.ts +2 -2
  11. package/src/generators/convert-to-flat-config/generator.js +8 -2
  12. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts +7 -0
  13. package/src/generators/convert-to-inferred/convert-to-inferred.js +80 -0
  14. package/src/generators/convert-to-inferred/lib/target-options-map.d.ts +16 -0
  15. package/src/generators/convert-to-inferred/lib/target-options-map.js +19 -0
  16. package/src/generators/convert-to-inferred/schema.json +19 -0
  17. package/src/generators/init/init-migration.js +4 -0
  18. package/src/generators/init/init.d.ts +1 -1
  19. package/src/generators/init/init.js +16 -27
  20. package/src/generators/lint-project/lint-project.d.ts +2 -1
  21. package/src/generators/lint-project/lint-project.js +16 -20
  22. package/src/generators/utils/eslint-file.js +4 -2
  23. package/src/generators/utils/flat-config/ast-utils.js +31 -7
  24. package/src/plugins/plugin.d.ts +3 -1
  25. package/src/plugins/plugin.js +285 -58
  26. package/src/utils/config-file.d.ts +4 -1
  27. package/src/utils/config-file.js +50 -16
  28. package/src/utils/resolve-eslint-class.d.ts +2 -0
  29. package/src/utils/resolve-eslint-class.js +23 -0
  30. package/src/utils/versions.d.ts +2 -2
  31. package/src/utils/versions.js +2 -2
  32. package/src/migrations/update-15-0-0/add-eslint-inputs.d.ts +0 -2
  33. package/src/migrations/update-15-0-0/add-eslint-inputs.js +0 -27
  34. package/src/migrations/update-15-7-1/add-eslint-ignore.d.ts +0 -2
  35. package/src/migrations/update-15-7-1/add-eslint-ignore.js +0 -36
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const eslint_targets_1 = require("../../generators/utils/eslint-targets");
5
- const config_file_1 = require("../../utils/config-file");
6
- async function addEslintInputs(tree) {
7
- const nxJson = (0, devkit_1.readNxJson)(tree);
8
- const globalEslintFile = config_file_1.ESLINT_CONFIG_FILENAMES.find((file) => tree.exists(file));
9
- if (globalEslintFile && nxJson.namedInputs?.production) {
10
- const productionFileset = new Set(nxJson.namedInputs.production);
11
- productionFileset.add(`!{projectRoot}/${globalEslintFile}`);
12
- nxJson.namedInputs.production = Array.from(productionFileset);
13
- }
14
- for (const targetName of (0, eslint_targets_1.getEslintTargets)(tree)) {
15
- nxJson.targetDefaults ??= {};
16
- const lintTargetDefaults = (nxJson.targetDefaults[targetName] ??= {});
17
- lintTargetDefaults.inputs ??= [
18
- 'default',
19
- ...(globalEslintFile
20
- ? [(0, devkit_1.joinPathFragments)('{workspaceRoot}', globalEslintFile)]
21
- : []),
22
- ];
23
- }
24
- (0, devkit_1.updateNxJson)(tree, nxJson);
25
- await (0, devkit_1.formatFiles)(tree);
26
- }
27
- exports.default = addEslintInputs;
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function addEslintIgnore(tree: Tree): Promise<void>;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const eslint_targets_1 = require("../../generators/utils/eslint-targets");
5
- const config_file_1 = require("../../utils/config-file");
6
- async function addEslintIgnore(tree) {
7
- const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
8
- const globalEslintFile = config_file_1.ESLINT_CONFIG_FILENAMES.find((file) => tree.exists(file));
9
- if (globalEslintFile) {
10
- if (tree.exists('.eslintignore')) {
11
- const content = tree.read('.eslintignore', 'utf-8');
12
- if (!content.includes('node_modules')) {
13
- tree.write('.eslintignore', `node_modules\n${content}`);
14
- }
15
- }
16
- else {
17
- tree.write('.eslintignore', 'node_modules\n');
18
- }
19
- for (const targetName of (0, eslint_targets_1.getEslintTargets)(tree)) {
20
- nxJson.targetDefaults ??= {};
21
- const lintTargetDefaults = (nxJson.targetDefaults[targetName] ??= {});
22
- const lintIgnorePath = (0, devkit_1.joinPathFragments)('{workspaceRoot}', globalEslintFile);
23
- if (lintTargetDefaults.inputs) {
24
- if (!lintTargetDefaults.inputs.includes(lintIgnorePath)) {
25
- lintTargetDefaults.inputs.push(lintIgnorePath);
26
- }
27
- }
28
- else {
29
- lintTargetDefaults.inputs = ['default', lintIgnorePath];
30
- }
31
- }
32
- (0, devkit_1.updateNxJson)(tree, nxJson);
33
- await (0, devkit_1.formatFiles)(tree);
34
- }
35
- }
36
- exports.default = addEslintIgnore;