@angular-eslint/schematics 17.5.3-alpha.0 → 17.5.3

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.
@@ -1,7 +1,8 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
1
2
  interface Schema {
2
3
  project?: string;
3
4
  setParserOptionsProject?: boolean;
4
5
  }
5
- declare const _default: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
6
- export default _default;
6
+ export default function addESLintToProject(schema: Schema): Rule;
7
+ export {};
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/add-eslint-to-project/index.ts"],"names":[],"mappings":"AAQA,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;;AAED,wBAqBG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/add-eslint-to-project/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,4BAA4B,CAAC;AAQ7D,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAuB/D"}
@@ -1,18 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_imports_1 = require("../devkit-imports");
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../utils");
5
- exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
6
- const projectName = (0, utils_1.determineTargetProjectName__NX)(tree, options.project);
7
- if (!projectName) {
8
- throw new Error('\n' +
9
- `
5
+ function addESLintToProject(schema) {
6
+ return (tree) => {
7
+ const projectName = (0, utils_1.determineTargetProjectName)(tree, schema.project);
8
+ if (!projectName) {
9
+ throw new Error('\n' +
10
+ `
10
11
  Error: You must specify a project to add ESLint to because you have multiple projects in your angular.json
11
12
 
12
13
  E.g. npx ng g @angular-eslint/schematics:add-eslint-to-project {{YOUR_PROJECT_NAME_GOES_HERE}}
13
- `.trim());
14
- }
15
- // Update the lint builder and config in angular.json
16
- (0, utils_1.addESLintTargetToProject__NX)(tree, projectName, 'lint');
17
- (0, utils_1.createESLintConfigForProject__NX)(tree, projectName, options.setParserOptionsProject ?? false);
18
- });
14
+ `.trim());
15
+ }
16
+ return (0, schematics_1.chain)([
17
+ // Create the ESLint config file for the project
18
+ (0, utils_1.createESLintConfigForProject)(projectName, schema.setParserOptionsProject ?? false),
19
+ // Set the lint builder and config in angular.json
20
+ (0, utils_1.addESLintTargetToProject)(projectName, 'lint'),
21
+ ]);
22
+ };
23
+ }
24
+ exports.default = addESLintToProject;
@@ -1,3 +1,4 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
1
2
  /**
2
3
  * We are able to use the full, unaltered Schema directly from @schematics/angular
3
4
  * The applicable json file is copied from node_modules as a prebuiid step to ensure
@@ -7,6 +8,6 @@ import type { Schema as AngularSchema } from '@schematics/angular/application/sc
7
8
  interface Schema extends AngularSchema {
8
9
  setParserOptionsProject?: boolean;
9
10
  }
10
- declare const _default: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
11
- export default _default;
11
+ export default function (options: Schema): Rule;
12
+ export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE/E;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAMtF,UAAU,MAAO,SAAQ,aAAa;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAcD,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,MAAM,GAAG,IAAI,CAW9C"}
@@ -1,14 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_imports_1 = require("../devkit-imports");
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../utils");
5
- exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
6
- // Remove angular-eslint specific options before passing to the Angular schematic
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
- const { setParserOptionsProject, ...angularOptions } = options;
9
- const applicationGenerator = (0, devkit_imports_1.wrapAngularDevkitSchematic)('@schematics/angular', 'application');
10
- await applicationGenerator(tree, angularOptions);
11
- // Update the lint builder and config in angular.json
12
- (0, utils_1.addESLintTargetToProject__NX)(tree, options.name, 'lint');
13
- (0, utils_1.createESLintConfigForProject__NX)(tree, options.name, options.setParserOptionsProject ?? false);
14
- });
5
+ function eslintRelatedChanges(options) {
6
+ return (0, schematics_1.chain)([
7
+ // Create the ESLint config file for the project
8
+ (0, utils_1.createESLintConfigForProject)(options.name, options.setParserOptionsProject ?? false),
9
+ // Update the lint builder and config in angular.json
10
+ (0, utils_1.addESLintTargetToProject)(options.name, 'lint'),
11
+ ]);
12
+ }
13
+ function default_1(options) {
14
+ return (host, context) => {
15
+ // Remove angular-eslint specific options before passing to the Angular schematic
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ const { setParserOptionsProject, ...angularOptions } = options;
18
+ return (0, schematics_1.chain)([
19
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'application', angularOptions),
20
+ eslintRelatedChanges(options),
21
+ ])(host, context);
22
+ };
23
+ }
24
+ exports.default = default_1;
@@ -1,3 +1,4 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
1
2
  /**
2
3
  * We are able to use the full, unaltered Schema directly from @schematics/angular
3
4
  * The applicable json file is copied from node_modules as a prebuiid step to ensure
@@ -7,6 +8,6 @@ import type { Schema as AngularSchema } from '@schematics/angular/library/schema
7
8
  interface Schema extends AngularSchema {
8
9
  setParserOptionsProject?: boolean;
9
10
  }
10
- declare const _default: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
11
- export default _default;
11
+ export default function (options: Schema): Rule;
12
+ export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/library/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE/E;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAMlF,UAAU,MAAO,SAAQ,aAAa;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAcD,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,MAAM,GAAG,IAAI,CAW9C"}
@@ -1,14 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_imports_1 = require("../devkit-imports");
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../utils");
5
- exports.default = (0, devkit_imports_1.convertNxGenerator)(async (tree, options) => {
6
- // Remove angular-eslint specific options before passing to the Angular schematic
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
- const { setParserOptionsProject, ...angularOptions } = options;
9
- const libraryGenerator = (0, devkit_imports_1.wrapAngularDevkitSchematic)('@schematics/angular', 'library');
10
- await libraryGenerator(tree, angularOptions);
11
- // Update the lint builder and config in angular.json
12
- (0, utils_1.addESLintTargetToProject__NX)(tree, options.name, 'lint');
13
- (0, utils_1.createESLintConfigForProject__NX)(tree, options.name, options.setParserOptionsProject ?? false);
14
- });
5
+ function eslintRelatedChanges(options) {
6
+ return (0, schematics_1.chain)([
7
+ // Create the ESLint config file for the project
8
+ (0, utils_1.createESLintConfigForProject)(options.name, options.setParserOptionsProject ?? false),
9
+ // Update the lint builder and config in angular.json
10
+ (0, utils_1.addESLintTargetToProject)(options.name, 'lint'),
11
+ ]);
12
+ }
13
+ function default_1(options) {
14
+ return (host, context) => {
15
+ // Remove angular-eslint specific options before passing to the Angular schematic
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ const { setParserOptionsProject, ...angularOptions } = options;
18
+ return (0, schematics_1.chain)([
19
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'library', angularOptions),
20
+ eslintRelatedChanges(options),
21
+ ])(host, context);
22
+ };
23
+ }
24
+ exports.default = default_1;
package/dist/utils.d.ts CHANGED
@@ -6,7 +6,6 @@
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 './devkit-imports';
10
9
  /**
11
10
  * This method is specifically for reading JSON files in a Tree
12
11
  * @param host The host tree
@@ -30,7 +29,6 @@ export declare function getTargetsConfigFromProject(projectConfig: {
30
29
  } & {
31
30
  targets?: TargetsConfig;
32
31
  }): TargetsConfig | null;
33
- export declare function addESLintTargetToProject__NX(tree: NxTree, projectName: string, targetName: 'eslint' | 'lint'): void;
34
32
  export declare function addESLintTargetToProject(projectName: string, targetName: 'eslint' | 'lint'): Rule;
35
33
  /**
36
34
  * Utility to act on all files in a tree that are not ignored by git.
@@ -59,14 +57,8 @@ export declare function createRootESLintConfig(prefix: string | null): {
59
57
  };
60
58
  }[];
61
59
  };
62
- export declare function createESLintConfigForProject__NX(tree: NxTree, projectName: string, setParserOptionsProject: boolean): void;
63
60
  export declare function createESLintConfigForProject(projectName: string, setParserOptionsProject: boolean): Rule;
64
61
  export declare function sortObjectByKeys(obj: Record<string, unknown>): Record<string, unknown>;
65
- /**
66
- * To make certain schematic usage conversion more ergonomic, if the user does not specify a project
67
- * and only has a single project in their angular.json we will just go ahead and use that one.
68
- */
69
- export declare function determineTargetProjectName__NX(tree: NxTree, maybeProject?: string): string | null;
70
62
  /**
71
63
  * To make certain schematic usage conversion more ergonomic, if the user does not specify a project
72
64
  * and only has a single project in their angular.json we will just go ahead and use that one.
@@ -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;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,CAA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,aAAa,CAAA;CAAE,GACzE,aAAa,GAAG,IAAI,CAYtB;AA6BD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,QAAQ,GAAG,MAAM,GAC5B,IAAI,CA4BN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,EAC3E,GAAG,GAAE,IAAoB,GACxB,IAAI,CA8BN;AA0BD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;EAyC3D;AA8CD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,uBAAuB,EAAE,OAAO,GAC/B,IAAI,CAmCN;AAkBD,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,IAAI,EACV,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,IAAI,CAUf;AAcD;;;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
@@ -3,12 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
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;
6
+ exports.updateSchematicDefaults = exports.updateSchematicCollections = exports.determineTargetProjectName = exports.sortObjectByKeys = exports.createESLintConfigForProject = 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
9
  const ignore_1 = __importDefault(require("ignore"));
10
10
  const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
11
- const devkit_imports_1 = require("./devkit-imports");
12
11
  const DEFAULT_PREFIX = 'app';
13
12
  /**
14
13
  * This method is specifically for reading JSON files in a Tree
@@ -81,44 +80,11 @@ function serializeJson(json) {
81
80
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
81
  function updateWorkspaceInTree(callback) {
83
82
  return (host, context) => {
84
- const path = getWorkspacePath(host);
83
+ const path = 'angular.json';
85
84
  host.overwrite(path, serializeJson(callback(readJsonInTree(host, path), context, host)));
86
85
  return host;
87
86
  };
88
87
  }
89
- function readProjectConfiguration(tree, projectName) {
90
- const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
91
- return angularJSON.projects[projectName];
92
- }
93
- function updateProjectConfiguration(tree, projectName, projectConfig) {
94
- const angularJSON = (0, devkit_imports_1.readJson)(tree, 'angular.json');
95
- angularJSON.projects[projectName] = projectConfig;
96
- (0, devkit_imports_1.writeJson)(tree, 'angular.json', angularJSON);
97
- }
98
- function addESLintTargetToProject__NX(tree, projectName, targetName) {
99
- const existingProjectConfig = readProjectConfiguration(tree, projectName);
100
- let lintFilePatternsRoot = '';
101
- // Default Angular CLI project at the root of the workspace
102
- if (existingProjectConfig.root === '') {
103
- lintFilePatternsRoot = existingProjectConfig.sourceRoot || 'src';
104
- }
105
- else {
106
- lintFilePatternsRoot = existingProjectConfig.root;
107
- }
108
- const eslintTargetConfig = {
109
- builder: '@angular-eslint/builder:lint',
110
- options: {
111
- lintFilePatterns: [
112
- `${lintFilePatternsRoot}/**/*.ts`,
113
- `${lintFilePatternsRoot}/**/*.html`,
114
- ],
115
- },
116
- };
117
- existingProjectConfig.architect = existingProjectConfig.architect || {};
118
- existingProjectConfig.architect[targetName] = eslintTargetConfig;
119
- updateProjectConfiguration(tree, projectName, existingProjectConfig);
120
- }
121
- exports.addESLintTargetToProject__NX = addESLintTargetToProject__NX;
122
88
  function addESLintTargetToProject(projectName, targetName) {
123
89
  return updateWorkspaceInTree((workspaceJson) => {
124
90
  const existingProjectConfig = workspaceJson.projects[projectName];
@@ -139,6 +105,7 @@ function addESLintTargetToProject(projectName, targetName) {
139
105
  ],
140
106
  },
141
107
  };
108
+ existingProjectConfig.architect = existingProjectConfig.architect || {};
142
109
  existingProjectConfig.architect[targetName] = eslintTargetConfig;
143
110
  return workspaceJson;
144
111
  });
@@ -267,57 +234,6 @@ function createProjectESLintConfig(projectRoot, projectType, prefix, setParserOp
267
234
  ],
268
235
  };
269
236
  }
270
- function createProjectESLintConfig__NX(projectRoot, projectType, prefix, setParserOptionsProject, hasE2e) {
271
- return {
272
- extends: `${(0, devkit_imports_1.offsetFromRoot)(projectRoot)}.eslintrc.json`,
273
- ignorePatterns: ['!**/*'],
274
- overrides: [
275
- {
276
- files: ['*.ts'],
277
- ...(setParserOptionsProject
278
- ? {
279
- parserOptions: {
280
- project: setESLintProjectBasedOnProjectType(projectRoot, projectType, hasE2e),
281
- },
282
- }
283
- : null),
284
- rules: {
285
- '@angular-eslint/directive-selector': [
286
- 'error',
287
- { type: 'attribute', prefix, style: 'camelCase' },
288
- ],
289
- '@angular-eslint/component-selector': [
290
- 'error',
291
- { type: 'element', prefix, style: 'kebab-case' },
292
- ],
293
- },
294
- },
295
- {
296
- files: ['*.html'],
297
- rules: {},
298
- },
299
- ],
300
- };
301
- }
302
- function createESLintConfigForProject__NX(tree, projectName, setParserOptionsProject) {
303
- const existingProjectConfig = readProjectConfiguration(tree, projectName);
304
- const targets = existingProjectConfig.architect || existingProjectConfig.targets;
305
- const { root: projectRoot, projectType, prefix } = existingProjectConfig;
306
- const hasE2e = !!targets?.e2e;
307
- /**
308
- * If the root is an empty string it must be the initial project created at the
309
- * root by the Angular CLI's workspace schematic
310
- */
311
- if (projectRoot === '') {
312
- return createRootESLintConfigFile__NX(tree, prefix || DEFAULT_PREFIX);
313
- }
314
- // If, for whatever reason, the root .eslintrc.json doesn't exist yet, create it
315
- if (!tree.exists('.eslintrc.json')) {
316
- createRootESLintConfigFile__NX(tree, prefix || DEFAULT_PREFIX);
317
- }
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
- }
320
- exports.createESLintConfigForProject__NX = createESLintConfigForProject__NX;
321
237
  function createESLintConfigForProject(projectName, setParserOptionsProject) {
322
238
  return (tree) => {
323
239
  const angularJSON = readJsonInTree(tree, 'angular.json');
@@ -343,7 +259,7 @@ exports.createESLintConfigForProject = createESLintConfigForProject;
343
259
  function createRootESLintConfigFile(projectName) {
344
260
  return (tree) => {
345
261
  const angularJSON = readJsonInTree(tree, getWorkspacePath(tree));
346
- let lintPrefix = null;
262
+ let lintPrefix = DEFAULT_PREFIX;
347
263
  if (angularJSON.projects?.[projectName]) {
348
264
  const { prefix } = angularJSON.projects[projectName];
349
265
  lintPrefix = prefix;
@@ -351,9 +267,6 @@ function createRootESLintConfigFile(projectName) {
351
267
  return updateJsonInTree('.eslintrc.json', () => createRootESLintConfig(lintPrefix));
352
268
  };
353
269
  }
354
- function createRootESLintConfigFile__NX(tree, prefix) {
355
- return (0, devkit_imports_1.writeJson)(tree, '.eslintrc.json', createRootESLintConfig(prefix));
356
- }
357
270
  function sortObjectByKeys(obj) {
358
271
  return Object.keys(obj)
359
272
  .sort()
@@ -365,22 +278,6 @@ function sortObjectByKeys(obj) {
365
278
  }, {});
366
279
  }
367
280
  exports.sortObjectByKeys = sortObjectByKeys;
368
- /**
369
- * To make certain schematic usage conversion more ergonomic, if the user does not specify a project
370
- * and only has a single project in their angular.json we will just go ahead and use that one.
371
- */
372
- function determineTargetProjectName__NX(tree, maybeProject) {
373
- if (maybeProject) {
374
- return maybeProject;
375
- }
376
- const workspaceJson = (0, devkit_imports_1.readJson)(tree, 'angular.json');
377
- const projects = Object.keys(workspaceJson.projects);
378
- if (projects.length === 1) {
379
- return projects[0];
380
- }
381
- return null;
382
- }
383
- exports.determineTargetProjectName__NX = determineTargetProjectName__NX;
384
281
  /**
385
282
  * To make certain schematic usage conversion more ergonomic, if the user does not specify a project
386
283
  * and only has a single project in their angular.json we will just go ahead and use that one.
@@ -389,7 +286,7 @@ function determineTargetProjectName(tree, maybeProject) {
389
286
  if (maybeProject) {
390
287
  return maybeProject;
391
288
  }
392
- const workspaceJson = readJsonInTree(tree, getWorkspacePath(tree));
289
+ const workspaceJson = readJsonInTree(tree, 'angular.json');
393
290
  const projects = Object.keys(workspaceJson.projects);
394
291
  if (projects.length === 1) {
395
292
  return projects[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/schematics",
3
- "version": "17.5.3-alpha.0",
3
+ "version": "17.5.3",
4
4
  "description": "Angular Schematics for angular-eslint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -34,11 +34,9 @@
34
34
  "save": "devDependencies"
35
35
  },
36
36
  "dependencies": {
37
- "@angular-eslint/eslint-plugin": "17.5.3-alpha.0",
38
- "@angular-eslint/eslint-plugin-template": "17.5.3-alpha.0",
39
- "@nx/devkit": "^17.2.8 || ^18.0.0 || ^19.0.0",
37
+ "@angular-eslint/eslint-plugin": "17.5.3",
38
+ "@angular-eslint/eslint-plugin-template": "17.5.3",
40
39
  "ignore": "5.3.1",
41
- "nx": "^17.2.8 || ^18.0.0 || ^19.0.0",
42
40
  "strip-json-comments": "3.1.1",
43
41
  "tmp": "0.2.3"
44
42
  },