@nx/eslint 18.3.0-beta.0 → 18.3.0-beta.2
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": "18.3.0-beta.
|
3
|
+
"version": "18.3.0-beta.2",
|
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": "18.3.0-beta.
|
37
|
-
"@nx/js": "18.3.0-beta.
|
36
|
+
"@nx/devkit": "18.3.0-beta.2",
|
37
|
+
"@nx/js": "18.3.0-beta.2",
|
38
38
|
"eslint": "^8.0.0",
|
39
39
|
"tslib": "^2.3.0",
|
40
40
|
"typescript": "~5.4.2",
|
41
|
-
"@nx/linter": "18.3.0-beta.
|
41
|
+
"@nx/linter": "18.3.0-beta.2"
|
42
42
|
},
|
43
43
|
"peerDependenciesMeta": {
|
44
44
|
"js-yaml": {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.lintInitGenerator = exports.initEsLint = void 0;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const
|
5
|
+
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
6
6
|
const versions_1 = require("../../utils/versions");
|
7
7
|
const eslint_file_1 = require("../utils/eslint-file");
|
8
8
|
const plugin_1 = require("../../plugins/plugin");
|
@@ -31,24 +31,6 @@ function addTargetDefaults(tree) {
|
|
31
31
|
];
|
32
32
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
33
33
|
}
|
34
|
-
function addPlugin(tree) {
|
35
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
36
|
-
nxJson.plugins ??= [];
|
37
|
-
for (const plugin of nxJson.plugins) {
|
38
|
-
if (typeof plugin === 'string'
|
39
|
-
? plugin === '@nx/eslint/plugin'
|
40
|
-
: plugin.plugin === '@nx/eslint/plugin') {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
nxJson.plugins.push({
|
45
|
-
plugin: '@nx/eslint/plugin',
|
46
|
-
options: {
|
47
|
-
targetName: 'lint',
|
48
|
-
},
|
49
|
-
});
|
50
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
51
|
-
}
|
52
34
|
async function initEsLint(tree, options) {
|
53
35
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
54
36
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
@@ -56,11 +38,19 @@ async function initEsLint(tree, options) {
|
|
56
38
|
options.addPlugin ??= addPluginDefault;
|
57
39
|
const hasPlugin = (0, plugin_2.hasEslintPlugin)(tree);
|
58
40
|
const rootEslintFile = (0, eslint_file_1.findEslintFile)(tree);
|
41
|
+
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
42
|
+
const lintTargetNames = [
|
43
|
+
'lint',
|
44
|
+
'eslint:lint',
|
45
|
+
'eslint-lint',
|
46
|
+
'_lint',
|
47
|
+
'_eslint:lint',
|
48
|
+
'_eslint-lint',
|
49
|
+
];
|
59
50
|
if (rootEslintFile && options.addPlugin && !hasPlugin) {
|
60
|
-
addPlugin(tree
|
61
|
-
|
62
|
-
|
63
|
-
}
|
51
|
+
await (0, add_plugin_1.addPlugin)(tree, graph, '@nx/eslint/plugin', plugin_1.createNodes, {
|
52
|
+
targetName: lintTargetNames,
|
53
|
+
}, options.updatePackageScripts);
|
64
54
|
return () => { };
|
65
55
|
}
|
66
56
|
if (rootEslintFile) {
|
@@ -68,7 +58,9 @@ async function initEsLint(tree, options) {
|
|
68
58
|
}
|
69
59
|
updateProductionFileset(tree);
|
70
60
|
if (options.addPlugin) {
|
71
|
-
addPlugin(tree
|
61
|
+
await (0, add_plugin_1.addPlugin)(tree, graph, '@nx/eslint/plugin', plugin_1.createNodes, {
|
62
|
+
targetName: lintTargetNames,
|
63
|
+
}, options.updatePackageScripts);
|
72
64
|
}
|
73
65
|
else {
|
74
66
|
addTargetDefaults(tree);
|
@@ -81,9 +73,6 @@ async function initEsLint(tree, options) {
|
|
81
73
|
eslint: versions_1.eslintVersion,
|
82
74
|
}, undefined, options.keepExistingVersions));
|
83
75
|
}
|
84
|
-
if (options.updatePackageScripts) {
|
85
|
-
await (0, update_package_scripts_1.updatePackageScripts)(tree, plugin_1.createNodes);
|
86
|
-
}
|
87
76
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
88
77
|
}
|
89
78
|
exports.initEsLint = initEsLint;
|