@nx/eslint 23.0.0-beta.2 → 23.0.0-beta.20
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/{index.d.ts → dist/index.d.ts} +0 -1
- package/dist/internal.d.ts +8 -0
- package/dist/internal.js +34 -0
- package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
- package/{src → dist/src}/executors/lint/lint.impl.d.ts +0 -1
- package/{src → dist/src}/executors/lint/lint.impl.js +2 -0
- package/{src → dist/src}/executors/lint/schema.json +1 -0
- package/{src → dist/src}/executors/lint/utility/eslint-utils.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-flat-config/converters/json-converter.d.ts +1 -1
- package/{src → dist/src}/generators/convert-to-flat-config/converters/json-converter.js +76 -16
- package/{src → dist/src}/generators/convert-to-flat-config/generator.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-flat-config/generator.js +119 -24
- package/{src → dist/src}/generators/convert-to-flat-config/schema.json +7 -0
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +4 -5
- package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.d.ts +0 -1
- package/{src → dist/src}/generators/init/global-eslint-config.d.ts +0 -1
- package/{src → dist/src}/generators/init/init-migration.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +29 -16
- package/{src → dist/src}/generators/lint-project/lint-project.d.ts +0 -1
- package/{src → dist/src}/generators/lint-project/lint-project.js +4 -2
- package/{src → dist/src}/generators/lint-project/setup-root-eslint.d.ts +0 -1
- package/{src → dist/src}/generators/utils/eslint-file.d.ts +0 -1
- package/{src → dist/src}/generators/utils/eslint-targets.d.ts +0 -1
- package/dist/src/generators/utils/eslint-targets.js +17 -0
- package/{src → dist/src}/generators/utils/flat-config/ast-utils.d.ts +1 -2
- package/{src → dist/src}/generators/utils/flat-config/ast-utils.js +19 -16
- package/{src → dist/src}/generators/utils/flat-config/path-utils.d.ts +0 -1
- package/{src → dist/src}/generators/utils/linter.d.ts +0 -1
- package/{src → dist/src}/generators/utils/plugin.d.ts +0 -1
- package/{src → dist/src}/generators/workspace-rule/workspace-rule.d.ts +0 -1
- package/{src → dist/src}/generators/workspace-rule/workspace-rule.js +2 -2
- package/{src → dist/src}/generators/workspace-rules-project/workspace-rules-project.d.ts +0 -1
- package/{src → dist/src}/generators/workspace-rules-project/workspace-rules-project.js +16 -6
- package/{src → dist/src}/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.d.ts +0 -1
- package/dist/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.md +33 -0
- package/{src → dist/src}/migrations/update-20-3-0/add-file-extensions-to-overrides.d.ts +0 -1
- package/dist/src/migrations/update-20-3-0/add-file-extensions-to-overrides.md +83 -0
- package/{src → dist/src}/migrations/update-21-6-0/update-executor-lint-inputs.d.ts +0 -1
- package/{src → dist/src}/migrations/update-21-6-0/update-executor-lint-inputs.js +9 -3
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +198 -0
- package/{src → dist/src}/plugins/plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/plugin.js +30 -28
- package/{src → dist/src}/utils/config-file.d.ts +0 -1
- package/dist/src/utils/deprecation.d.ts +3 -0
- package/dist/src/utils/deprecation.js +15 -0
- package/{src → dist/src}/utils/flat-config.d.ts +0 -1
- package/{src → dist/src}/utils/resolve-eslint-class.d.ts +0 -1
- package/dist/src/utils/resolve-eslint-class.js +28 -0
- package/{src → dist/src}/utils/rules-requiring-type-checking.d.ts +0 -1
- package/{src → dist/src}/utils/version-utils.d.ts +0 -1
- package/{src → dist/src}/utils/version-utils.js +5 -5
- package/{src → dist/src}/utils/versions.d.ts +0 -1
- package/{src → dist/src}/utils/versions.js +2 -1
- package/{src → dist/src}/utils/workspace-lint-rules.d.ts +0 -1
- package/executors.json +2 -2
- package/generators.json +10 -10
- package/migrations.json +8 -3
- package/package.json +49 -10
- package/index.d.ts.map +0 -1
- package/plugin.d.ts.map +0 -1
- package/src/executors/lint/lint.impl.d.ts.map +0 -1
- package/src/executors/lint/utility/eslint-utils.d.ts.map +0 -1
- package/src/generators/convert-to-flat-config/converters/json-converter.d.ts.map +0 -1
- package/src/generators/convert-to-flat-config/generator.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/target-options-map.d.ts.map +0 -1
- package/src/generators/init/global-eslint-config.d.ts.map +0 -1
- package/src/generators/init/init-migration.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/generators/lint-project/lint-project.d.ts.map +0 -1
- package/src/generators/lint-project/setup-root-eslint.d.ts.map +0 -1
- package/src/generators/utils/eslint-file.d.ts.map +0 -1
- package/src/generators/utils/eslint-targets.d.ts.map +0 -1
- package/src/generators/utils/eslint-targets.js +0 -17
- package/src/generators/utils/flat-config/ast-utils.d.ts.map +0 -1
- package/src/generators/utils/flat-config/path-utils.d.ts.map +0 -1
- package/src/generators/utils/linter.d.ts.map +0 -1
- package/src/generators/utils/plugin.d.ts.map +0 -1
- package/src/generators/workspace-rule/workspace-rule.d.ts.map +0 -1
- package/src/generators/workspace-rules-project/workspace-rules-project.d.ts.map +0 -1
- package/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.d.ts.map +0 -1
- package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.d.ts.map +0 -1
- package/src/migrations/update-21-6-0/update-executor-lint-inputs.d.ts.map +0 -1
- package/src/plugins/plugin.d.ts.map +0 -1
- package/src/utils/config-file.d.ts.map +0 -1
- package/src/utils/flat-config.d.ts.map +0 -1
- package/src/utils/resolve-eslint-class.d.ts.map +0 -1
- package/src/utils/resolve-eslint-class.js +0 -61
- package/src/utils/rules-requiring-type-checking.d.ts.map +0 -1
- package/src/utils/version-utils.d.ts.map +0 -1
- package/src/utils/versions.d.ts.map +0 -1
- package/src/utils/workspace-lint-rules.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{plugin.js → dist/plugin.js} +0 -0
- /package/{src → dist/src}/executors/lint/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/lint/utility/eslint-utils.js +0 -0
- /package/{src → dist/src}/generators/convert-to-flat-config/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
- /package/{src → dist/src}/generators/init/global-eslint-config.js +0 -0
- /package/{src → dist/src}/generators/init/init-migration.js +0 -0
- /package/{src → dist/src}/generators/init/schema.json +0 -0
- /package/{src → dist/src}/generators/lint-project/setup-root-eslint.js +0 -0
- /package/{src → dist/src}/generators/utils/eslint-file.js +0 -0
- /package/{src → dist/src}/generators/utils/flat-config/path-utils.js +0 -0
- /package/{src → dist/src}/generators/utils/linter.js +0 -0
- /package/{src → dist/src}/generators/utils/plugin.js +0 -0
- /package/{src → dist/src}/generators/workspace-rule/files/__name__.spec.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/workspace-rule/files/__name__.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/workspace-rule/schema.json +0 -0
- /package/{src → dist/src}/generators/workspace-rules-project/files/index.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/workspace-rules-project/files/tsconfig.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/workspace-rules-project/files/tsconfig.lint.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/workspace-rules-project/schema.json +0 -0
- /package/{src → dist/src}/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.js +0 -0
- /package/{src → dist/src}/migrations/update-20-3-0/add-file-extensions-to-overrides.js +0 -0
- /package/{src → dist/src}/utils/config-file.js +0 -0
- /package/{src → dist/src}/utils/flat-config.js +0 -0
- /package/{src → dist/src}/utils/rules-requiring-type-checking.js +0 -0
- /package/{src → dist/src}/utils/workspace-lint-rules.js +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { addExtendsToLintConfig, addIgnoresToLintConfig, addOverrideToLintConfig, addPluginsToLintConfig, addPredefinedConfigToFlatLintConfig, findEslintFile, isEslintConfigSupported, lintConfigHasOverride, replaceOverridesInLintConfig, updateOverrideInLintConfig, updateRelativePathsInConfig, } from './src/generators/utils/eslint-file';
|
|
2
|
+
export { addImportToFlatConfig } from './src/generators/utils/flat-config/ast-utils';
|
|
3
|
+
export { useFlatConfig } from './src/utils/flat-config';
|
|
4
|
+
export { javaScriptOverride, typeScriptOverride, } from './src/generators/init/global-eslint-config';
|
|
5
|
+
export { setupRootEsLint } from './src/generators/lint-project/setup-root-eslint';
|
|
6
|
+
export { getInstalledEslintVersion, getTypeScriptEslintVersionToInstall, } from './src/utils/version-utils';
|
|
7
|
+
export { eslint9__typescriptESLintVersion } from './src/utils/versions';
|
|
8
|
+
export type { Schema } from './src/executors/lint/schema';
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Semi-private surface for first-party Nx packages.
|
|
3
|
+
//
|
|
4
|
+
// External plugins should NOT import from here — this entry is curated for
|
|
5
|
+
// internal consumers and may change without semver protection. Mirrors
|
|
6
|
+
// `@nx/devkit/internal`.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.eslint9__typescriptESLintVersion = exports.getTypeScriptEslintVersionToInstall = exports.getInstalledEslintVersion = exports.setupRootEsLint = exports.typeScriptOverride = exports.javaScriptOverride = exports.useFlatConfig = exports.addImportToFlatConfig = exports.updateRelativePathsInConfig = exports.updateOverrideInLintConfig = exports.replaceOverridesInLintConfig = exports.lintConfigHasOverride = exports.isEslintConfigSupported = exports.findEslintFile = exports.addPredefinedConfigToFlatLintConfig = exports.addPluginsToLintConfig = exports.addOverrideToLintConfig = exports.addIgnoresToLintConfig = exports.addExtendsToLintConfig = void 0;
|
|
9
|
+
var eslint_file_1 = require("./src/generators/utils/eslint-file");
|
|
10
|
+
Object.defineProperty(exports, "addExtendsToLintConfig", { enumerable: true, get: function () { return eslint_file_1.addExtendsToLintConfig; } });
|
|
11
|
+
Object.defineProperty(exports, "addIgnoresToLintConfig", { enumerable: true, get: function () { return eslint_file_1.addIgnoresToLintConfig; } });
|
|
12
|
+
Object.defineProperty(exports, "addOverrideToLintConfig", { enumerable: true, get: function () { return eslint_file_1.addOverrideToLintConfig; } });
|
|
13
|
+
Object.defineProperty(exports, "addPluginsToLintConfig", { enumerable: true, get: function () { return eslint_file_1.addPluginsToLintConfig; } });
|
|
14
|
+
Object.defineProperty(exports, "addPredefinedConfigToFlatLintConfig", { enumerable: true, get: function () { return eslint_file_1.addPredefinedConfigToFlatLintConfig; } });
|
|
15
|
+
Object.defineProperty(exports, "findEslintFile", { enumerable: true, get: function () { return eslint_file_1.findEslintFile; } });
|
|
16
|
+
Object.defineProperty(exports, "isEslintConfigSupported", { enumerable: true, get: function () { return eslint_file_1.isEslintConfigSupported; } });
|
|
17
|
+
Object.defineProperty(exports, "lintConfigHasOverride", { enumerable: true, get: function () { return eslint_file_1.lintConfigHasOverride; } });
|
|
18
|
+
Object.defineProperty(exports, "replaceOverridesInLintConfig", { enumerable: true, get: function () { return eslint_file_1.replaceOverridesInLintConfig; } });
|
|
19
|
+
Object.defineProperty(exports, "updateOverrideInLintConfig", { enumerable: true, get: function () { return eslint_file_1.updateOverrideInLintConfig; } });
|
|
20
|
+
Object.defineProperty(exports, "updateRelativePathsInConfig", { enumerable: true, get: function () { return eslint_file_1.updateRelativePathsInConfig; } });
|
|
21
|
+
var ast_utils_1 = require("./src/generators/utils/flat-config/ast-utils");
|
|
22
|
+
Object.defineProperty(exports, "addImportToFlatConfig", { enumerable: true, get: function () { return ast_utils_1.addImportToFlatConfig; } });
|
|
23
|
+
var flat_config_1 = require("./src/utils/flat-config");
|
|
24
|
+
Object.defineProperty(exports, "useFlatConfig", { enumerable: true, get: function () { return flat_config_1.useFlatConfig; } });
|
|
25
|
+
var global_eslint_config_1 = require("./src/generators/init/global-eslint-config");
|
|
26
|
+
Object.defineProperty(exports, "javaScriptOverride", { enumerable: true, get: function () { return global_eslint_config_1.javaScriptOverride; } });
|
|
27
|
+
Object.defineProperty(exports, "typeScriptOverride", { enumerable: true, get: function () { return global_eslint_config_1.typeScriptOverride; } });
|
|
28
|
+
var setup_root_eslint_1 = require("./src/generators/lint-project/setup-root-eslint");
|
|
29
|
+
Object.defineProperty(exports, "setupRootEsLint", { enumerable: true, get: function () { return setup_root_eslint_1.setupRootEsLint; } });
|
|
30
|
+
var version_utils_1 = require("./src/utils/version-utils");
|
|
31
|
+
Object.defineProperty(exports, "getInstalledEslintVersion", { enumerable: true, get: function () { return version_utils_1.getInstalledEslintVersion; } });
|
|
32
|
+
Object.defineProperty(exports, "getTypeScriptEslintVersionToInstall", { enumerable: true, get: function () { return version_utils_1.getTypeScriptEslintVersionToInstall; } });
|
|
33
|
+
var versions_1 = require("./src/utils/versions");
|
|
34
|
+
Object.defineProperty(exports, "eslint9__typescriptESLintVersion", { enumerable: true, get: function () { return versions_1.eslint9__typescriptESLintVersion; } });
|
|
@@ -7,7 +7,9 @@ const utils_1 = require("nx/src/tasks-runner/utils");
|
|
|
7
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
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
10
11
|
async function run(options, context) {
|
|
12
|
+
(0, deprecation_1.warnEslintExecutorDeprecation)();
|
|
11
13
|
// hasTypeAwareRules is deprecated and no longer used, delete it so it's not passed to ESLint
|
|
12
14
|
delete options.hasTypeAwareRules;
|
|
13
15
|
const systemRoot = context.root;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"description": "ESLint Lint Target.",
|
|
7
7
|
"cli": "nx",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "The `@nx/eslint:lint` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/eslint:convert-to-inferred` to migrate to the `@nx/eslint/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"properties": {
|
|
10
11
|
"eslintConfig": {
|
|
11
12
|
"type": "string",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { ESLint } from 'eslint';
|
|
3
|
+
export declare function renameLegacyEslintrcFile(path: string, format: 'mjs' | 'cjs'): string;
|
|
3
4
|
/**
|
|
4
5
|
* Converts an ESLint JSON config to a flat config.
|
|
5
6
|
* Deletes the original file along with .eslintignore if it exists.
|
|
@@ -9,4 +10,3 @@ export declare function convertEslintJsonToFlatConfig(tree: Tree, root: string,
|
|
|
9
10
|
addESLintRC: boolean;
|
|
10
11
|
addESLintJS: boolean;
|
|
11
12
|
};
|
|
12
|
-
//# sourceMappingURL=json-converter.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renameLegacyEslintrcFile = renameLegacyEslintrcFile;
|
|
3
4
|
exports.convertEslintJsonToFlatConfig = convertEslintJsonToFlatConfig;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -7,6 +8,57 @@ const ts = tslib_1.__importStar(require("typescript"));
|
|
|
7
8
|
const ast_utils_1 = require("../../utils/flat-config/ast-utils");
|
|
8
9
|
const eslint_file_1 = require("../../utils/eslint-file");
|
|
9
10
|
const path_utils_1 = require("../../utils/flat-config/path-utils");
|
|
11
|
+
// Rewrites legacy `.eslintrc[.base][.json]` / `.eslintignore` filenames to their flat-config
|
|
12
|
+
// counterparts. Used for `extends` local paths, rule option values that embed these filenames,
|
|
13
|
+
// and nx.json / project.json input globs that referenced the deleted files. Accepts
|
|
14
|
+
// extensionless `.eslintrc` since ESLint treats that as JSON by convention.
|
|
15
|
+
function renameLegacyEslintrcFile(path, format) {
|
|
16
|
+
return path
|
|
17
|
+
.replace(/(^|.*?)\.eslintrc(\.base)?(\.json)?$/, `$1eslint$2.config.${format}`)
|
|
18
|
+
.replace(/(^|.*?)\.eslintignore$/, `$1eslint.config.${format}`);
|
|
19
|
+
}
|
|
20
|
+
// In flat config, `@nx/workspace/<rule>` is parsed as plugin `@nx/workspace`, rule `<rule>`.
|
|
21
|
+
// The `@nx` plugin already exposes workspace rules under both `workspace/<rule>` and `workspace-<rule>` keys.
|
|
22
|
+
// Rewriting to `@nx/workspace-<rule>` makes ESLint resolve them via the already-registered `@nx` plugin.
|
|
23
|
+
function renameLegacyWorkspaceRules(rules) {
|
|
24
|
+
const renamed = {};
|
|
25
|
+
for (const [key, value] of Object.entries(rules)) {
|
|
26
|
+
const newKey = key.startsWith('@nx/workspace/')
|
|
27
|
+
? '@nx/workspace-' + key.slice('@nx/workspace/'.length)
|
|
28
|
+
: key;
|
|
29
|
+
renamed[newKey] = value;
|
|
30
|
+
}
|
|
31
|
+
return renamed;
|
|
32
|
+
}
|
|
33
|
+
// Rewrites references to the legacy `.eslintrc[.base].json` / `.eslintignore` that may appear
|
|
34
|
+
// inside rule option values (e.g. `@nx/dependency-checks`'s `ignoredFiles`) to point at the
|
|
35
|
+
// generated flat-config files instead. Without this, rule options keep pointing at files that
|
|
36
|
+
// no longer exist after the conversion.
|
|
37
|
+
function rewriteStaleEslintrcRefs(value, format) {
|
|
38
|
+
if (typeof value === 'string') {
|
|
39
|
+
return renameLegacyEslintrcFile(value, format);
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
const mapped = value.map((v) => rewriteStaleEslintrcRefs(v, format));
|
|
43
|
+
// Rewriting may collapse distinct strings (e.g. `.eslintrc.json` and
|
|
44
|
+
// `.eslintrc.base.json`) into identical entries; dedupe string arrays.
|
|
45
|
+
if (mapped.every((v) => typeof v === 'string')) {
|
|
46
|
+
return Array.from(new Set(mapped));
|
|
47
|
+
}
|
|
48
|
+
return mapped;
|
|
49
|
+
}
|
|
50
|
+
if (value && typeof value === 'object') {
|
|
51
|
+
const out = {};
|
|
52
|
+
for (const [k, v] of Object.entries(value)) {
|
|
53
|
+
out[k] = rewriteStaleEslintrcRefs(v, format);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
function preprocessRules(rules, format) {
|
|
60
|
+
return rewriteStaleEslintrcRefs(renameLegacyWorkspaceRules(rules), format);
|
|
61
|
+
}
|
|
10
62
|
/**
|
|
11
63
|
* Converts an ESLint JSON config to a flat config.
|
|
12
64
|
* Deletes the original file along with .eslintignore if it exists.
|
|
@@ -18,10 +70,17 @@ function convertEslintJsonToFlatConfig(tree, root, config, ignorePaths, format)
|
|
|
18
70
|
let isESLintJSNeeded = false;
|
|
19
71
|
let combinedConfig = [];
|
|
20
72
|
let languageOptions = [];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
73
|
+
if (config.rules) {
|
|
74
|
+
config.rules = preprocessRules(config.rules, format);
|
|
75
|
+
}
|
|
76
|
+
if (config.overrides) {
|
|
77
|
+
config.overrides = config.overrides.map((override) => override.rules
|
|
78
|
+
? {
|
|
79
|
+
...override,
|
|
80
|
+
rules: preprocessRules(override.rules, format),
|
|
81
|
+
}
|
|
82
|
+
: override);
|
|
83
|
+
}
|
|
25
84
|
if (config.extends) {
|
|
26
85
|
const extendsResult = addExtends(importsMap, exportElements, config, format);
|
|
27
86
|
isFlatCompatNeeded = extendsResult.isFlatCompatNeeded;
|
|
@@ -101,28 +160,30 @@ function convertEslintJsonToFlatConfig(tree, root, config, ignorePaths, format)
|
|
|
101
160
|
if (Object.keys(remainingRest).length > 0 || hasNonEmptyRules) {
|
|
102
161
|
if (remainingOverride.env ||
|
|
103
162
|
remainingOverride.extends ||
|
|
104
|
-
remainingOverride.plugins
|
|
105
|
-
remainingOverride.parser) {
|
|
163
|
+
remainingOverride.plugins) {
|
|
106
164
|
isFlatCompatNeeded = true;
|
|
107
165
|
}
|
|
108
|
-
exportElements.push((0, ast_utils_1.generateFlatOverride)(remainingOverride, format));
|
|
166
|
+
exportElements.push((0, ast_utils_1.generateFlatOverride)(remainingOverride, format, importsMap));
|
|
109
167
|
}
|
|
110
168
|
return;
|
|
111
169
|
}
|
|
112
170
|
}
|
|
113
|
-
if (override.env ||
|
|
114
|
-
override.extends ||
|
|
115
|
-
override.plugins ||
|
|
116
|
-
override.parser) {
|
|
171
|
+
if (override.env || override.extends || override.plugins) {
|
|
117
172
|
isFlatCompatNeeded = true;
|
|
118
173
|
}
|
|
119
|
-
exportElements.push((0, ast_utils_1.generateFlatOverride)(override, format));
|
|
174
|
+
exportElements.push((0, ast_utils_1.generateFlatOverride)(override, format, importsMap));
|
|
120
175
|
});
|
|
121
176
|
}
|
|
122
177
|
if (config.ignorePatterns) {
|
|
123
178
|
const patterns = (Array.isArray(config.ignorePatterns)
|
|
124
179
|
? config.ignorePatterns
|
|
125
|
-
: [config.ignorePatterns]).filter((pattern) =>
|
|
180
|
+
: [config.ignorePatterns]).filter((pattern) =>
|
|
181
|
+
// Drop patterns that are meaningless in flat config. `'**/*'` and
|
|
182
|
+
// `'!**/*'` were eslintrc cascading toggles; `node_modules` is already
|
|
183
|
+
// ignored by default. Real negations like `['dist/**', '!dist/keep.js']`
|
|
184
|
+
// are preserved — flat config still supports un-ignoring within a
|
|
185
|
+
// broader ignores block.
|
|
186
|
+
!['**/*', '!**/*', 'node_modules'].includes(pattern));
|
|
126
187
|
if (patterns.length > 0) {
|
|
127
188
|
exportElements.push((0, ast_utils_1.generateAst)({
|
|
128
189
|
ignores: patterns.map((path) => (0, path_utils_1.mapFilePath)(path)),
|
|
@@ -165,11 +226,10 @@ function addExtends(importsMap, configBlocks, config, format) {
|
|
|
165
226
|
extendsConfig
|
|
166
227
|
.filter((imp) => imp.match(/^\.?(\.\/)/))
|
|
167
228
|
.forEach((imp, index) => {
|
|
168
|
-
if (imp.match(/\.eslintrc(
|
|
229
|
+
if (imp.match(/\.eslintrc(\.base)?(\.json)?$/)) {
|
|
169
230
|
const localName = index ? `baseConfig${index}` : 'baseConfig';
|
|
170
231
|
configBlocks.push((0, ast_utils_1.generateSpreadElement)(localName));
|
|
171
|
-
|
|
172
|
-
importsMap.set(newImport, localName);
|
|
232
|
+
importsMap.set(renameLegacyEslintrcFile(imp, format), localName);
|
|
173
233
|
}
|
|
174
234
|
else {
|
|
175
235
|
eslintrcConfigs.push(imp);
|
|
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
|
2
2
|
import { ConvertToFlatConfigGeneratorSchema } from './schema';
|
|
3
3
|
export declare function convertToFlatConfigGenerator(tree: Tree, options: ConvertToFlatConfigGeneratorSchema): Promise<void | GeneratorCallback>;
|
|
4
4
|
export default convertToFlatConfigGenerator;
|
|
5
|
-
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -28,8 +28,9 @@ async function convertToFlatConfigGenerator(tree, options) {
|
|
|
28
28
|
for (const ignoreFile of eslintIgnoreFiles) {
|
|
29
29
|
tree.delete(ignoreFile);
|
|
30
30
|
}
|
|
31
|
-
// replace references in nx.json
|
|
31
|
+
// replace references in nx.json and project.json files
|
|
32
32
|
updateNxJsonConfig(tree, options.eslintConfigFormat);
|
|
33
|
+
updateProjectConfigsInputs(tree, options.eslintConfigFormat);
|
|
33
34
|
// install missing packages
|
|
34
35
|
if (!options.skipFormat) {
|
|
35
36
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -48,6 +49,18 @@ function isEslintTarget(target) {
|
|
|
48
49
|
return (target.executor === ESLINT_LINT_EXECUTOR ||
|
|
49
50
|
target.command?.includes('eslint'));
|
|
50
51
|
}
|
|
52
|
+
function hasMatchingEslintTargetDefault(projectConfig, targetDefaults) {
|
|
53
|
+
if (!projectConfig.targets || !targetDefaults) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(targetDefaults)) {
|
|
57
|
+
return targetDefaults.some((entry) => entry.target !== undefined &&
|
|
58
|
+
projectConfig.targets[entry.target] !== undefined &&
|
|
59
|
+
(entry.target === ESLINT_LINT_EXECUTOR || isEslintTarget(entry)));
|
|
60
|
+
}
|
|
61
|
+
return Object.entries(targetDefaults).some(([targetName, targetConfig]) => projectConfig.targets[targetName] !== undefined &&
|
|
62
|
+
(targetName === ESLINT_LINT_EXECUTOR || isEslintTarget(targetConfig)));
|
|
63
|
+
}
|
|
51
64
|
function convertProjectToFlatConfig(tree, project, projectConfig, nxJson, eslintIgnoreFiles, format) {
|
|
52
65
|
const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectConfig.root);
|
|
53
66
|
if (!eslintFile || eslintFile.endsWith('.js')) {
|
|
@@ -70,10 +83,7 @@ function convertProjectToFlatConfig(tree, project, projectConfig, nxJson, eslint
|
|
|
70
83
|
if (eslintTargets.length > 0) {
|
|
71
84
|
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
72
85
|
}
|
|
73
|
-
const hasEslintTargetDefaults = projectConfig.
|
|
74
|
-
Object.keys(nxJson.targetDefaults || {}).some((t) => (t === ESLINT_LINT_EXECUTOR ||
|
|
75
|
-
isEslintTarget(nxJson.targetDefaults[t])) &&
|
|
76
|
-
projectConfig.targets[t]);
|
|
86
|
+
const hasEslintTargetDefaults = hasMatchingEslintTargetDefault(projectConfig, nxJson.targetDefaults);
|
|
77
87
|
if (eslintTargets.length === 0 &&
|
|
78
88
|
!hasEslintTargetDefaults &&
|
|
79
89
|
!(0, plugin_1.hasEslintPlugin)(tree)) {
|
|
@@ -86,35 +96,120 @@ function convertProjectToFlatConfig(tree, project, projectConfig, nxJson, eslint
|
|
|
86
96
|
eslintIgnoreFiles.add(ignorePath);
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
|
-
//
|
|
90
|
-
//
|
|
99
|
+
// Rewrites input entries that reference legacy `.eslintrc[.base].json` / `.eslintignore`
|
|
100
|
+
// files to their flat-config counterparts, then dedupes so the rewrite doesn't produce
|
|
101
|
+
// duplicates of entries that already pointed at the flat config. Leaves non-string /
|
|
102
|
+
// non-fileset inputs (runtime/env/dependentTasksOutputFiles/etc.) untouched.
|
|
103
|
+
function rewriteLegacyInputs(inputs, format) {
|
|
104
|
+
const seenStrings = new Set();
|
|
105
|
+
const result = [];
|
|
106
|
+
for (const entry of inputs) {
|
|
107
|
+
if (typeof entry === 'string') {
|
|
108
|
+
const rewritten = (0, json_converter_1.renameLegacyEslintrcFile)(entry, format);
|
|
109
|
+
if (seenStrings.has(rewritten))
|
|
110
|
+
continue;
|
|
111
|
+
seenStrings.add(rewritten);
|
|
112
|
+
result.push(rewritten);
|
|
113
|
+
}
|
|
114
|
+
else if ('fileset' in entry) {
|
|
115
|
+
const rewritten = (0, json_converter_1.renameLegacyEslintrcFile)(entry.fileset, format);
|
|
116
|
+
// Preserve the original reference when nothing changed so downstream identity
|
|
117
|
+
// checks (e.g. `inputsEqual`) don't see a spurious mutation.
|
|
118
|
+
result.push(rewritten === entry.fileset ? entry : { ...entry, fileset: rewritten });
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
result.push(entry);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
// Adds `value` to `inputs` (after rewriting) when the rewritten set doesn't already contain it.
|
|
127
|
+
function ensureInputPresent(inputs, value, format) {
|
|
128
|
+
const rewritten = rewriteLegacyInputs(inputs, format);
|
|
129
|
+
if (!rewritten.some((entry) => entry === value)) {
|
|
130
|
+
rewritten.push(value);
|
|
131
|
+
}
|
|
132
|
+
return rewritten;
|
|
133
|
+
}
|
|
134
|
+
// Updates nx.json: rewrites stale eslintrc/eslintignore references across all targetDefaults
|
|
135
|
+
// inputs and namedInputs, and ensures lint targets include the new flat config file as an input
|
|
136
|
+
// (and `production` excludes it). Handles both the legacy record shape and the new array shape
|
|
137
|
+
// of `targetDefaults`.
|
|
91
138
|
function updateNxJsonConfig(tree, format) {
|
|
92
|
-
if (tree.exists('nx.json')) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
139
|
+
if (!tree.exists('nx.json')) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
143
|
+
const rewriteTargetInputs = (target, isLintTarget) => {
|
|
144
|
+
if (!target.inputs)
|
|
145
|
+
return;
|
|
146
|
+
target.inputs = isLintTarget
|
|
147
|
+
? ensureInputPresent(target.inputs, `{workspaceRoot}/eslint.config.${format}`, format)
|
|
148
|
+
: rewriteLegacyInputs(target.inputs, format);
|
|
149
|
+
};
|
|
150
|
+
if (json.targetDefaults) {
|
|
151
|
+
if (Array.isArray(json.targetDefaults)) {
|
|
152
|
+
for (const entry of json.targetDefaults) {
|
|
153
|
+
const isLintTarget = entry.target === 'lint' || entry.target === ESLINT_LINT_EXECUTOR;
|
|
154
|
+
rewriteTargetInputs(entry, isLintTarget);
|
|
155
|
+
}
|
|
98
156
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
157
|
+
else {
|
|
158
|
+
for (const [name, target] of Object.entries(json.targetDefaults)) {
|
|
159
|
+
const isLintTarget = name === 'lint' || name === ESLINT_LINT_EXECUTOR;
|
|
160
|
+
rewriteTargetInputs(target, isLintTarget);
|
|
161
|
+
}
|
|
103
162
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
json.namedInputs
|
|
163
|
+
}
|
|
164
|
+
if (json.namedInputs) {
|
|
165
|
+
for (const [name, inputs] of Object.entries(json.namedInputs)) {
|
|
166
|
+
json.namedInputs[name] =
|
|
167
|
+
name === 'production'
|
|
168
|
+
? ensureInputPresent(inputs, `!{projectRoot}/eslint.config.${format}`, format)
|
|
169
|
+
: rewriteLegacyInputs(inputs, format);
|
|
108
170
|
}
|
|
109
|
-
|
|
110
|
-
|
|
171
|
+
}
|
|
172
|
+
return json;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
// Walks every project's `targets.*.inputs` and `namedInputs.*`, rewriting stale references.
|
|
176
|
+
function updateProjectConfigsInputs(tree, format) {
|
|
177
|
+
for (const [project, projectConfig] of (0, devkit_1.getProjects)(tree)) {
|
|
178
|
+
let changed = false;
|
|
179
|
+
if (projectConfig.targets) {
|
|
180
|
+
for (const target of Object.values(projectConfig.targets)) {
|
|
181
|
+
if (!target.inputs)
|
|
182
|
+
continue;
|
|
183
|
+
const rewritten = rewriteLegacyInputs(target.inputs, format);
|
|
184
|
+
if (!inputsEqual(target.inputs, rewritten)) {
|
|
185
|
+
target.inputs = rewritten;
|
|
186
|
+
changed = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (projectConfig.namedInputs) {
|
|
191
|
+
for (const [name, inputs] of Object.entries(projectConfig.namedInputs)) {
|
|
192
|
+
const rewritten = rewriteLegacyInputs(inputs, format);
|
|
193
|
+
if (!inputsEqual(inputs, rewritten)) {
|
|
194
|
+
projectConfig.namedInputs[name] = rewritten;
|
|
195
|
+
changed = true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (changed) {
|
|
200
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
201
|
+
}
|
|
111
202
|
}
|
|
112
203
|
}
|
|
204
|
+
function inputsEqual(a, b) {
|
|
205
|
+
return a.length === b.length && a.every((entry, i) => entry === b[i]);
|
|
206
|
+
}
|
|
113
207
|
function convertConfigToFlatConfig(tree, root, source, target, format, ignorePath) {
|
|
114
208
|
const ignorePaths = ignorePath
|
|
115
209
|
? [ignorePath, `${root}/.eslintignore`]
|
|
116
210
|
: [`${root}/.eslintignore`];
|
|
117
|
-
|
|
211
|
+
// `.eslintrc` (no extension) is JSON by convention.
|
|
212
|
+
if (source.endsWith('.json') || (0, path_1.basename)(source) === '.eslintrc') {
|
|
118
213
|
const config = (0, devkit_1.readJson)(tree, `${root}/${source}`);
|
|
119
214
|
const conversionResult = (0, json_converter_1.convertEslintJsonToFlatConfig)(tree, root, config, ignorePaths, format);
|
|
120
215
|
return processConvertedConfig(tree, root, source, target, conversionResult);
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"description": "Skip formatting files.",
|
|
11
11
|
"default": false,
|
|
12
12
|
"x-priority": "internal"
|
|
13
|
+
},
|
|
14
|
+
"eslintConfigFormat": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The format of the generated ESLint flat config files.",
|
|
17
|
+
"enum": ["mjs", "cjs"],
|
|
18
|
+
"default": "mjs",
|
|
19
|
+
"x-priority": "internal"
|
|
13
20
|
}
|
|
14
21
|
},
|
|
15
22
|
"additionalProperties": false,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToInferred = convertToInferred;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
6
|
-
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
7
6
|
const posix_1 = require("node:path/posix");
|
|
8
7
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
9
8
|
const plugin_1 = require("../../plugins/plugin");
|
|
@@ -11,7 +10,7 @@ const config_file_1 = require("../../utils/config-file");
|
|
|
11
10
|
const target_options_map_1 = require("./lib/target-options-map");
|
|
12
11
|
async function convertToInferred(tree, options) {
|
|
13
12
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
14
|
-
const migratedProjects = await (0,
|
|
13
|
+
const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/eslint/plugin', plugin_1.createNodesV2, { targetName: 'lint' }, [
|
|
15
14
|
{
|
|
16
15
|
executors: ['@nx/eslint:lint', '@nrwl/linter:eslint'],
|
|
17
16
|
postTargetTransformer,
|
|
@@ -20,7 +19,7 @@ async function convertToInferred(tree, options) {
|
|
|
20
19
|
},
|
|
21
20
|
], options.project);
|
|
22
21
|
if (migratedProjects.size === 0) {
|
|
23
|
-
throw new
|
|
22
|
+
throw new internal_1.NoTargetsToMigrateError();
|
|
24
23
|
}
|
|
25
24
|
if (!options.skipFormat) {
|
|
26
25
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -75,7 +74,7 @@ function postTargetTransformer(target, tree, projectDetails, inferredTargetConfi
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
if (target.outputs) {
|
|
78
|
-
(0,
|
|
77
|
+
(0, internal_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
|
|
79
78
|
projectName: projectDetails.projectName,
|
|
80
79
|
projectRoot: projectDetails.root,
|
|
81
80
|
});
|
|
@@ -27,4 +27,3 @@ export declare const javaScriptOverride: {
|
|
|
27
27
|
};
|
|
28
28
|
export declare const getGlobalEsLintConfiguration: (unitTestRunner?: string, rootProject?: boolean) => Linter.LegacyConfig;
|
|
29
29
|
export declare const getGlobalFlatEslintConfiguration: (format: "cjs" | "mjs", rootProject?: boolean) => string;
|
|
30
|
-
//# sourceMappingURL=global-eslint-config.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { GeneratorCallback, ProjectConfiguration, TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
2
|
export declare function migrateConfigToMonorepoStyle(projects: ProjectConfiguration[], tree: Tree, unitTestRunner: string, eslintConfigFormat: 'mjs' | 'cjs', keepExistingVersions?: boolean): GeneratorCallback;
|
|
3
3
|
export declare function findLintTarget(project: ProjectConfiguration): TargetConfiguration;
|
|
4
|
-
//# sourceMappingURL=init-migration.d.ts.map
|
|
@@ -8,4 +8,3 @@ export interface LinterInitOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function initEsLint(tree: Tree, options: LinterInitOptions): Promise<GeneratorCallback>;
|
|
10
10
|
export declare function lintInitGenerator(tree: Tree, options: LinterInitOptions): Promise<GeneratorCallback>;
|
|
11
|
-
//# sourceMappingURL=init.d.ts.map
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initEsLint = initEsLint;
|
|
4
4
|
exports.lintInitGenerator = lintInitGenerator;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
8
|
const eslint_file_1 = require("../utils/eslint-file");
|
|
9
9
|
const plugin_1 = require("../../plugins/plugin");
|
|
@@ -21,19 +21,32 @@ function updateProductionFileset(tree, format = 'mjs') {
|
|
|
21
21
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
22
22
|
}
|
|
23
23
|
function addTargetDefaults(tree, format) {
|
|
24
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
nxJson.targetDefaults
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
25
|
+
// `@nx/eslint:lint` is an executor identifier — match defaults keyed on
|
|
26
|
+
// the executor, not on a target named that string.
|
|
27
|
+
const existing = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
|
|
28
|
+
executor: '@nx/eslint:lint',
|
|
29
|
+
});
|
|
30
|
+
const patch = {};
|
|
31
|
+
if (existing?.cache === undefined)
|
|
32
|
+
patch.cache = true;
|
|
33
|
+
if (existing?.inputs === undefined) {
|
|
34
|
+
patch.inputs = [
|
|
35
|
+
'default',
|
|
36
|
+
'^default',
|
|
37
|
+
`{workspaceRoot}/.eslintrc.json`,
|
|
38
|
+
`{workspaceRoot}/.eslintignore`,
|
|
39
|
+
`{workspaceRoot}/eslint.config.${format}`,
|
|
40
|
+
'{workspaceRoot}/tools/eslint-rules/**/*',
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
if (Object.keys(patch).length > 0) {
|
|
44
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
45
|
+
executor: '@nx/eslint:lint',
|
|
46
|
+
...patch,
|
|
47
|
+
});
|
|
48
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
function updateVsCodeRecommendedExtensions(host) {
|
|
39
52
|
if (!host.exists('.vscode/extensions.json')) {
|
|
@@ -75,7 +88,7 @@ async function initEsLint(tree, options) {
|
|
|
75
88
|
'_eslint-lint',
|
|
76
89
|
];
|
|
77
90
|
if (rootEslintFile && options.addPlugin && !hasPlugin) {
|
|
78
|
-
await (0,
|
|
91
|
+
await (0, internal_1.addPlugin)(tree, graph, '@nx/eslint/plugin', plugin_1.createNodesV2, {
|
|
79
92
|
targetName: lintTargetNames,
|
|
80
93
|
}, options.updatePackageScripts);
|
|
81
94
|
return () => { };
|
|
@@ -86,7 +99,7 @@ async function initEsLint(tree, options) {
|
|
|
86
99
|
updateProductionFileset(tree, options.eslintConfigFormat);
|
|
87
100
|
updateVsCodeRecommendedExtensions(tree);
|
|
88
101
|
if (options.addPlugin) {
|
|
89
|
-
await (0,
|
|
102
|
+
await (0, internal_1.addPlugin)(tree, graph, '@nx/eslint/plugin', plugin_1.createNodesV2, {
|
|
90
103
|
targetName: lintTargetNames,
|
|
91
104
|
}, options.updatePackageScripts);
|
|
92
105
|
}
|
|
@@ -22,4 +22,3 @@ interface LintProjectOptions {
|
|
|
22
22
|
export declare function lintProjectGenerator(tree: Tree, options: LintProjectOptions): Promise<GeneratorCallback>;
|
|
23
23
|
export declare function lintProjectGeneratorInternal(tree: Tree, options: LintProjectOptions): Promise<GeneratorCallback>;
|
|
24
24
|
export {};
|
|
25
|
-
//# sourceMappingURL=lint-project.d.ts.map
|
|
@@ -6,6 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const eslint_file_1 = require("../utils/eslint-file");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const init_1 = require("../init/init");
|
|
9
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
9
10
|
const init_migration_1 = require("../init/init-migration");
|
|
10
11
|
const project_configuration_1 = require("nx/src/generators/utils/project-configuration");
|
|
11
12
|
const flat_config_1 = require("../../utils/flat-config");
|
|
@@ -14,7 +15,7 @@ const config_file_1 = require("../../utils/config-file");
|
|
|
14
15
|
const plugin_1 = require("../utils/plugin");
|
|
15
16
|
const versions_1 = require("../../utils/versions");
|
|
16
17
|
const setup_root_eslint_1 = require("./setup-root-eslint");
|
|
17
|
-
const
|
|
18
|
+
const internal_1 = require("@nx/js/internal");
|
|
18
19
|
function lintProjectGenerator(tree, options) {
|
|
19
20
|
return lintProjectGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
20
21
|
}
|
|
@@ -63,6 +64,7 @@ async function lintProjectGeneratorInternal(tree, options) {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
67
|
+
(0, deprecation_1.warnEslintExecutorGenerating)();
|
|
66
68
|
projectConfig.targets ??= {};
|
|
67
69
|
projectConfig.targets['lint'] = {
|
|
68
70
|
executor: '@nx/eslint:lint',
|
|
@@ -235,7 +237,7 @@ function isJsAnalyzeSourceFilesEnabled(tree) {
|
|
|
235
237
|
nxJson.extends !== 'nx/presets/npm.json');
|
|
236
238
|
}
|
|
237
239
|
function isBuildableLibraryProject(tree, projectConfig) {
|
|
238
|
-
return ((0,
|
|
240
|
+
return ((0, internal_1.getProjectType)(tree, projectConfig.root, projectConfig.projectType) ===
|
|
239
241
|
'library' &&
|
|
240
242
|
projectConfig.targets?.build &&
|
|
241
243
|
!!projectConfig.targets.build);
|