@nx/plugin 23.0.0-beta.16 → 23.0.0-beta.17
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/plugin",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
|
|
6
6
|
"repository": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"tslib": "^2.3.0",
|
|
32
|
-
"@nx/devkit": "23.0.0-beta.
|
|
33
|
-
"@nx/jest": "23.0.0-beta.
|
|
34
|
-
"@nx/js": "23.0.0-beta.
|
|
35
|
-
"@nx/eslint": "23.0.0-beta.
|
|
32
|
+
"@nx/devkit": "23.0.0-beta.17",
|
|
33
|
+
"@nx/jest": "23.0.0-beta.17",
|
|
34
|
+
"@nx/js": "23.0.0-beta.17",
|
|
35
|
+
"@nx/eslint": "23.0.0-beta.17"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"nx": "23.0.0-beta.
|
|
38
|
+
"nx": "23.0.0-beta.17"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectConfiguration, TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema as EsLintExecutorOptions } from '@nx/eslint/
|
|
2
|
+
import type { Schema as EsLintExecutorOptions } from '@nx/eslint/internal';
|
|
3
3
|
import { PluginLintChecksGeneratorSchema } from './schema';
|
|
4
4
|
import { PackageJson } from 'nx/src/utils/package-json';
|
|
5
5
|
export default function pluginLintCheckGenerator(host: Tree, options: PluginLintChecksGeneratorSchema): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/lint-checks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,EAGpB,mBAAmB,EACnB,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/lint-checks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,EAGpB,mBAAmB,EACnB,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAuB,MAAM,2BAA2B,CAAC;AAU7E,wBAA8B,wBAAwB,CACpD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,iBA2BzC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,EACxC,WAAW,EAAE,WAAW,QAyDzB;AAmLD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAO7E"}
|
|
@@ -6,8 +6,7 @@ exports.getEsLintOptions = getEsLintOptions;
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const logger_1 = require("nx/src/utils/logger");
|
|
8
8
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
9
|
-
const
|
|
10
|
-
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
9
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
11
10
|
async function pluginLintCheckGenerator(host, options) {
|
|
12
11
|
const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
13
12
|
const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
@@ -49,7 +48,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
|
|
|
49
48
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfiguration);
|
|
50
49
|
}
|
|
51
50
|
// Update project level eslintrc
|
|
52
|
-
(0,
|
|
51
|
+
(0, internal_1.updateOverrideInLintConfig)(host, projectConfiguration.root, (o) => Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') ||
|
|
53
52
|
Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks'), (o) => {
|
|
54
53
|
const fileSet = new Set(Array.isArray(o.files) ? o.files : [o.files]);
|
|
55
54
|
fileSet.add(relativeMigrationsJsonPath);
|
|
@@ -60,7 +59,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
|
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
function formatFilesEntries(tree, files) {
|
|
63
|
-
if (!(0,
|
|
62
|
+
if (!(0, internal_1.useFlatConfig)(tree)) {
|
|
64
63
|
return files;
|
|
65
64
|
}
|
|
66
65
|
const filesAfter = files.map((f) => {
|
|
@@ -102,7 +101,7 @@ function updateProjectTarget(host, options, packageJson) {
|
|
|
102
101
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
|
|
103
102
|
}
|
|
104
103
|
function updateProjectEslintConfig(host, options, packageJson) {
|
|
105
|
-
if ((0,
|
|
104
|
+
if ((0, internal_1.isEslintConfigSupported)(host, options.root)) {
|
|
106
105
|
const lookup = (o) => Object.keys(o.rules ?? {}).includes('@nx/nx-plugin-checks') ||
|
|
107
106
|
Object.keys(o.rules ?? {}).includes('@nrwl/nx/nx-plugin-checks');
|
|
108
107
|
const files = [
|
|
@@ -113,12 +112,12 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
113
112
|
packageJson.builders,
|
|
114
113
|
(0, package_json_1.readNxMigrateConfig)(packageJson).migrations,
|
|
115
114
|
].filter((f) => !!f);
|
|
116
|
-
const parser = (0,
|
|
115
|
+
const parser = (0, internal_1.useFlatConfig)(host)
|
|
117
116
|
? { languageOptions: { parser: 'jsonc-eslint-parser' } }
|
|
118
117
|
: { parser: 'jsonc-eslint-parser' };
|
|
119
|
-
if ((0,
|
|
118
|
+
if ((0, internal_1.lintConfigHasOverride)(host, options.root, lookup)) {
|
|
120
119
|
// update it
|
|
121
|
-
(0,
|
|
120
|
+
(0, internal_1.updateOverrideInLintConfig)(host, options.root, lookup, (o) => ({
|
|
122
121
|
...o,
|
|
123
122
|
files: formatFilesEntries(host, [
|
|
124
123
|
...new Set([
|
|
@@ -135,7 +134,7 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
135
134
|
}
|
|
136
135
|
else {
|
|
137
136
|
// add it
|
|
138
|
-
(0,
|
|
137
|
+
(0, internal_1.addOverrideToLintConfig)(host, options.root, {
|
|
139
138
|
files: formatFilesEntries(host, files),
|
|
140
139
|
...parser,
|
|
141
140
|
rules: {
|
|
@@ -149,11 +148,11 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
149
148
|
// This is required, otherwise every json file that is not overriden
|
|
150
149
|
// will display false errors in the IDE
|
|
151
150
|
function updateRootEslintConfig(host) {
|
|
152
|
-
if ((0,
|
|
153
|
-
if (!(0,
|
|
151
|
+
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
152
|
+
if (!(0, internal_1.lintConfigHasOverride)(host, '', (o) => Array.isArray(o.files)
|
|
154
153
|
? o.files.some((f) => f.match(/\.json$/))
|
|
155
154
|
: !!o.files?.match(/\.json$/), true)) {
|
|
156
|
-
(0,
|
|
155
|
+
(0, internal_1.addOverrideToLintConfig)(host, '', {
|
|
157
156
|
files: '*.json',
|
|
158
157
|
parser: 'jsonc-eslint-parser',
|
|
159
158
|
rules: {},
|
|
@@ -187,7 +186,7 @@ function setupVsCodeLintingForJsonFiles(host) {
|
|
|
187
186
|
(0, devkit_1.writeJson)(host, '.vscode/settings.json', existing);
|
|
188
187
|
}
|
|
189
188
|
function projectIsEsLintEnabled(tree, project) {
|
|
190
|
-
return !!(0,
|
|
189
|
+
return !!(0, internal_1.findEslintFile)(tree, project.root);
|
|
191
190
|
}
|
|
192
191
|
function getEsLintOptions(project) {
|
|
193
192
|
return Object.entries(project.targets || {}).find(([, x]) => x.executor === '@nx/eslint:lint' ||
|