@angular-eslint/schematics 12.7.1-alpha.0 → 13.0.1-alpha.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,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.0.0](https://github.com/angular-eslint/angular-eslint/compare/v12.7.0...v13.0.0) (2021-11-18)
7
+
8
+ ### Features
9
+
10
+ - angular-eslint v13 ([#780](https://github.com/angular-eslint/angular-eslint/issues/780)) ([f7ce631](https://github.com/angular-eslint/angular-eslint/commit/f7ce631524dd7834a422a5ac93a4c0534f9f23fa))
11
+
6
12
  # [12.7.0](https://github.com/angular-eslint/angular-eslint/compare/v12.6.1...v12.7.0) (2021-11-18)
7
13
 
8
14
  ### Bug Fixes
@@ -4,7 +4,7 @@ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../utils");
5
5
  function addESLintToProject(schema) {
6
6
  return (tree) => {
7
- const projectName = utils_1.determineTargetProjectName(tree, schema.project);
7
+ const projectName = (0, utils_1.determineTargetProjectName)(tree, schema.project);
8
8
  if (!projectName) {
9
9
  throw new Error('\n' +
10
10
  `
@@ -13,11 +13,11 @@ Error: You must specify a project to add ESLint to because you have multiple pro
13
13
  E.g. npx ng g @angular-eslint/schematics:add-eslint-to-project {{YOUR_PROJECT_NAME_GOES_HERE}}
14
14
  `.trim());
15
15
  }
16
- return schematics_1.chain([
16
+ return (0, schematics_1.chain)([
17
17
  // Set the lint builder and config in angular.json
18
- utils_1.addESLintTargetToProject(projectName, 'lint'),
18
+ (0, utils_1.addESLintTargetToProject)(projectName, 'lint'),
19
19
  // Create the ESLint config file for the project
20
- utils_1.createESLintConfigForProject(projectName),
20
+ (0, utils_1.createESLintConfigForProject)(projectName),
21
21
  ]);
22
22
  };
23
23
  }
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../utils");
5
5
  function eslintRelatedChanges(options) {
6
- return schematics_1.chain([
6
+ return (0, schematics_1.chain)([
7
7
  // Update the lint builder and config in angular.json
8
- utils_1.addESLintTargetToProject(options.name, 'lint'),
8
+ (0, utils_1.addESLintTargetToProject)(options.name, 'lint'),
9
9
  // Create the ESLint config file for the project
10
- utils_1.createESLintConfigForProject(options.name),
10
+ (0, utils_1.createESLintConfigForProject)(options.name),
11
11
  // Delete the TSLint config file for the project
12
- utils_1.removeTSLintJSONForProject(options.name),
12
+ (0, utils_1.removeTSLintJSONForProject)(options.name),
13
13
  ]);
14
14
  }
15
15
  function default_1(options) {
16
16
  return (host, context) => {
17
- return schematics_1.chain([
18
- schematics_1.externalSchematic('@schematics/angular', 'application', options),
17
+ return (0, schematics_1.chain)([
18
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'application', options),
19
19
  eslintRelatedChanges(options),
20
20
  ])(host, context);
21
21
  };
@@ -33,7 +33,7 @@
33
33
  "x-user-analytics": 10
34
34
  },
35
35
  "viewEncapsulation": {
36
- "description": "The view encapsulation strategy to use in the new app.",
36
+ "description": "The view encapsulation strategy to use in the new application.",
37
37
  "enum": ["Emulated", "None", "ShadowDom"],
38
38
  "type": "string",
39
39
  "x-user-analytics": 11
@@ -101,23 +101,11 @@
101
101
  "type": "boolean",
102
102
  "default": false
103
103
  },
104
- "lintFix": {
105
- "type": "boolean",
106
- "description": "Apply lint fixes after generating the application.",
107
- "x-user-analytics": 15,
108
- "x-deprecated": "Use \"ng lint --fix\" directly instead."
109
- },
110
104
  "strict": {
111
105
  "description": "Creates an application with stricter bundle budgets settings.",
112
106
  "type": "boolean",
113
107
  "default": true,
114
108
  "x-user-analytics": 7
115
- },
116
- "legacyBrowsers": {
117
- "type": "boolean",
118
- "description": "Add support for legacy browsers like Internet Explorer using differential loading.",
119
- "default": false,
120
- "x-deprecated": "Legacy browsers support is deprecated since version 12. For more information, see https://angular.io/guide/browser-support"
121
109
  }
122
110
  },
123
111
  "required": ["name"]
@@ -26,8 +26,8 @@ function getTslintToEslintConfigLibrary(context) {
26
26
  * in their node_modules, we dynamically install and uninstall the library as part of the conversion
27
27
  * process.
28
28
  */
29
- const tempDir = tmp_1.dirSync().name;
30
- child_process_1.execSync(`npm i -D tslint-to-eslint-config@${tslintToEslintConfigVersion}`, {
29
+ const tempDir = (0, tmp_1.dirSync)().name;
30
+ (0, child_process_1.execSync)(`npm i -D tslint-to-eslint-config@${tslintToEslintConfigVersion}`, {
31
31
  cwd: tempDir,
32
32
  stdio: 'ignore',
33
33
  });
@@ -92,7 +92,7 @@ function convertTSLintDisableCommentsForProject(projectName) {
92
92
  * conversion schematic).
93
93
  */
94
94
  const { convertFileComments } = getTslintToEslintConfigLibrary(context);
95
- const workspaceJson = utils_1.readJsonInTree(tree, 'angular.json');
95
+ const workspaceJson = (0, utils_1.readJsonInTree)(tree, 'angular.json');
96
96
  const existingProjectConfig = workspaceJson.projects[projectName];
97
97
  let pathRoot = '';
98
98
  // Default Angular CLI project at the root of the workspace
@@ -102,7 +102,7 @@ function convertTSLintDisableCommentsForProject(projectName) {
102
102
  else {
103
103
  pathRoot = existingProjectConfig.root;
104
104
  }
105
- return utils_1.visitNotIgnoredFiles((filePath, host) => {
105
+ return (0, utils_1.visitNotIgnoredFiles)((filePath, host) => {
106
106
  if (!filePath.endsWith('.ts')) {
107
107
  return;
108
108
  }
@@ -113,7 +113,7 @@ function convertTSLintDisableCommentsForProject(projectName) {
113
113
  }
114
114
  const updatedFileContent = convertFileComments({ fileContent, filePath });
115
115
  host.overwrite(filePath, updatedFileContent);
116
- }, core_1.normalize(pathRoot));
116
+ }, (0, core_1.normalize)(pathRoot));
117
117
  };
118
118
  }
119
119
  exports.convertTSLintDisableCommentsForProject = convertTSLintDisableCommentsForProject;
@@ -18,7 +18,7 @@ function convert(schema) {
18
18
  if (tree.exists('tsconfig.base.json')) {
19
19
  throw new Error('\nError: Angular CLI v10.1.0 and later (and no `tsconfig.base.json`) is required in order to run this schematic. Please update your workspace and try again.\n');
20
20
  }
21
- const projectName = utils_1.determineTargetProjectName(tree, schema.project);
21
+ const projectName = (0, utils_1.determineTargetProjectName)(tree, schema.project);
22
22
  if (!projectName) {
23
23
  throw new Error('\n' +
24
24
  `
@@ -27,46 +27,46 @@ Error: You must specify a project to convert because you have multiple projects
27
27
  E.g. npx ng g @angular-eslint/schematics:convert-tslint-to-eslint {{YOUR_PROJECT_NAME_GOES_HERE}}
28
28
  `.trim());
29
29
  }
30
- const { root: projectRoot, projectType } = utils_1.getProjectConfig(tree, projectName);
30
+ const { root: projectRoot, projectType } = (0, utils_1.getProjectConfig)(tree, projectName);
31
31
  // Default Angular CLI project at the root of the workspace
32
32
  const isRootAngularProject = projectRoot === '';
33
33
  // May or may not exist yet depending on if this is the root project, or a later one from projects/
34
- const rootESLintrcJsonPath = core_1.join(core_1.normalize(tree.root.path), '.eslintrc.json');
34
+ const rootESLintrcJsonPath = (0, core_1.join)((0, core_1.normalize)(tree.root.path), '.eslintrc.json');
35
35
  // Already exists, will be converted
36
- const projectTSLintJsonPath = core_1.join(core_1.normalize(projectRoot), 'tslint.json');
37
- return schematics_1.chain([
36
+ const projectTSLintJsonPath = (0, core_1.join)((0, core_1.normalize)(projectRoot), 'tslint.json');
37
+ return (0, schematics_1.chain)([
38
38
  // Overwrite the "lint" target directly for the selected project in the angular.json
39
- utils_1.addESLintTargetToProject(projectName, 'lint'),
39
+ (0, utils_1.addESLintTargetToProject)(projectName, 'lint'),
40
40
  ensureRootESLintConfig(schema, tree, projectName, rootESLintrcJsonPath),
41
- convert_to_eslint_config_1.convertTSLintDisableCommentsForProject(projectName),
41
+ (0, convert_to_eslint_config_1.convertTSLintDisableCommentsForProject)(projectName),
42
42
  isRootAngularProject || schema.ignoreExistingTslintConfig
43
- ? schematics_1.noop()
43
+ ? (0, schematics_1.noop)()
44
44
  : removeExtendsFromProjectTSLintConfigBeforeConverting(tree, projectTSLintJsonPath),
45
45
  isRootAngularProject
46
- ? schematics_1.noop()
46
+ ? (0, schematics_1.noop)()
47
47
  : schema.ignoreExistingTslintConfig
48
- ? schematics_1.chain([
48
+ ? (0, schematics_1.chain)([
49
49
  // Create the latest recommended ESLint config file for the project
50
- utils_1.createESLintConfigForProject(projectName),
50
+ (0, utils_1.createESLintConfigForProject)(projectName),
51
51
  // Delete the TSLint config file for the project
52
- utils_1.removeTSLintJSONForProject(projectName),
52
+ (0, utils_1.removeTSLintJSONForProject)(projectName),
53
53
  ])
54
54
  : convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSLintJsonPath, rootESLintrcJsonPath),
55
55
  function cleanUpTSLintIfNoLongerInUse(tree) {
56
56
  if (schema.removeTslintIfNoMoreTslintTargets &&
57
- !utils_1.isTSLintUsedInWorkspace(tree)) {
58
- tree.delete(core_1.join(core_1.normalize(tree.root.path), 'tslint.json'));
59
- return schematics_1.chain([
57
+ !(0, utils_1.isTSLintUsedInWorkspace)(tree)) {
58
+ tree.delete((0, core_1.join)((0, core_1.normalize)(tree.root.path), 'tslint.json'));
59
+ return (0, schematics_1.chain)([
60
60
  /**
61
61
  * Update the default schematics collection to @angular-eslint so that future projects within
62
62
  * the same workspace will also use ESLint
63
63
  */
64
- utils_1.updateJsonInTree(utils_1.getWorkspacePath(tree), (json) => {
64
+ (0, utils_1.updateJsonInTree)((0, utils_1.getWorkspacePath)(tree), (json) => {
65
65
  json.cli = json.cli || {};
66
66
  json.cli.defaultCollection = '@angular-eslint/schematics';
67
67
  return json;
68
68
  }),
69
- utils_2.uninstallTSLintAndCodelyzer(),
69
+ (0, utils_2.uninstallTSLintAndCodelyzer)(),
70
70
  ]);
71
71
  }
72
72
  return undefined;
@@ -88,7 +88,7 @@ exports.default = convert;
88
88
  function ensureRootESLintConfig(schema, tree, projectName, rootESLintrcJsonPath) {
89
89
  const hasExistingRootESLintrcConfig = tree.exists(rootESLintrcJsonPath);
90
90
  if (hasExistingRootESLintrcConfig) {
91
- return schematics_1.noop();
91
+ return (0, schematics_1.noop)();
92
92
  }
93
93
  /**
94
94
  * When ignoreExistingTslintConfig is set, Do not perform a conversion of the root
@@ -96,9 +96,9 @@ function ensureRootESLintConfig(schema, tree, projectName, rootESLintrcJsonPath)
96
96
  * recommended ESLint config.
97
97
  */
98
98
  if (schema.ignoreExistingTslintConfig) {
99
- const workspaceJson = utils_1.readJsonInTree(tree, utils_1.getWorkspacePath(tree));
99
+ const workspaceJson = (0, utils_1.readJsonInTree)(tree, (0, utils_1.getWorkspacePath)(tree));
100
100
  const prefix = workspaceJson.projects[projectName].prefix || 'app';
101
- return utils_1.updateJsonInTree(rootESLintrcJsonPath, () => ({
101
+ return (0, utils_1.updateJsonInTree)(rootESLintrcJsonPath, () => ({
102
102
  root: true,
103
103
  // Each additional project is linted independently
104
104
  ignorePatterns: ['projects/**/*'],
@@ -144,8 +144,8 @@ function ensureRootESLintConfig(schema, tree, projectName, rootESLintrcJsonPath)
144
144
  }
145
145
  function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPath) {
146
146
  return async (tree, context) => {
147
- const rawRootTSLintJson = utils_1.readJsonInTree(tree, rootTSLintJsonPath);
148
- const convertToESLintConfig = convert_to_eslint_config_1.createConvertToESLintConfig(context);
147
+ const rawRootTSLintJson = (0, utils_1.readJsonInTree)(tree, rootTSLintJsonPath);
148
+ const convertToESLintConfig = (0, convert_to_eslint_config_1.createConvertToESLintConfig)(context);
149
149
  const convertedRoot = await convertToESLintConfig('tslint.json', rawRootTSLintJson);
150
150
  const convertedRootESLintConfig = convertedRoot.convertedESLintConfig;
151
151
  warnInCaseOfUnconvertedRules(context, rootTSLintJsonPath, convertedRoot.unconvertedTSLintRules);
@@ -179,7 +179,7 @@ function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPat
179
179
  ],
180
180
  },
181
181
  ]);
182
- utils_2.updateArrPropAndRemoveDuplication(convertedRootESLintConfig, {
182
+ (0, utils_2.updateArrPropAndRemoveDuplication)(convertedRootESLintConfig, {
183
183
  /**
184
184
  * For now, extending from these is too different to what the CLI ships with today, so
185
185
  * we remove them from the converted results. We should look to move towards extending
@@ -202,7 +202,7 @@ function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPat
202
202
  eslintPluginConfigNgCliCompatFormattingAddOn,
203
203
  ]);
204
204
  const { codeRules, templateRules } = separateCodeAndTemplateRules(convertedRootESLintConfig);
205
- utils_2.updateObjPropAndRemoveDuplication({ rules: templateRules }, eslintPluginTemplateConfigRecommended, 'rules', false);
205
+ (0, utils_2.updateObjPropAndRemoveDuplication)({ rules: templateRules }, eslintPluginTemplateConfigRecommended, 'rules', false);
206
206
  convertedRootESLintConfig.root = true;
207
207
  // Each additional project is linted independently
208
208
  convertedRootESLintConfig.ignorePatterns = ['projects/**/*'];
@@ -235,8 +235,8 @@ function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPat
235
235
  delete convertedRootESLintConfig.rules;
236
236
  delete convertedRootESLintConfig.plugins;
237
237
  delete convertedRootESLintConfig.extends;
238
- return schematics_1.chain([
239
- utils_2.ensureESLintPluginsAreInstalled(Array.from(new Set([
238
+ return (0, schematics_1.chain)([
239
+ (0, utils_2.ensureESLintPluginsAreInstalled)(Array.from(new Set([
240
240
  /**
241
241
  * These three plugins are needed for the ng-cli-compat config
242
242
  */
@@ -246,15 +246,15 @@ function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPat
246
246
  ...convertedRoot.ensureESLintPlugins,
247
247
  ]))),
248
248
  // Create the .eslintrc.json file in the tree using the finalized config
249
- utils_1.updateJsonInTree(rootESLintrcJsonPath, () => convertedRootESLintConfig),
249
+ (0, utils_1.updateJsonInTree)(rootESLintrcJsonPath, () => convertedRootESLintConfig),
250
250
  ]);
251
251
  };
252
252
  }
253
253
  function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSLintJsonPath, rootESLintrcJsonPath) {
254
254
  return async (tree, context) => {
255
- const rawProjectTSLintJson = utils_1.readJsonInTree(tree, projectTSLintJsonPath);
256
- const rawRootESLintrcJson = utils_1.readJsonInTree(tree, rootESLintrcJsonPath);
257
- const convertToESLintConfig = convert_to_eslint_config_1.createConvertToESLintConfig(context);
255
+ const rawProjectTSLintJson = (0, utils_1.readJsonInTree)(tree, projectTSLintJsonPath);
256
+ const rawRootESLintrcJson = (0, utils_1.readJsonInTree)(tree, rootESLintrcJsonPath);
257
+ const convertToESLintConfig = (0, convert_to_eslint_config_1.createConvertToESLintConfig)(context);
258
258
  const convertedProject = await convertToESLintConfig(projectTSLintJsonPath, rawProjectTSLintJson);
259
259
  const convertedProjectESLintConfig = convertedProject.convertedESLintConfig;
260
260
  warnInCaseOfUnconvertedRules(context, projectTSLintJsonPath, convertedProject.unconvertedTSLintRules);
@@ -289,7 +289,7 @@ function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSL
289
289
  ],
290
290
  },
291
291
  ]);
292
- utils_2.updateArrPropAndRemoveDuplication(convertedProjectESLintConfig, {
292
+ (0, utils_2.updateArrPropAndRemoveDuplication)(convertedProjectESLintConfig, {
293
293
  /**
294
294
  * For now, extending from these is too different to what the CLI ships with today, so
295
295
  * we remove them from the converted results. We should look to move towards extending
@@ -314,18 +314,18 @@ function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSL
314
314
  rawRootESLintrcJson,
315
315
  ]);
316
316
  const { codeRules, templateRules } = separateCodeAndTemplateRules(convertedProjectESLintConfig);
317
- utils_2.updateObjPropAndRemoveDuplication({ rules: templateRules }, eslintPluginTemplateConfigRecommended, 'rules', false);
317
+ (0, utils_2.updateObjPropAndRemoveDuplication)({ rules: templateRules }, eslintPluginTemplateConfigRecommended, 'rules', false);
318
318
  const convertedExtends = convertedProjectESLintConfig.extends;
319
319
  delete convertedProjectESLintConfig.extends;
320
320
  // Extend from the workspace's root config at the top level
321
- const relativeOffestToRootESLintrcJson = `${utils_1.offsetFromRoot(tree.root.path)}.eslintrc.json`;
321
+ const relativeOffestToRootESLintrcJson = `${(0, utils_1.offsetFromRoot)(tree.root.path)}.eslintrc.json`;
322
322
  convertedProjectESLintConfig.extends = relativeOffestToRootESLintrcJson;
323
323
  convertedProjectESLintConfig.ignorePatterns = ['!**/*'];
324
324
  convertedProjectESLintConfig.overrides = [
325
325
  {
326
326
  files: ['*.ts'],
327
327
  parserOptions: {
328
- project: utils_1.setESLintProjectBasedOnProjectType(projectRoot, projectType, true),
328
+ project: (0, utils_1.setESLintProjectBasedOnProjectType)(projectRoot, projectType, true),
329
329
  createDefaultProgram: true,
330
330
  },
331
331
  extends: convertedExtends || undefined,
@@ -343,10 +343,10 @@ function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSL
343
343
  // All applied in the .ts overrides block so should no longer be at the root of the config
344
344
  delete convertedProjectESLintConfig.rules;
345
345
  delete convertedProjectESLintConfig.plugins;
346
- return schematics_1.chain([
347
- utils_2.ensureESLintPluginsAreInstalled(convertedProject.ensureESLintPlugins),
346
+ return (0, schematics_1.chain)([
347
+ (0, utils_2.ensureESLintPluginsAreInstalled)(convertedProject.ensureESLintPlugins),
348
348
  // Create the .eslintrc.json file in the tree using the finalized config
349
- utils_1.updateJsonInTree(core_1.join(core_1.normalize(projectRoot), '.eslintrc.json'), () => convertedProjectESLintConfig),
349
+ (0, utils_1.updateJsonInTree)((0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), () => convertedProjectESLintConfig),
350
350
  // Delete the project's tslint.json, it's no longer needed
351
351
  (host) => host.delete(projectTSLintJsonPath),
352
352
  ]);
@@ -361,11 +361,11 @@ function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSL
361
361
  * TSLint as a library.
362
362
  */
363
363
  function removeExtendsFromProjectTSLintConfigBeforeConverting(tree, projectTSLintJsonPath) {
364
- return utils_1.updateJsonInTree(projectTSLintJsonPath, (json) => {
364
+ return (0, utils_1.updateJsonInTree)(projectTSLintJsonPath, (json) => {
365
365
  if (!json.extends) {
366
366
  return json;
367
367
  }
368
- const extendsFromRoot = `${utils_1.offsetFromRoot(tree.root.path)}tslint.json`;
368
+ const extendsFromRoot = `${(0, utils_1.offsetFromRoot)(tree.root.path)}tslint.json`;
369
369
  if (Array.isArray(json.extends) && json.extends.length) {
370
370
  json.extends = json.extends.filter((ext) => ext !== extendsFromRoot);
371
371
  }
@@ -471,17 +471,17 @@ function removeUndesiredRulesFromConfig(convertedConfig) {
471
471
  }
472
472
  function dedupeEnvAgainstConfigs(convertedConfig, otherConfigs) {
473
473
  otherConfigs.forEach((againstConfig) => {
474
- utils_2.updateObjPropAndRemoveDuplication(convertedConfig, againstConfig, 'env', true);
474
+ (0, utils_2.updateObjPropAndRemoveDuplication)(convertedConfig, againstConfig, 'env', true);
475
475
  });
476
476
  }
477
477
  function dedupeRulesAgainstConfigs(convertedConfig, otherConfigs) {
478
478
  otherConfigs.forEach((againstConfig) => {
479
- utils_2.updateObjPropAndRemoveDuplication(convertedConfig, againstConfig, 'rules', false);
479
+ (0, utils_2.updateObjPropAndRemoveDuplication)(convertedConfig, againstConfig, 'rules', false);
480
480
  });
481
481
  }
482
482
  function dedupePluginsAgainstConfigs(convertedConfig, otherConfigs) {
483
483
  otherConfigs.forEach((againstConfig) => {
484
- utils_2.updateArrPropAndRemoveDuplication(convertedConfig, againstConfig, 'plugins', true);
484
+ (0, utils_2.updateArrPropAndRemoveDuplication)(convertedConfig, againstConfig, 'plugins', true);
485
485
  });
486
486
  }
487
487
  /**
@@ -99,12 +99,12 @@ function uninstallTSLintAndCodelyzer() {
99
99
  if (json.devDependencies) {
100
100
  delete json.devDependencies['tslint'];
101
101
  delete json.devDependencies['codelyzer'];
102
- json.devDependencies = utils_1.sortObjectByKeys(json.devDependencies);
102
+ json.devDependencies = (0, utils_1.sortObjectByKeys)(json.devDependencies);
103
103
  }
104
104
  if (json.dependencies) {
105
105
  delete json.dependencies['tslint'];
106
106
  delete json.dependencies['codelyzer'];
107
- json.dependencies = utils_1.sortObjectByKeys(json.dependencies);
107
+ json.dependencies = (0, utils_1.sortObjectByKeys)(json.dependencies);
108
108
  }
109
109
  host.overwrite('package.json', JSON.stringify(json, null, 2));
110
110
  context.addTask(new tasks_1.NodePackageInstallTask());
@@ -8,19 +8,19 @@ function eslintRelatedChanges(options) {
8
8
  * provided the interactive CLI prompt will throw
9
9
  */
10
10
  const projectName = options.name;
11
- return schematics_1.chain([
11
+ return (0, schematics_1.chain)([
12
12
  // Update the lint builder and config in angular.json
13
- utils_1.addESLintTargetToProject(projectName, 'lint'),
13
+ (0, utils_1.addESLintTargetToProject)(projectName, 'lint'),
14
14
  // Create the ESLint config file for the project
15
- utils_1.createESLintConfigForProject(projectName),
15
+ (0, utils_1.createESLintConfigForProject)(projectName),
16
16
  // Delete the TSLint config file for the project
17
- utils_1.removeTSLintJSONForProject(projectName),
17
+ (0, utils_1.removeTSLintJSONForProject)(projectName),
18
18
  ]);
19
19
  }
20
20
  function default_1(options) {
21
21
  return (host, context) => {
22
- return schematics_1.chain([
23
- schematics_1.externalSchematic('@schematics/angular', 'library', options),
22
+ return (0, schematics_1.chain)([
23
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'library', options),
24
24
  eslintRelatedChanges(options),
25
25
  ])(host, context);
26
26
  };
@@ -43,12 +43,6 @@
43
43
  "type": "boolean",
44
44
  "default": false,
45
45
  "description": "Do not update \"tsconfig.json\" to add a path mapping for the new library. The path mapping is needed to use the library in an app, but can be disabled here to simplify development."
46
- },
47
- "lintFix": {
48
- "type": "boolean",
49
- "description": "Apply lint fixes after generating the library.",
50
- "x-user-analytics": 15,
51
- "x-deprecated": "Use \"ng lint --fix\" directly instead."
52
46
  }
53
47
  },
54
48
  "required": []
@@ -4,10 +4,8 @@ const schematics_1 = require("@angular-devkit/schematics");
4
4
  const utils_1 = require("../../utils");
5
5
  const dependencies_1 = require("../utils/dependencies");
6
6
  const updatedAngularESLintVersion = '^12.0.0';
7
- // eslint-disable-next-line @typescript-eslint/no-var-requires
8
- const packageJSON = require('../../../package.json');
9
- const updatedTypeScriptESLintVersion = packageJSON.devDependencies['@typescript-eslint/experimental-utils'];
10
- const updatedESLintVersion = packageJSON.devDependencies['eslint'];
7
+ const updatedTypeScriptESLintVersion = '4.28.2';
8
+ const updatedESLintVersion = '7.26.0';
11
9
  function migrateToAccessibilityLabelHasAssociatedControlSchema(rule) {
12
10
  if (!Array.isArray(rule) || rule.length !== 2)
13
11
  return;
@@ -37,12 +35,12 @@ function migrateToAccessibilityLabelHasAssociatedControlName(rules) {
37
35
  accessibilityLabelForRule;
38
36
  }
39
37
  function updateAccessibilityLabelFor() {
40
- return schematics_1.chain([
41
- utils_1.visitNotIgnoredFiles((filePath) => {
38
+ return (0, schematics_1.chain)([
39
+ (0, utils_1.visitNotIgnoredFiles)((filePath) => {
42
40
  if (!filePath.endsWith('.eslintrc.json')) {
43
41
  return;
44
42
  }
45
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
43
+ return (0, utils_1.updateJsonInTree)(filePath.toString(), (json) => {
46
44
  migrateFromAccessibilityLabelFor(json);
47
45
  return json;
48
46
  });
@@ -58,12 +56,12 @@ function addEqeqeqIfNeeded(rules) {
58
56
  rules['@angular-eslint/template/eqeqeq'] = 'error';
59
57
  }
60
58
  function addEqeqeq() {
61
- return schematics_1.chain([
62
- utils_1.visitNotIgnoredFiles((filePath) => {
59
+ return (0, schematics_1.chain)([
60
+ (0, utils_1.visitNotIgnoredFiles)((filePath) => {
63
61
  if (!filePath.endsWith('.eslintrc.json')) {
64
62
  return;
65
63
  }
66
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
64
+ return (0, utils_1.updateJsonInTree)(filePath.toString(), (json) => {
67
65
  var _a;
68
66
  addEqeqeqIfNeeded(json.rules);
69
67
  ((_a = json.overrides) !== null && _a !== void 0 ? _a : []).forEach((override) => addEqeqeqIfNeeded(override.rules));
@@ -73,8 +71,8 @@ function addEqeqeq() {
73
71
  ]);
74
72
  }
75
73
  function migration() {
76
- return schematics_1.chain([
77
- dependencies_1.updateDependencies([
74
+ return (0, schematics_1.chain)([
75
+ (0, dependencies_1.updateDependencies)([
78
76
  {
79
77
  packageName: '@angular-eslint/builder',
80
78
  version: updatedAngularESLintVersion,
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const dependencies_1 = require("../utils/dependencies");
5
+ const updatedTypeScriptESLintVersion = '5.3.0';
6
+ const updatedESLintVersion = '8.2.0';
7
+ function migration() {
8
+ return (0, schematics_1.chain)([
9
+ (0, dependencies_1.updateDependencies)([
10
+ {
11
+ packageName: '@typescript-eslint/eslint-plugin',
12
+ version: updatedTypeScriptESLintVersion,
13
+ },
14
+ {
15
+ packageName: '@typescript-eslint/experimental-utils',
16
+ version: updatedTypeScriptESLintVersion,
17
+ },
18
+ {
19
+ packageName: '@typescript-eslint/parser',
20
+ version: updatedTypeScriptESLintVersion,
21
+ },
22
+ {
23
+ packageName: 'eslint',
24
+ version: `^${updatedESLintVersion}`,
25
+ },
26
+ ]),
27
+ ]);
28
+ }
29
+ exports.default = migration;
@@ -11,7 +11,7 @@ function updateIfExists(deps, depName, updatedVersion) {
11
11
  }
12
12
  }
13
13
  function updateRelevantDependencies(host, context) {
14
- return utils_1.updateJsonInTree('package.json', (json) => {
14
+ return (0, utils_1.updateJsonInTree)('package.json', (json) => {
15
15
  /**
16
16
  * @angular-eslint
17
17
  */
@@ -42,12 +42,12 @@ function removeRuleFromESLintConfig(ruleName, config) {
42
42
  }
43
43
  function removeUsePipeDecoratorRule() {
44
44
  const ruleName = '@angular-eslint/use-pipe-decorator';
45
- return schematics_1.chain([
46
- utils_1.visitNotIgnoredFiles((filePath) => {
45
+ return (0, schematics_1.chain)([
46
+ (0, utils_1.visitNotIgnoredFiles)((filePath) => {
47
47
  if (!filePath.endsWith('.eslintrc.json')) {
48
48
  return;
49
49
  }
50
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
50
+ return (0, utils_1.updateJsonInTree)(filePath.toString(), (json) => {
51
51
  removeRuleFromESLintConfig(ruleName, json);
52
52
  return json;
53
53
  });
@@ -55,6 +55,6 @@ function removeUsePipeDecoratorRule() {
55
55
  ]);
56
56
  }
57
57
  function default_1() {
58
- return schematics_1.chain([updateRelevantDependencies, removeUsePipeDecoratorRule]);
58
+ return (0, schematics_1.chain)([updateRelevantDependencies, removeUsePipeDecoratorRule]);
59
59
  }
60
60
  exports.default = default_1;
@@ -10,7 +10,7 @@ function updateIfExists(deps, depName, updatedVersion) {
10
10
  }
11
11
  }
12
12
  function updateRelevantDependencies(host, context) {
13
- return utils_1.updateJsonInTree('package.json', (json) => {
13
+ return (0, utils_1.updateJsonInTree)('package.json', (json) => {
14
14
  /**
15
15
  * @angular-eslint
16
16
  */
@@ -46,12 +46,12 @@ function addRecommendedExtraExtendsWhereApplicable(config) {
46
46
  }
47
47
  }
48
48
  function applyRecommendedExtraExtends() {
49
- return schematics_1.chain([
50
- utils_1.visitNotIgnoredFiles((filePath) => {
49
+ return (0, schematics_1.chain)([
50
+ (0, utils_1.visitNotIgnoredFiles)((filePath) => {
51
51
  if (!filePath.endsWith('.eslintrc.json')) {
52
52
  return;
53
53
  }
54
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
54
+ return (0, utils_1.updateJsonInTree)(filePath.toString(), (json) => {
55
55
  addRecommendedExtraExtendsWhereApplicable(json);
56
56
  return json;
57
57
  });
@@ -74,12 +74,12 @@ function updateComponentMaxInlineDeclarationsSchema({ overrides, rules, }) {
74
74
  }
75
75
  }
76
76
  function updateComponentMaxInlineDeclarations() {
77
- return schematics_1.chain([
78
- utils_1.visitNotIgnoredFiles((filePath) => {
77
+ return (0, schematics_1.chain)([
78
+ (0, utils_1.visitNotIgnoredFiles)((filePath) => {
79
79
  if (!filePath.endsWith('.eslintrc.json')) {
80
80
  return;
81
81
  }
82
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
82
+ return (0, utils_1.updateJsonInTree)(filePath.toString(), (json) => {
83
83
  updateComponentMaxInlineDeclarationsSchema(json);
84
84
  return json;
85
85
  });
@@ -87,7 +87,7 @@ function updateComponentMaxInlineDeclarations() {
87
87
  ]);
88
88
  }
89
89
  function default_1() {
90
- return schematics_1.chain([
90
+ return (0, schematics_1.chain)([
91
91
  updateRelevantDependencies,
92
92
  applyRecommendedExtraExtends,
93
93
  updateComponentMaxInlineDeclarations,
@@ -10,7 +10,7 @@ function updateIfExists(deps, depName, updatedVersion) {
10
10
  }
11
11
  }
12
12
  function updateRelevantDependencies(host, context) {
13
- return utils_1.updateJsonInTree('package.json', (json) => {
13
+ return (0, utils_1.updateJsonInTree)('package.json', (json) => {
14
14
  /**
15
15
  * @angular-eslint
16
16
  */
@@ -23,6 +23,6 @@ function updateRelevantDependencies(host, context) {
23
23
  })(host, context);
24
24
  }
25
25
  function default_1() {
26
- return schematics_1.chain([updateRelevantDependencies]);
26
+ return (0, schematics_1.chain)([updateRelevantDependencies]);
27
27
  }
28
28
  exports.default = default_1;
@@ -5,8 +5,8 @@ const schematics_1 = require("@angular-devkit/schematics");
5
5
  const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const utils_1 = require("../../utils");
7
7
  function updateDependencies(depsToUpdate) {
8
- return schematics_1.chain([
9
- utils_1.updateJsonInTree('package.json', (json) => {
8
+ return (0, schematics_1.chain)([
9
+ (0, utils_1.updateJsonInTree)('package.json', (json) => {
10
10
  for (const { packageName, version } of depsToUpdate) {
11
11
  updateIfExists(json, packageName, version);
12
12
  }
@@ -20,6 +20,11 @@
20
20
  "version": "4.9.0",
21
21
  "description": "Updates @angular-eslint to v12",
22
22
  "factory": "./migrations/update-12-0-0/update-12-0-0"
23
+ },
24
+ "update-13-0-0": {
25
+ "version": "13.0.0-alpha.0",
26
+ "description": "Updates @angular-eslint to v13",
27
+ "factory": "./migrations/update-13-0-0/update-13-0-0"
23
28
  }
24
29
  }
25
30
  }
@@ -45,7 +45,7 @@ function addAngularESLintPackages() {
45
45
  json.devDependencies['@typescript-eslint/eslint-plugin'] =
46
46
  typescriptESLintVersion;
47
47
  json.devDependencies['@typescript-eslint/parser'] = typescriptESLintVersion;
48
- json.devDependencies = utils_1.sortObjectByKeys(json.devDependencies);
48
+ json.devDependencies = (0, utils_1.sortObjectByKeys)(json.devDependencies);
49
49
  host.overwrite('package.json', JSON.stringify(json, null, 2));
50
50
  context.addTask(new tasks_1.NodePackageInstallTask());
51
51
  context.logger.info(`
@@ -58,7 +58,7 @@ Please see https://github.com/angular-eslint/angular-eslint for how to add ESLin
58
58
  }
59
59
  function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
60
60
  return (host, context) => {
61
- const angularJson = utils_1.readJsonInTree(host, 'angular.json');
61
+ const angularJson = (0, utils_1.readJsonInTree)(host, 'angular.json');
62
62
  if (!angularJson || !angularJson.projects) {
63
63
  return;
64
64
  }
@@ -68,7 +68,7 @@ function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
68
68
  return;
69
69
  }
70
70
  const singleProject = angularJson.projects[projectNames[0]];
71
- const targetsConfig = utils_1.getTargetsConfigFromProject(singleProject);
71
+ const targetsConfig = (0, utils_1.getTargetsConfigFromProject)(singleProject);
72
72
  // Only possible if malformed, safer to finish here
73
73
  if (!targetsConfig) {
74
74
  return;
@@ -82,9 +82,9 @@ We detected that you have a single project in your workspace and no existing lin
82
82
 
83
83
  Please see https://github.com/angular-eslint/angular-eslint for more information.
84
84
  `);
85
- return schematics_1.chain([
86
- schematics_1.schematic('add-eslint-to-project', {}),
87
- utils_1.updateJsonInTree('angular.json', (json) => {
85
+ return (0, schematics_1.chain)([
86
+ (0, schematics_1.schematic)('add-eslint-to-project', {}),
87
+ (0, utils_1.updateJsonInTree)('angular.json', (json) => {
88
88
  json.cli = json.cli || {};
89
89
  json.cli.defaultCollection = '@angular-eslint/schematics';
90
90
  return json;
@@ -94,7 +94,7 @@ Please see https://github.com/angular-eslint/angular-eslint for more information
94
94
  }
95
95
  function default_1() {
96
96
  return (host, context) => {
97
- return schematics_1.chain([
97
+ return (0, schematics_1.chain)([
98
98
  addAngularESLintPackages(),
99
99
  applyESLintConfigIfSingleProjectWithNoExistingTSLint(),
100
100
  ])(host, context);
package/dist/utils.js CHANGED
@@ -19,12 +19,12 @@ function readJsonInTree(host, path) {
19
19
  if (!host.exists(path)) {
20
20
  throw new Error(`Cannot find ${path}`);
21
21
  }
22
- const contents = strip_json_comments_1.default(host.read(path).toString('utf-8'));
22
+ const contents = (0, strip_json_comments_1.default)(host.read(path).toString('utf-8'));
23
23
  try {
24
24
  return JSON.parse(contents);
25
25
  }
26
26
  catch (e) {
27
- throw new Error(`Cannot parse ${path}: ${e.message}`);
27
+ throw new Error(`Cannot parse ${path}: ${e instanceof Error ? e.message : ''}`);
28
28
  }
29
29
  }
30
30
  exports.readJsonInTree = readJsonInTree;
@@ -103,7 +103,7 @@ function getProjectConfig(host, name) {
103
103
  }
104
104
  exports.getProjectConfig = getProjectConfig;
105
105
  function offsetFromRoot(fullPathToSourceDir) {
106
- const parts = core_1.normalize(fullPathToSourceDir).split('/');
106
+ const parts = (0, core_1.normalize)(fullPathToSourceDir).split('/');
107
107
  let offset = '';
108
108
  for (let i = 0; i < parts.length; ++i) {
109
109
  offset += '../';
@@ -151,11 +151,11 @@ exports.addESLintTargetToProject = addESLintTargetToProject;
151
151
  /**
152
152
  * Utility to act on all files in a tree that are not ignored by git.
153
153
  */
154
- function visitNotIgnoredFiles(visitor, dir = core_1.normalize('')) {
154
+ function visitNotIgnoredFiles(visitor, dir = (0, core_1.normalize)('')) {
155
155
  return (host, context) => {
156
156
  let ig;
157
157
  if (host.exists('.gitignore')) {
158
- ig = ignore_1.default();
158
+ ig = (0, ignore_1.default)();
159
159
  ig.add(host.read('.gitignore').toString());
160
160
  }
161
161
  function visit(_dir) {
@@ -164,16 +164,16 @@ function visitNotIgnoredFiles(visitor, dir = core_1.normalize('')) {
164
164
  }
165
165
  const dirEntry = host.getDir(_dir);
166
166
  dirEntry.subfiles.forEach((file) => {
167
- if (ig === null || ig === void 0 ? void 0 : ig.ignores(core_1.join(_dir, file))) {
167
+ if (ig === null || ig === void 0 ? void 0 : ig.ignores((0, core_1.join)(_dir, file))) {
168
168
  return;
169
169
  }
170
- const maybeRule = visitor(core_1.join(_dir, file), host, context);
170
+ const maybeRule = visitor((0, core_1.join)(_dir, file), host, context);
171
171
  if (maybeRule) {
172
- schematics_1.callRule(maybeRule, host, context).subscribe();
172
+ (0, schematics_1.callRule)(maybeRule, host, context).subscribe();
173
173
  }
174
174
  });
175
175
  dirEntry.subdirs.forEach((subdir) => {
176
- visit(core_1.join(_dir, subdir));
176
+ visit((0, core_1.join)(_dir, subdir));
177
177
  });
178
178
  }
179
179
  visit(dir);
@@ -288,7 +288,7 @@ function createESLintConfigForProject(projectName) {
288
288
  if (projectRoot === '') {
289
289
  return createRootESLintConfigFile(projectName);
290
290
  }
291
- return updateJsonInTree(core_1.join(core_1.normalize(projectRoot), '.eslintrc.json'), () => createProjectESLintConfig(tree.root.path, projectRoot, projectType, prefix, hasE2e));
291
+ return updateJsonInTree((0, core_1.join)((0, core_1.normalize)(projectRoot), '.eslintrc.json'), () => createProjectESLintConfig(tree.root.path, projectRoot, projectType, prefix, hasE2e));
292
292
  };
293
293
  }
294
294
  exports.createESLintConfigForProject = createESLintConfigForProject;
@@ -296,7 +296,7 @@ function removeTSLintJSONForProject(projectName) {
296
296
  return (tree) => {
297
297
  const angularJSON = readJsonInTree(tree, 'angular.json');
298
298
  const { root: projectRoot } = angularJSON.projects[projectName];
299
- const tslintJsonPath = core_1.join(core_1.normalize(projectRoot || '/'), 'tslint.json');
299
+ const tslintJsonPath = (0, core_1.join)((0, core_1.normalize)(projectRoot || '/'), 'tslint.json');
300
300
  if (tree.exists(tslintJsonPath)) {
301
301
  tree.delete(tslintJsonPath);
302
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/schematics",
3
- "version": "12.7.1-alpha.0+f1e7704",
3
+ "version": "13.0.1-alpha.0+9f0f93e",
4
4
  "description": "Angular Schematics for angular-eslint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -18,34 +18,35 @@
18
18
  ],
19
19
  "schematics": "./dist/collection.json",
20
20
  "ng-update": {
21
+ "packageGroupName": "@angular-eslint/schematics",
22
+ "migrations": "./dist/migrations.json",
21
23
  "packageGroup": [
22
24
  "@angular-eslint/builder",
25
+ "@angular-eslint/bundled-angular-compiler",
23
26
  "@angular-eslint/eslint-plugin",
24
27
  "@angular-eslint/eslint-plugin-template",
25
- "@angular-eslint/schematics",
26
- "@angular-eslint/template-parser"
27
- ],
28
- "packageGroupName": "@angular-eslint/schematics",
29
- "migrations": "./dist/migrations.json"
28
+ "@angular-eslint/template-parser",
29
+ "@angular-eslint/utils"
30
+ ]
30
31
  },
31
32
  "ng-add": {
32
33
  "save": "devDependencies"
33
34
  },
34
35
  "dependencies": {
35
- "@angular-eslint/eslint-plugin": "12.7.1-alpha.0+f1e7704",
36
- "@angular-eslint/eslint-plugin-template": "12.7.1-alpha.0+f1e7704",
36
+ "@angular-eslint/eslint-plugin": "13.0.1-alpha.0+9f0f93e",
37
+ "@angular-eslint/eslint-plugin-template": "13.0.1-alpha.0+9f0f93e",
37
38
  "ignore": "5.1.9",
38
39
  "strip-json-comments": "3.1.1",
39
40
  "tmp": "0.2.1"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@types/tmp": "0.2.2",
43
- "@typescript-eslint/experimental-utils": "4.28.2",
44
- "eslint": "7.26.0",
44
+ "@typescript-eslint/experimental-utils": "5.3.0",
45
+ "eslint": "8.2.0",
45
46
  "tslint-to-eslint-config": "2.4.0"
46
47
  },
47
48
  "peerDependencies": {
48
- "@angular/cli": ">= 12.0.0 < 13.0.0"
49
+ "@angular/cli": ">= 13.0.0 < 14.0.0"
49
50
  },
50
- "gitHead": "f1e7704b7c0f57d7743fef8cd7500bc3103b9b5b"
51
+ "gitHead": "9f0f93e5be30c76a578e34b13d7aa452958c6984"
51
52
  }