@angular-eslint/schematics 17.5.2-alpha.0 → 17.5.2-alpha.1
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.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 +11 -0
- package/dist/devkit-imports.d.ts.map +1 -0
- package/dist/devkit-imports.js +21 -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 +8 -8
- package/package.json +4 -4
|
@@ -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__NX)(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__NX)(tree, options.name, 'lint');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In order to prevent the project graph cache from showing up at the root of the user's
|
|
3
|
+
* workspace, we set a custom cache directory before importing anything from `@nx/devkit`.
|
|
4
|
+
*
|
|
5
|
+
* `no-restricted-imports` eslint rule has been configured for this project to prevent
|
|
6
|
+
* accidental imports in other files. All imports should come from here to ensure consistency.
|
|
7
|
+
*/
|
|
8
|
+
export { convertNxGenerator, offsetFromRoot, readJson, writeJson, } from '@nx/devkit';
|
|
9
|
+
export type { ProjectConfiguration, Tree } from '@nx/devkit';
|
|
10
|
+
export { wrapAngularDevkitSchematic } from '@nx/devkit/ngcli-adapter';
|
|
11
|
+
//# sourceMappingURL=devkit-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devkit-imports.d.ts","sourceRoot":"","sources":["../src/devkit-imports.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* In order to prevent the project graph cache from showing up at the root of the user's
|
|
4
|
+
* workspace, we set a custom cache directory before importing anything from `@nx/devkit`.
|
|
5
|
+
*
|
|
6
|
+
* `no-restricted-imports` eslint rule has been configured for this project to prevent
|
|
7
|
+
* accidental imports in other files. All imports should come from here to ensure consistency.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.wrapAngularDevkitSchematic = exports.writeJson = exports.readJson = exports.offsetFromRoot = exports.convertNxGenerator = void 0;
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
process.env.NX_PROJECT_GRAPH_CACHE_DIRECTORY = (0, node_path_1.join)(__dirname, '..', '.nx-cache');
|
|
13
|
+
/* eslint-disable no-restricted-imports */
|
|
14
|
+
var devkit_1 = require("@nx/devkit");
|
|
15
|
+
Object.defineProperty(exports, "convertNxGenerator", { enumerable: true, get: function () { return devkit_1.convertNxGenerator; } });
|
|
16
|
+
Object.defineProperty(exports, "offsetFromRoot", { enumerable: true, get: function () { return devkit_1.offsetFromRoot; } });
|
|
17
|
+
Object.defineProperty(exports, "readJson", { enumerable: true, get: function () { return devkit_1.readJson; } });
|
|
18
|
+
Object.defineProperty(exports, "writeJson", { enumerable: true, get: function () { return devkit_1.writeJson; } });
|
|
19
|
+
var ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
20
|
+
Object.defineProperty(exports, "wrapAngularDevkitSchematic", { enumerable: true, get: function () { return ngcli_adapter_1.wrapAngularDevkitSchematic; } });
|
|
21
|
+
/* eslint-enable no-restricted-imports */
|
|
@@ -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__NX)(tree, options.name, 'lint');
|
package/dist/utils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Path } from '@angular-devkit/core';
|
|
8
8
|
import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
9
|
-
import type { Tree as NxTree } from '
|
|
9
|
+
import type { Tree as NxTree } from './devkit-imports';
|
|
10
10
|
/**
|
|
11
11
|
* This method is specifically for reading JSON files in a Tree
|
|
12
12
|
* @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;;;;;GAKG;AACH,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;;;;;GAKG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAK/E,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAwB,MAAM,kBAAkB,CAAC;AAS7E;;;;;GAKG;AAEH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAcnE;AAED;;;;;GAKG;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAC7C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,CAAC,GAClD,IAAI,CAYN;AAQD,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE3E,wBAAgB,2BAA2B,CACzC,aAAa,EAAE;IAAE,SAAS,CAAC,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,OAAO,CAAC,EAAE,aAAa,CAAA;CAAE,GACzE,aAAa,GAAG,IAAI,CAYtB;AA4CD,wBAAgB,4BAA4B,CA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ChC,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAUvC"}
|
package/dist/utils.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.updateSchematicDefaults = exports.updateSchematicCollections = exports.determineTargetProjectName = exports.determineTargetProjectName__NX = exports.sortObjectByKeys = exports.createESLintConfigForProject = exports.createESLintConfigForProject__NX = exports.createRootESLintConfig = exports.visitNotIgnoredFiles = exports.addESLintTargetToProject = exports.addESLintTargetToProject__NX = 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 strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
11
|
+
const devkit_imports_1 = require("./devkit-imports");
|
|
12
12
|
const DEFAULT_PREFIX = 'app';
|
|
13
13
|
/**
|
|
14
14
|
* This method is specifically for reading JSON files in a Tree
|
|
@@ -87,13 +87,13 @@ function updateWorkspaceInTree(callback) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
function readProjectConfiguration(tree, projectName) {
|
|
90
|
-
const angularJSON = (0,
|
|
90
|
+
const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
91
91
|
return angularJSON.projects[projectName];
|
|
92
92
|
}
|
|
93
93
|
function updateProjectConfiguration(tree, projectName, projectConfig) {
|
|
94
|
-
const angularJSON = (0,
|
|
94
|
+
const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
95
95
|
angularJSON.projects[projectName] = projectConfig;
|
|
96
|
-
(0,
|
|
96
|
+
(0, devkit_imports_1.writeJson)(tree, 'angular.json', angularJSON);
|
|
97
97
|
}
|
|
98
98
|
function addESLintTargetToProject__NX(tree, projectName, targetName) {
|
|
99
99
|
const existingProjectConfig = readProjectConfiguration(tree, projectName);
|
|
@@ -269,7 +269,7 @@ function createProjectESLintConfig(projectRoot, projectType, prefix, setParserOp
|
|
|
269
269
|
}
|
|
270
270
|
function createProjectESLintConfig__NX(projectRoot, projectType, prefix, setParserOptionsProject, hasE2e) {
|
|
271
271
|
return {
|
|
272
|
-
extends: `${(0,
|
|
272
|
+
extends: `${(0, devkit_imports_1.offsetFromRoot)(projectRoot)}.eslintrc.json`,
|
|
273
273
|
ignorePatterns: ['!**/*'],
|
|
274
274
|
overrides: [
|
|
275
275
|
{
|
|
@@ -315,7 +315,7 @@ function createESLintConfigForProject__NX(tree, projectName, setParserOptionsPro
|
|
|
315
315
|
if (!tree.exists('.eslintrc.json')) {
|
|
316
316
|
createRootESLintConfigFile__NX(tree, prefix || DEFAULT_PREFIX);
|
|
317
317
|
}
|
|
318
|
-
(0,
|
|
318
|
+
(0, devkit_imports_1.writeJson)(tree, (0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), createProjectESLintConfig__NX(projectRoot, projectType || 'library', prefix || DEFAULT_PREFIX, setParserOptionsProject, hasE2e));
|
|
319
319
|
}
|
|
320
320
|
exports.createESLintConfigForProject__NX = createESLintConfigForProject__NX;
|
|
321
321
|
function createESLintConfigForProject(projectName, setParserOptionsProject) {
|
|
@@ -352,7 +352,7 @@ function createRootESLintConfigFile(projectName) {
|
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
354
|
function createRootESLintConfigFile__NX(tree, prefix) {
|
|
355
|
-
return (0,
|
|
355
|
+
return (0, devkit_imports_1.writeJson)(tree, '.eslintrc.json', createRootESLintConfig(prefix));
|
|
356
356
|
}
|
|
357
357
|
function sortObjectByKeys(obj) {
|
|
358
358
|
return Object.keys(obj)
|
|
@@ -373,7 +373,7 @@ function determineTargetProjectName__NX(tree, maybeProject) {
|
|
|
373
373
|
if (maybeProject) {
|
|
374
374
|
return maybeProject;
|
|
375
375
|
}
|
|
376
|
-
const workspaceJson = (0,
|
|
376
|
+
const workspaceJson = (0, devkit_imports_1.readJson)(tree, 'angular.json');
|
|
377
377
|
const projects = Object.keys(workspaceJson.projects);
|
|
378
378
|
if (projects.length === 1) {
|
|
379
379
|
return projects[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/schematics",
|
|
3
|
-
"version": "17.5.2-alpha.
|
|
3
|
+
"version": "17.5.2-alpha.1",
|
|
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": "devDependencies"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@angular-eslint/eslint-plugin": "17.5.2-alpha.
|
|
38
|
-
"@angular-eslint/eslint-plugin-template": "17.5.2-alpha.
|
|
37
|
+
"@angular-eslint/eslint-plugin": "17.5.2-alpha.1",
|
|
38
|
+
"@angular-eslint/eslint-plugin-template": "17.5.2-alpha.1",
|
|
39
39
|
"@nx/devkit": "^17.2.8 || ^18.0.0 || ^19.0.0",
|
|
40
40
|
"ignore": "5.3.1",
|
|
41
41
|
"nx": "^17.2.8 || ^18.0.0 || ^19.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/tmp": "0.2.6",
|
|
47
|
-
"@typescript-eslint/utils": "7.
|
|
47
|
+
"@typescript-eslint/utils": "7.11.0",
|
|
48
48
|
"eslint": "8.57.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|