@angular-eslint/schematics 4.3.1-alpha.16 → 4.3.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "add-eslint-to-project",
3
+ "id": "add-eslint-to-project",
4
4
  "title": "Add ESLint to an Angular CLI project",
5
5
  "type": "object",
6
6
  "properties": {
@@ -1,10 +1,9 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "SchematicsAngularApp",
2
+ "$schema": "http://json-schema.org/schema",
3
+ "id": "SchematicsAngularApp",
4
4
  "title": "Angular Application Options Schema",
5
5
  "type": "object",
6
6
  "description": "Generates a new basic app definition in the \"projects\" subfolder of the workspace.",
7
- "additionalProperties": false,
8
7
  "properties": {
9
8
  "projectRoot": {
10
9
  "description": "The root directory of the new app.",
@@ -34,7 +33,7 @@
34
33
  },
35
34
  "viewEncapsulation": {
36
35
  "description": "The view encapsulation strategy to use in the new app.",
37
- "enum": ["Emulated", "None", "ShadowDom"],
36
+ "enum": ["Emulated", "Native", "None", "ShadowDom"],
38
37
  "type": "string",
39
38
  "x-user-analytics": 11
40
39
  },
@@ -56,24 +55,22 @@
56
55
  "description": "The file extension or preprocessor to use for style files.",
57
56
  "type": "string",
58
57
  "default": "css",
59
- "enum": ["css", "scss", "sass", "less"],
58
+ "enum": [
59
+ "css",
60
+ "scss",
61
+ "sass",
62
+ "less",
63
+ "styl"
64
+ ],
60
65
  "x-prompt": {
61
66
  "message": "Which stylesheet format would you like to use?",
62
67
  "type": "list",
63
68
  "items": [
64
- { "value": "css", "label": "CSS" },
65
- {
66
- "value": "scss",
67
- "label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]"
68
- },
69
- {
70
- "value": "sass",
71
- "label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]"
72
- },
73
- {
74
- "value": "less",
75
- "label": "Less [ http://lesscss.org ]"
76
- }
69
+ { "value": "css", "label": "CSS" },
70
+ { "value": "scss", "label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]" },
71
+ { "value": "sass", "label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]" },
72
+ { "value": "less", "label": "Less [ http://lesscss.org ]" },
73
+ { "value": "styl", "label": "Stylus [ https://stylus-lang.com ]" }
77
74
  ]
78
75
  },
79
76
  "x-user-analytics": 5
@@ -110,15 +107,16 @@
110
107
  "strict": {
111
108
  "description": "Creates an application with stricter bundle budgets settings.",
112
109
  "type": "boolean",
113
- "default": true,
110
+ "default": false,
114
111
  "x-user-analytics": 7
115
112
  },
116
113
  "legacyBrowsers": {
117
114
  "type": "boolean",
118
115
  "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"
116
+ "default": false
121
117
  }
122
118
  },
123
- "required": ["name"]
119
+ "required": [
120
+ "name"
121
+ ]
124
122
  }
@@ -176,7 +176,7 @@ function convertRootTSLintConfig(schema, rootTSLintJsonPath, rootESLintrcJsonPat
176
176
  plugins: [
177
177
  '@angular-eslint/eslint-plugin',
178
178
  '@angular-eslint/eslint-plugin-template',
179
- '@typescript-eslint/tslint', // see note on not depending on not wanting to depend on TSLint fallback
179
+ '@typescript-eslint/tslint',
180
180
  ],
181
181
  },
182
182
  ]);
@@ -286,7 +286,7 @@ function convertNonRootTSLintConfig(schema, projectRoot, projectType, projectTSL
286
286
  plugins: [
287
287
  '@angular-eslint/eslint-plugin',
288
288
  '@angular-eslint/eslint-plugin-template',
289
- '@typescript-eslint/tslint', // see note on not depending on not wanting to depend on TSLint fallback
289
+ '@typescript-eslint/tslint',
290
290
  ],
291
291
  },
292
292
  ]);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "convert-tslint-to-eslint",
3
+ "id": "convert-tslint-to-eslint",
4
4
  "title": "Convert an Angular CLI project from TSLint to ESLint",
5
5
  "examples": [
6
6
  {
@@ -1,11 +1,10 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "SchematicsLibrary",
2
+ "$schema": "http://json-schema.org/schema",
3
+ "id": "SchematicsLibrary",
4
4
  "title": "Library Options Schema",
5
5
  "type": "object",
6
- "description": "Creates a new, generic library project in the current workspace.",
6
+ "description": "Creates a new generic library project in the current workspace.",
7
7
  "long-description": "./library-long.md",
8
- "additionalProperties": false,
9
8
  "properties": {
10
9
  "name": {
11
10
  "type": "string",
@@ -15,11 +15,6 @@
15
15
  "version": "3.9.0",
16
16
  "description": "Updates @angular-eslint to v4",
17
17
  "factory": "./migrations/update-4-0-0/update-4-0-0"
18
- },
19
- "update-12-0-0": {
20
- "version": "4.9.0",
21
- "description": "Updates @angular-eslint to v12",
22
- "factory": "./migrations/update-12-0-0/update-12-0-0"
23
18
  }
24
19
  }
25
20
  }
@@ -53,48 +53,9 @@ Please see https://github.com/angular-eslint/angular-eslint for how to add ESLin
53
53
  return host;
54
54
  };
55
55
  }
56
- function applyESLintConfigIfSingleProjectWithNoExistingTSLint() {
57
- return (host, context) => {
58
- const angularJson = utils_1.readJsonInTree(host, 'angular.json');
59
- if (!angularJson || !angularJson.projects) {
60
- return;
61
- }
62
- // Anything other than a single project, finish here as there is nothing more we can do automatically
63
- const projectNames = Object.keys(angularJson.projects);
64
- if (projectNames.length !== 1) {
65
- return;
66
- }
67
- const singleProject = angularJson.projects[projectNames[0]];
68
- const targetsConfig = utils_1.getTargetsConfigFromProject(singleProject);
69
- // Only possible if malformed, safer to finish here
70
- if (!targetsConfig) {
71
- return;
72
- }
73
- // The project already has a lint builder setup, finish here as there is nothing more we can do automatically
74
- if (targetsConfig.lint) {
75
- return;
76
- }
77
- context.logger.info(`
78
- 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.
79
-
80
- Please see https://github.com/angular-eslint/angular-eslint for more information.
81
- `);
82
- return schematics_1.chain([
83
- schematics_1.schematic('add-eslint-to-project', {}),
84
- utils_1.updateJsonInTree('angular.json', (json) => {
85
- json.cli = json.cli || {};
86
- json.cli.defaultCollection = '@angular-eslint/schematics';
87
- return json;
88
- }),
89
- ]);
90
- };
91
- }
92
56
  function default_1() {
93
57
  return (host, context) => {
94
- return schematics_1.chain([
95
- addAngularESLintPackages(),
96
- applyESLintConfigIfSingleProjectWithNoExistingTSLint(),
97
- ])(host, context);
58
+ return schematics_1.chain([addAngularESLintPackages()])(host, context);
98
59
  };
99
60
  }
100
61
  exports.default = default_1;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "add-angular-eslint",
3
+ "id": "add-angular-eslint",
4
4
  "title": "Add angular-eslint to an existing workspace",
5
5
  "type": "object",
6
6
  "properties": {},
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.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.determineTargetProjectName = exports.sortObjectByKeys = exports.removeTSLintJSONForProject = exports.createESLintConfigForProject = exports.createRootESLintConfig = exports.setESLintProjectBasedOnProjectType = exports.visitNotIgnoredFiles = exports.addESLintTargetToProject = exports.updateWorkspaceInTree = exports.offsetFromRoot = exports.getProjectConfig = exports.isTSLintUsedInWorkspace = 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"));
@@ -64,7 +64,6 @@ function getTargetsConfigFromProject(projectConfig) {
64
64
  }
65
65
  return null;
66
66
  }
67
- exports.getTargetsConfigFromProject = getTargetsConfigFromProject;
68
67
  function isTSLintUsedInWorkspace(tree) {
69
68
  const workspaceJson = readJsonInTree(tree, getWorkspacePath(tree));
70
69
  if (!workspaceJson) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsAngularWorkspace",
3
+ "id": "SchematicsAngularWorkspace",
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": "4.3.1-alpha.16+ed7d7b0",
3
+ "version": "4.3.1",
4
4
  "description": "Angular Schematics for angular-eslint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -31,20 +31,20 @@
31
31
  "save": "devDependencies"
32
32
  },
33
33
  "dependencies": {
34
- "@angular-eslint/eslint-plugin": "4.3.1-alpha.16+ed7d7b0",
35
- "@angular-eslint/eslint-plugin-template": "4.3.1-alpha.16+ed7d7b0",
34
+ "@angular-eslint/eslint-plugin": "4.3.1",
35
+ "@angular-eslint/eslint-plugin-template": "4.3.1",
36
36
  "ignore": "5.1.8",
37
37
  "strip-json-comments": "3.1.1",
38
38
  "tmp": "0.2.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/tmp": "0.2.0",
42
- "@typescript-eslint/experimental-utils": "4.23.0",
43
- "eslint": "^7.26.0",
44
- "tslint-to-eslint-config": "^2.4.0"
42
+ "@typescript-eslint/experimental-utils": "4.16.1",
43
+ "eslint": "^7.6.0",
44
+ "tslint-to-eslint-config": "^2.3.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "@angular/cli": ">= 12.0.0 < 13.0.0"
47
+ "@angular/cli": ">= 11.2.0 < 12.0.0"
48
48
  },
49
- "gitHead": "ed7d7b05fb69cef368920ce41396fd260cb3ec84"
49
+ "gitHead": "3c3e9e87199a229429edfe863117ba4e8f37f424"
50
50
  }
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const utils_1 = require("../../utils");
5
- const dependencies_1 = require("../utils/dependencies");
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'];
11
- function migrateToAccessibilityLabelHasAssociatedControlSchema(rule) {
12
- if (!Array.isArray(rule) || rule.length !== 2)
13
- return;
14
- const [, currentSchema] = rule;
15
- rule[1] = {
16
- controlComponents: currentSchema.controlComponents,
17
- labelComponents: currentSchema.labelComponents.map((selector) => {
18
- return { inputs: currentSchema.labelAttributes, selector };
19
- }),
20
- };
21
- }
22
- function migrateFromAccessibilityLabelFor({ overrides, rules }) {
23
- var _a;
24
- migrateToAccessibilityLabelHasAssociatedControlSchema(rules === null || rules === void 0 ? void 0 : rules['@angular-eslint/template/accessibility-label-for']);
25
- migrateToAccessibilityLabelHasAssociatedControlName(rules);
26
- for (const override of overrides !== null && overrides !== void 0 ? overrides : []) {
27
- migrateToAccessibilityLabelHasAssociatedControlSchema((_a = override.rules) === null || _a === void 0 ? void 0 : _a['@angular-eslint/template/accessibility-label-for']);
28
- migrateToAccessibilityLabelHasAssociatedControlName(override.rules);
29
- }
30
- }
31
- function migrateToAccessibilityLabelHasAssociatedControlName(rules) {
32
- if (!rules)
33
- return;
34
- const accessibilityLabelForRule = rules['@angular-eslint/template/accessibility-label-for'];
35
- delete rules['@angular-eslint/template/accessibility-label-for'];
36
- rules['@angular-eslint/template/accessibility-label-has-associated-control'] = accessibilityLabelForRule;
37
- }
38
- function updateAccessibilityLabelFor() {
39
- return schematics_1.chain([
40
- utils_1.visitNotIgnoredFiles((filePath) => {
41
- if (!filePath.endsWith('.eslintrc.json')) {
42
- return;
43
- }
44
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
45
- migrateFromAccessibilityLabelFor(json);
46
- return json;
47
- });
48
- }),
49
- ]);
50
- }
51
- function addEqeqeqIfNeeded(rules) {
52
- if (!rules ||
53
- !rules['@angular-eslint/template/no-negated-async'] ||
54
- rules['@angular-eslint/template/eqeqeq']) {
55
- return;
56
- }
57
- rules['@angular-eslint/template/eqeqeq'] = 'error';
58
- }
59
- function addEqeqeq() {
60
- return schematics_1.chain([
61
- utils_1.visitNotIgnoredFiles((filePath) => {
62
- if (!filePath.endsWith('.eslintrc.json')) {
63
- return;
64
- }
65
- return utils_1.updateJsonInTree(filePath.toString(), (json) => {
66
- var _a;
67
- addEqeqeqIfNeeded(json.rules);
68
- ((_a = json.overrides) !== null && _a !== void 0 ? _a : []).forEach((override) => addEqeqeqIfNeeded(override.rules));
69
- return json;
70
- });
71
- }),
72
- ]);
73
- }
74
- function migration() {
75
- return schematics_1.chain([
76
- dependencies_1.updateDependencies([
77
- {
78
- packageName: '@angular-eslint/builder',
79
- version: updatedAngularESLintVersion,
80
- },
81
- {
82
- packageName: '@angular-eslint/eslint-plugin',
83
- version: updatedAngularESLintVersion,
84
- },
85
- {
86
- packageName: '@angular-eslint/eslint-plugin-template',
87
- version: updatedAngularESLintVersion,
88
- },
89
- {
90
- packageName: '@angular-eslint/template-parser',
91
- version: updatedAngularESLintVersion,
92
- },
93
- {
94
- packageName: '@typescript-eslint/eslint-plugin',
95
- version: updatedTypeScriptESLintVersion,
96
- },
97
- {
98
- packageName: '@typescript-eslint/experimental-utils',
99
- version: updatedTypeScriptESLintVersion,
100
- },
101
- {
102
- packageName: '@typescript-eslint/parser',
103
- version: updatedTypeScriptESLintVersion,
104
- },
105
- {
106
- packageName: 'eslint',
107
- version: updatedESLintVersion,
108
- },
109
- ]),
110
- updateAccessibilityLabelFor,
111
- addEqeqeq,
112
- ]);
113
- }
114
- exports.default = migration;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateDependencies = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const utils_1 = require("../../utils");
7
- function updateDependencies(depsToUpdate) {
8
- return schematics_1.chain([
9
- utils_1.updateJsonInTree('package.json', (json) => {
10
- for (const { packageName, version } of depsToUpdate) {
11
- updateIfExists(json, packageName, version);
12
- }
13
- return json;
14
- }),
15
- (_, context) => {
16
- context.addTask(new tasks_1.NodePackageInstallTask());
17
- },
18
- ]);
19
- }
20
- exports.updateDependencies = updateDependencies;
21
- function updateIfExists(packageJson, depName, updatedVersion) {
22
- if (!packageJson) {
23
- return;
24
- }
25
- if (packageJson.dependencies && packageJson.dependencies[depName]) {
26
- packageJson.dependencies[depName] = updatedVersion;
27
- }
28
- if (packageJson.devDependencies && packageJson.devDependencies[depName]) {
29
- packageJson.devDependencies[depName] = updatedVersion;
30
- }
31
- }