@angular-eslint/schematics 13.1.1-alpha.8 → 13.2.1-alpha.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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [13.2.0](https://github.com/angular-eslint/angular-eslint/compare/v13.1.0...v13.2.0) (2022-04-03)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **schematics:** support more permutations of ng-add ([#970](https://github.com/angular-eslint/angular-eslint/issues/970)) ([0bf549b](https://github.com/angular-eslint/angular-eslint/commit/0bf549b758a6921ff602136d9872e10bb924baf3))
11
+
6
12
  # [13.1.0](https://github.com/angular-eslint/angular-eslint/compare/v13.0.1...v13.1.0) (2022-02-13)
7
13
 
8
14
  ### Bug Fixes
@@ -3,7 +3,7 @@
3
3
  "$id": "SchematicsAngularApp",
4
4
  "title": "Angular Application Options Schema",
5
5
  "type": "object",
6
- "description": "Generates a new basic app definition in the \"projects\" subfolder of the workspace.",
6
+ "description": "Generates a new basic application definition in the \"projects\" subfolder of the workspace.",
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
9
  "projectRoot": {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -62,8 +62,30 @@ function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
62
62
  if (!angularJson || !angularJson.projects) {
63
63
  return;
64
64
  }
65
- // Anything other than a single project, finish here as there is nothing more we can do automatically
65
+ /**
66
+ * If the workspace was created by passing `--create-application=false` to `ng new`
67
+ * then there will be an angular.json file with a projects object, but no projects
68
+ * within it.
69
+ *
70
+ * In this case we should still configure the root eslint config and set the default
71
+ * collection to use in angular.json.
72
+ */
66
73
  const projectNames = Object.keys(angularJson.projects);
74
+ if (projectNames.length === 0) {
75
+ return (0, schematics_1.chain)([
76
+ (0, utils_1.updateJsonInTree)('.eslintrc.json', () => (0, utils_1.createRootESLintConfig)(null, false)),
77
+ (0, utils_1.updateJsonInTree)('angular.json', (json) => {
78
+ json.cli = json.cli || {};
79
+ json.cli.defaultCollection = '@angular-eslint/schematics';
80
+ return json;
81
+ }),
82
+ ]);
83
+ }
84
+ /**
85
+ * The only other use-case we can reliably support for automatic configuration
86
+ * is the default case of having a single project in the workspace, so for anything
87
+ * else we bail at this point.
88
+ */
67
89
  if (projectNames.length !== 1) {
68
90
  return;
69
91
  }
@@ -81,7 +103,7 @@ function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
81
103
  We detected that you have a single project in your workspace and no existing linter wired up, so we are configuring ESLint for you automatically.
82
104
 
83
105
  Please see https://github.com/angular-eslint/angular-eslint for more information.
84
- `);
106
+ `.trimStart());
85
107
  return (0, schematics_1.chain)([
86
108
  (0, schematics_1.schematic)('add-eslint-to-project', {}),
87
109
  (0, utils_1.updateJsonInTree)('angular.json', (json) => {
package/dist/utils.js CHANGED
@@ -288,7 +288,13 @@ function createESLintConfigForProject(projectName) {
288
288
  if (projectRoot === '') {
289
289
  return createRootESLintConfigFile(projectName);
290
290
  }
291
- return updateJsonInTree((0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), () => createProjectESLintConfig(tree.root.path, projectRoot, projectType, prefix, hasE2e));
291
+ return (0, schematics_1.chain)([
292
+ // If, for whatever reason, the root .eslintrc.json doesn't exist yet, create it
293
+ tree.exists('.eslintrc.json')
294
+ ? () => undefined
295
+ : createRootESLintConfigFile(projectName),
296
+ updateJsonInTree((0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), () => createProjectESLintConfig(tree.root.path, projectRoot, projectType, prefix, hasE2e)),
297
+ ]);
292
298
  };
293
299
  }
294
300
  exports.createESLintConfigForProject = createESLintConfigForProject;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsAngularWorkspace",
3
+ "$id": "angular-eslint-workspace",
4
4
  "title": "Angular Workspace Options Schema",
5
5
  "type": "object",
6
6
  "properties": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/schematics",
3
- "version": "13.1.1-alpha.8+58e710e",
3
+ "version": "13.2.1-alpha.2+870f466",
4
4
  "description": "Angular Schematics for angular-eslint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -33,8 +33,8 @@
33
33
  "save": "devDependencies"
34
34
  },
35
35
  "dependencies": {
36
- "@angular-eslint/eslint-plugin": "13.1.1-alpha.8+58e710e",
37
- "@angular-eslint/eslint-plugin-template": "13.1.1-alpha.8+58e710e",
36
+ "@angular-eslint/eslint-plugin": "13.2.1-alpha.2+870f466",
37
+ "@angular-eslint/eslint-plugin-template": "13.2.1-alpha.2+870f466",
38
38
  "ignore": "5.2.0",
39
39
  "strip-json-comments": "3.1.1",
40
40
  "tmp": "0.2.1"
@@ -42,11 +42,11 @@
42
42
  "devDependencies": {
43
43
  "@types/tmp": "0.2.3",
44
44
  "@typescript-eslint/experimental-utils": "5.17.0",
45
- "eslint": "8.2.0",
45
+ "eslint": "8.12.0",
46
46
  "tslint-to-eslint-config": "2.4.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@angular/cli": ">= 13.0.0 < 14.0.0"
50
50
  },
51
- "gitHead": "58e710e4a264c6744e7a2bb207aa211307854863"
51
+ "gitHead": "870f4662f78a45e29e014ac4382b6701d00abb96"
52
52
  }