@angular-eslint/schematics 14.0.0-alpha.2 → 14.0.0

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,14 @@
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
+ # [14.0.0](https://github.com/angular-eslint/angular-eslint/compare/v13.5.0...v14.0.0) (2022-06-23)
7
+
8
+ ### Features
9
+
10
+ - update dependency eslint to v8.18.0 ([#1061](https://github.com/angular-eslint/angular-eslint/issues/1061)) ([6130377](https://github.com/angular-eslint/angular-eslint/commit/6130377ca9363a5a510093609031d9943755c63e))
11
+ - update typescript-eslint packages to v5.28.0 ([#1045](https://github.com/angular-eslint/angular-eslint/issues/1045)) ([9e8c340](https://github.com/angular-eslint/angular-eslint/commit/9e8c3406de716d1d5e7f45e06b06700af3861f65))
12
+ - update typescript-eslint packages to v5.29.0 ([#1063](https://github.com/angular-eslint/angular-eslint/issues/1063)) ([02856cb](https://github.com/angular-eslint/angular-eslint/commit/02856cbc6116491eaa634a3cbdcd38d6bffda64c))
13
+
6
14
  # [13.5.0](https://github.com/angular-eslint/angular-eslint/compare/v13.4.0...v13.5.0) (2022-06-12)
7
15
 
8
16
  **Note:** Version bump only for package @angular-eslint/schematics
@@ -58,14 +58,10 @@ E.g. npx ng g @angular-eslint/schematics:convert-tslint-to-eslint {{YOUR_PROJECT
58
58
  tree.delete((0, core_1.join)((0, core_1.normalize)(tree.root.path), 'tslint.json'));
59
59
  return (0, schematics_1.chain)([
60
60
  /**
61
- * Update the default schematics collection to @angular-eslint so that future projects within
61
+ * Update the schematicCollections to prefer @angular-eslint so that future projects within
62
62
  * the same workspace will also use ESLint
63
63
  */
64
- (0, utils_1.updateJsonInTree)((0, utils_1.getWorkspacePath)(tree), (json) => {
65
- json.cli = json.cli || {};
66
- json.cli.defaultCollection = '@angular-eslint/schematics';
67
- return json;
68
- }),
64
+ (0, utils_1.updateJsonInTree)((0, utils_1.getWorkspacePath)(tree), (json) => (0, utils_1.updateSchematicCollections)(json)),
69
65
  (0, utils_2.uninstallTSLintAndCodelyzer)(),
70
66
  ]);
71
67
  }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
5
+ const utils_1 = require("../../utils");
6
+ const dependencies_1 = require("../utils/dependencies");
7
+ const updatedTypeScriptESLintVersion = '5.29.0';
8
+ const updatedESLintVersion = '8.18.0';
9
+ function migration() {
10
+ return (0, schematics_1.chain)([
11
+ (0, dependencies_1.updateDependencies)([
12
+ {
13
+ packageName: '@typescript-eslint/eslint-plugin',
14
+ version: `^${updatedTypeScriptESLintVersion}`,
15
+ },
16
+ {
17
+ packageName: '@typescript-eslint/experimental-utils',
18
+ version: `^${updatedTypeScriptESLintVersion}`,
19
+ },
20
+ {
21
+ packageName: '@typescript-eslint/parser',
22
+ version: `^${updatedTypeScriptESLintVersion}`,
23
+ },
24
+ {
25
+ packageName: 'eslint',
26
+ version: `^${updatedESLintVersion}`,
27
+ },
28
+ ]),
29
+ (0, utils_1.updateJsonInTree)('angular.json', (json) => {
30
+ var _a;
31
+ // Migrate any workspaces which use the original defaultCollection (but only if set to `@angular-eslint/schematics`)
32
+ if (((_a = json.cli) === null || _a === void 0 ? void 0 : _a.defaultCollection) !== '@angular-eslint/schematics') {
33
+ return json;
34
+ }
35
+ return (0, utils_1.updateSchematicCollections)(json);
36
+ }),
37
+ // Migrate from @typescript-eslint/experimental-utils package name to @typescript-eslint/utils
38
+ (host, context) => (0, utils_1.updateJsonInTree)('package.json', (json) => {
39
+ var _a;
40
+ const devDep = (_a = json.devDependencies) === null || _a === void 0 ? void 0 : _a['@typescript-eslint/experimental-utils'];
41
+ if (!devDep) {
42
+ return json;
43
+ }
44
+ json.devDependencies['@typescript-eslint/utils'] = devDep;
45
+ delete json.devDependencies['@typescript-eslint/experimental-utils'];
46
+ json.devDependencies = (0, utils_1.sortObjectByKeys)(json.devDependencies);
47
+ host.overwrite('package.json', JSON.stringify(json, null, 2));
48
+ context.addTask(new tasks_1.NodePackageInstallTask());
49
+ return json;
50
+ }),
51
+ ]);
52
+ }
53
+ exports.default = migration;
@@ -25,6 +25,11 @@
25
25
  "version": "13.0.0-alpha.0",
26
26
  "description": "Updates @angular-eslint to v13",
27
27
  "factory": "./migrations/update-13-0-0/update-13-0-0"
28
+ },
29
+ "update-14-0-0": {
30
+ "version": "14.0.0-alpha.0",
31
+ "description": "Updates @angular-eslint to v14",
32
+ "factory": "./migrations/update-14-0-0/update-14-0-0"
28
33
  }
29
34
  }
30
35
  }
@@ -41,7 +41,7 @@ function addAngularESLintPackages() {
41
41
  /**
42
42
  * @typescript-eslint packages
43
43
  */
44
- const typescriptESLintVersion = packageJSON.devDependencies['@typescript-eslint/experimental-utils'];
44
+ const typescriptESLintVersion = packageJSON.devDependencies['@typescript-eslint/utils'];
45
45
  json.devDependencies['@typescript-eslint/eslint-plugin'] =
46
46
  typescriptESLintVersion;
47
47
  json.devDependencies['@typescript-eslint/parser'] = typescriptESLintVersion;
@@ -67,18 +67,14 @@ function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
67
67
  * then there will be an angular.json file with a projects object, but no projects
68
68
  * within it.
69
69
  *
70
- * In this case we should still configure the root eslint config and set the default
71
- * collection to use in angular.json.
70
+ * In this case we should still configure the root eslint config and set the
71
+ * schematicCollections to use in angular.json.
72
72
  */
73
73
  const projectNames = Object.keys(angularJson.projects);
74
74
  if (projectNames.length === 0) {
75
75
  return (0, schematics_1.chain)([
76
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
- }),
77
+ (0, utils_1.updateJsonInTree)('angular.json', (json) => (0, utils_1.updateSchematicCollections)(json)),
82
78
  ]);
83
79
  }
84
80
  /**
@@ -106,11 +102,7 @@ Please see https://github.com/angular-eslint/angular-eslint for more information
106
102
  `.trimStart());
107
103
  return (0, schematics_1.chain)([
108
104
  (0, schematics_1.schematic)('add-eslint-to-project', {}),
109
- (0, utils_1.updateJsonInTree)('angular.json', (json) => {
110
- json.cli = json.cli || {};
111
- json.cli.defaultCollection = '@angular-eslint/schematics';
112
- return json;
113
- }),
105
+ (0, utils_1.updateJsonInTree)('angular.json', (json) => (0, utils_1.updateSchematicCollections)(json)),
114
106
  ]);
115
107
  };
116
108
  }
package/dist/utils.js CHANGED
@@ -3,7 +3,7 @@ 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.determineTargetProjectHasE2E = exports.determineTargetProjectName = exports.sortObjectByKeys = exports.removeTSLintJSONForProject = exports.createESLintConfigForProject = exports.createRootESLintConfig = exports.setESLintProjectBasedOnProjectType = exports.visitNotIgnoredFiles = exports.addESLintTargetToProject = exports.updateWorkspaceInTree = exports.offsetFromRoot = exports.getProjectConfig = exports.isTSLintUsedInWorkspace = exports.getTargetsConfigFromProject = exports.getWorkspacePath = exports.updateJsonInTree = exports.readJsonInTree = void 0;
6
+ exports.updateSchematicCollections = exports.determineTargetProjectHasE2E = exports.determineTargetProjectName = exports.sortObjectByKeys = exports.removeTSLintJSONForProject = exports.createESLintConfigForProject = exports.createRootESLintConfig = exports.setESLintProjectBasedOnProjectType = exports.visitNotIgnoredFiles = exports.addESLintTargetToProject = exports.updateWorkspaceInTree = exports.offsetFromRoot = exports.getProjectConfig = exports.isTSLintUsedInWorkspace = exports.getTargetsConfigFromProject = exports.getWorkspacePath = 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"));
@@ -357,3 +357,18 @@ angularJSON, projectName) {
357
357
  return !!((_a = getTargetsConfigFromProject(angularJSON.projects[projectName])) === null || _a === void 0 ? void 0 : _a.e2e);
358
358
  }
359
359
  exports.determineTargetProjectHasE2E = determineTargetProjectHasE2E;
360
+ /**
361
+ * See `schematicCollections` docs here:
362
+ * https://github.com/angular/angular-cli/blob/8431b3f0769b5f95b9e13807a09293d820c4b017/docs/specifications/schematic-collections-config.md
363
+ */
364
+ function updateSchematicCollections(angularJson) {
365
+ angularJson.cli = angularJson.cli || {};
366
+ angularJson.cli.schematicCollections =
367
+ angularJson.cli.schematicCollections || [];
368
+ // The first matching schematic will be used, so we unshift rather than push
369
+ angularJson.cli.schematicCollections.unshift('@angular-eslint/schematics');
370
+ // Delete old defaultCollection property if applicable
371
+ delete angularJson.cli.defaultCollection;
372
+ return angularJson;
373
+ }
374
+ exports.updateSchematicCollections = updateSchematicCollections;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/schematics",
3
- "version": "14.0.0-alpha.2",
3
+ "version": "14.0.0",
4
4
  "description": "Angular Schematics for angular-eslint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -33,20 +33,20 @@
33
33
  "save": "devDependencies"
34
34
  },
35
35
  "dependencies": {
36
- "@angular-eslint/eslint-plugin": "14.0.0-alpha.2",
37
- "@angular-eslint/eslint-plugin-template": "14.0.0-alpha.2",
36
+ "@angular-eslint/eslint-plugin": "14.0.0",
37
+ "@angular-eslint/eslint-plugin-template": "14.0.0",
38
38
  "ignore": "5.2.0",
39
39
  "strip-json-comments": "3.1.1",
40
40
  "tmp": "0.2.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/tmp": "0.2.3",
44
- "@typescript-eslint/experimental-utils": "5.27.1",
45
- "eslint": "8.17.0",
44
+ "@typescript-eslint/utils": "5.29.0",
45
+ "eslint": "8.18.0",
46
46
  "tslint-to-eslint-config": "2.4.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@angular/cli": ">= 14.0.0 < 15.0.0"
50
50
  },
51
- "gitHead": "67044dd79280a779a0d5614350f5fa0308399148"
51
+ "gitHead": "676699f28a4ecaf41f8c65418d0bdc9c973714aa"
52
52
  }