@angular-eslint/schematics 18.0.0-alpha.10 → 18.0.0-alpha.11
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/dist/add-eslint-to-project/index.d.ts.map +1 -1
- package/dist/add-eslint-to-project/index.js +2 -2
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +3 -4
- package/dist/devkit-imports.d.ts +4 -0
- package/dist/devkit-imports.d.ts.map +1 -0
- package/dist/devkit-imports.js +12 -0
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +3 -4
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -9
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/add-eslint-to-project/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/add-eslint-to-project/index.ts"],"names":[],"mappings":"AAOA,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;;AAED,wBAqBG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const devkit_imports_1 = require("../devkit-imports");
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
|
|
6
6
|
const projectName = (0, utils_1.determineTargetProjectName)(tree, options.project);
|
|
7
7
|
if (!projectName) {
|
|
8
8
|
throw new Error('\n' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAWtF,UAAU,MAAO,SAAQ,aAAa;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;;AAED,wBAoBG"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
3
|
+
const devkit_imports_1 = require("../devkit-imports");
|
|
5
4
|
const utils_1 = require("../utils");
|
|
6
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
|
|
7
6
|
// Remove angular-eslint specific options before passing to the Angular schematic
|
|
8
7
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
8
|
const { setParserOptionsProject, ...angularOptions } = options;
|
|
10
|
-
const applicationGenerator = (0,
|
|
9
|
+
const applicationGenerator = (0, devkit_imports_1.wrapAngularDevkitSchematic)('@schematics/angular', 'application');
|
|
11
10
|
await applicationGenerator(tree, angularOptions);
|
|
12
11
|
// Update the lint builder and config in angular.json
|
|
13
12
|
(0, utils_1.addESLintTargetToProject)(tree, options.name, 'lint');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devkit-imports.d.ts","sourceRoot":"","sources":["../src/devkit-imports.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapAngularDevkitSchematic = exports.writeJson = exports.readJson = exports.offsetFromRoot = exports.convertNxGenerator = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
process.env.NX_PROJECT_GRAPH_CACHE_DIRECTORY = (0, node_path_1.join)(__dirname, '..', '.nx-cache');
|
|
6
|
+
var devkit_1 = require("@nx/devkit");
|
|
7
|
+
Object.defineProperty(exports, "convertNxGenerator", { enumerable: true, get: function () { return devkit_1.convertNxGenerator; } });
|
|
8
|
+
Object.defineProperty(exports, "offsetFromRoot", { enumerable: true, get: function () { return devkit_1.offsetFromRoot; } });
|
|
9
|
+
Object.defineProperty(exports, "readJson", { enumerable: true, get: function () { return devkit_1.readJson; } });
|
|
10
|
+
Object.defineProperty(exports, "writeJson", { enumerable: true, get: function () { return devkit_1.writeJson; } });
|
|
11
|
+
var ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
12
|
+
Object.defineProperty(exports, "wrapAngularDevkitSchematic", { enumerable: true, get: function () { return ngcli_adapter_1.wrapAngularDevkitSchematic; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/library/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/library/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAWlF,UAAU,MAAO,SAAQ,aAAa;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;;AAED,wBAoBG"}
|
package/dist/library/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
3
|
+
const devkit_imports_1 = require("../devkit-imports");
|
|
5
4
|
const utils_1 = require("../utils");
|
|
6
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
|
|
7
6
|
// Remove angular-eslint specific options before passing to the Angular schematic
|
|
8
7
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
8
|
const { setParserOptionsProject, ...angularOptions } = options;
|
|
10
|
-
const libraryGenerator = (0,
|
|
9
|
+
const libraryGenerator = (0, devkit_imports_1.wrapAngularDevkitSchematic)('@schematics/angular', 'library');
|
|
11
10
|
await libraryGenerator(tree, angularOptions);
|
|
12
11
|
// Update the lint builder and config in angular.json
|
|
13
12
|
(0, utils_1.addESLintTargetToProject)(tree, options.name, 'lint');
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Path } from '@angular-devkit/core';
|
|
2
2
|
import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
import
|
|
3
|
+
import { Tree as NxTree } from './devkit-imports';
|
|
4
4
|
/**
|
|
5
5
|
* This method is specifically for reading JSON files in a Tree
|
|
6
6
|
* @param host The host tree
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAA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EACZ,WAAW,EAAE,MAAM,EACnB,uBAAuB,EAAE,OAAO,QA8EjC;AAgBD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,IAAI,CAUf;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,uBAS1E;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAUvC"}
|
package/dist/utils.js
CHANGED
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.updateSchematicDefaults = exports.updateSchematicCollections = exports.determineTargetProjectName = exports.sortObjectByKeys = exports.createESLintConfigForProject = exports.createStringifiedRootESLintConfig = exports.createRootESLintConfig = exports.visitNotIgnoredFiles = exports.addESLintTargetToProject = exports.getTargetsConfigFromProject = exports.updateJsonInTree = exports.readJsonInTree = void 0;
|
|
7
7
|
const core_1 = require("@angular-devkit/core");
|
|
8
8
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
9
|
-
const devkit_1 = require("@nx/devkit");
|
|
10
9
|
const ignore_1 = __importDefault(require("ignore"));
|
|
11
10
|
const semver_1 = __importDefault(require("semver"));
|
|
12
11
|
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
12
|
+
const devkit_imports_1 = require("./devkit-imports");
|
|
13
13
|
const DEFAULT_PREFIX = 'app';
|
|
14
14
|
/**
|
|
15
15
|
* This method is specifically for reading JSON files in a Tree
|
|
@@ -67,13 +67,13 @@ function serializeJson(json) {
|
|
|
67
67
|
return `${JSON.stringify(json, null, 2)}\n`;
|
|
68
68
|
}
|
|
69
69
|
function readProjectConfiguration(tree, projectName) {
|
|
70
|
-
const angularJSON = (0,
|
|
70
|
+
const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
71
71
|
return angularJSON.projects[projectName];
|
|
72
72
|
}
|
|
73
73
|
function updateProjectConfiguration(tree, projectName, projectConfig) {
|
|
74
|
-
const angularJSON = (0,
|
|
74
|
+
const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
75
75
|
angularJSON.projects[projectName] = projectConfig;
|
|
76
|
-
(0,
|
|
76
|
+
(0, devkit_imports_1.writeJson)(tree, 'angular.json', angularJSON);
|
|
77
77
|
}
|
|
78
78
|
function addESLintTargetToProject(tree, projectName, targetName) {
|
|
79
79
|
const existingProjectConfig = readProjectConfiguration(tree, projectName);
|
|
@@ -94,6 +94,11 @@ function addESLintTargetToProject(tree, projectName, targetName) {
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
};
|
|
97
|
+
let eslintConfig;
|
|
98
|
+
if (existingProjectConfig.root !== '') {
|
|
99
|
+
eslintConfig = (0, core_1.join)(existingProjectConfig.root, 'eslint.config.js');
|
|
100
|
+
}
|
|
101
|
+
eslintTargetConfig.options.eslintConfig = eslintConfig;
|
|
97
102
|
existingProjectConfig.architect = existingProjectConfig.architect || {};
|
|
98
103
|
existingProjectConfig.architect[targetName] = eslintTargetConfig;
|
|
99
104
|
updateProjectConfiguration(tree, projectName, existingProjectConfig);
|
|
@@ -239,7 +244,7 @@ module.exports = tseslint.config(
|
|
|
239
244
|
exports.createStringifiedRootESLintConfig = createStringifiedRootESLintConfig;
|
|
240
245
|
function createProjectESLintConfig(projectRoot, projectType, prefix, setParserOptionsProject, hasE2e) {
|
|
241
246
|
return {
|
|
242
|
-
extends: `${(0,
|
|
247
|
+
extends: `${(0, devkit_imports_1.offsetFromRoot)(projectRoot)}.eslintrc.json`,
|
|
243
248
|
ignorePatterns: ['!**/*'],
|
|
244
249
|
overrides: [
|
|
245
250
|
{
|
|
@@ -272,7 +277,7 @@ function createProjectESLintConfig(projectRoot, projectType, prefix, setParserOp
|
|
|
272
277
|
function createStringifiedProjectESLintConfig(projectRoot, projectType, prefix, setParserOptionsProject, hasE2e) {
|
|
273
278
|
return `// @ts-check
|
|
274
279
|
const tseslint = require("typescript-eslint");
|
|
275
|
-
const rootConfig = require("${(0,
|
|
280
|
+
const rootConfig = require("${(0, devkit_imports_1.offsetFromRoot)(projectRoot)}eslint.config.js");
|
|
276
281
|
|
|
277
282
|
module.exports = tseslint.config(
|
|
278
283
|
...rootConfig,
|
|
@@ -360,7 +365,7 @@ function createESLintConfigForProject(tree, projectName, setParserOptionsProject
|
|
|
360
365
|
tree.write((0, core_1.join)((0, core_1.normalize)(projectRoot), 'eslint.config.js'), createStringifiedProjectESLintConfig(projectRoot, projectType || 'library', prefix || DEFAULT_PREFIX, setParserOptionsProject, hasE2e));
|
|
361
366
|
}
|
|
362
367
|
else {
|
|
363
|
-
(0,
|
|
368
|
+
(0, devkit_imports_1.writeJson)(tree, (0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), createProjectESLintConfig(projectRoot, projectType || 'library', prefix || DEFAULT_PREFIX, setParserOptionsProject, hasE2e));
|
|
364
369
|
}
|
|
365
370
|
}
|
|
366
371
|
exports.createESLintConfigForProject = createESLintConfigForProject;
|
|
@@ -368,7 +373,7 @@ function createRootESLintConfigFile(tree, prefix, useFlatConfig) {
|
|
|
368
373
|
if (useFlatConfig) {
|
|
369
374
|
return tree.write('eslint.config.js', createStringifiedRootESLintConfig(prefix));
|
|
370
375
|
}
|
|
371
|
-
return (0,
|
|
376
|
+
return (0, devkit_imports_1.writeJson)(tree, '.eslintrc.json', createRootESLintConfig(prefix));
|
|
372
377
|
}
|
|
373
378
|
function sortObjectByKeys(obj) {
|
|
374
379
|
return Object.keys(obj)
|
|
@@ -389,7 +394,7 @@ function determineTargetProjectName(tree, maybeProject) {
|
|
|
389
394
|
if (maybeProject) {
|
|
390
395
|
return maybeProject;
|
|
391
396
|
}
|
|
392
|
-
const workspaceJson = (0,
|
|
397
|
+
const workspaceJson = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
393
398
|
const projects = Object.keys(workspaceJson.projects);
|
|
394
399
|
if (projects.length === 1) {
|
|
395
400
|
return projects[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/schematics",
|
|
3
|
-
"version": "18.0.0-alpha.
|
|
3
|
+
"version": "18.0.0-alpha.11",
|
|
4
4
|
"description": "Angular Schematics for angular-eslint",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"save": false
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@angular-eslint/eslint-plugin": "18.0.0-alpha.
|
|
38
|
-
"@angular-eslint/eslint-plugin-template": "18.0.0-alpha.
|
|
37
|
+
"@angular-eslint/eslint-plugin": "18.0.0-alpha.11",
|
|
38
|
+
"@angular-eslint/eslint-plugin-template": "18.0.0-alpha.11",
|
|
39
39
|
"@nx/devkit": "^19.0.6",
|
|
40
40
|
"ignore": "5.3.1",
|
|
41
41
|
"nx": "^19.0.6",
|