@schematics/angular 9.1.0-next.2 → 9.1.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.
@@ -54,6 +54,11 @@
54
54
  "version": "9.0.2",
55
55
  "factory": "./update-9/schematic-options",
56
56
  "description": "Replace deprecated 'styleext' and 'spec' Angular schematic options."
57
+ },
58
+ "tslint-version-6": {
59
+ "version": "10.0.0-beta.0",
60
+ "factory": "./update-10/update-tslint",
61
+ "description": "Update tslint to version 6."
57
62
  }
58
63
  }
59
64
  }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare const TSLINT_VERSION = "~6.1.0";
3
+ export default function (): Rule;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const dependencies_1 = require("../../utility/dependencies");
4
+ const json_utils_1 = require("../../utility/json-utils");
5
+ const utils_1 = require("../update-9/utils");
6
+ exports.TSLINT_VERSION = '~6.1.0';
7
+ const TSLINT_CONFIG_PATH = '/tslint.json';
8
+ const RULES_TO_DELETE = [
9
+ 'no-use-before-declare',
10
+ 'no-unused-variable',
11
+ ];
12
+ const RULES_TO_ADD = {
13
+ align: {
14
+ options: ['parameters', 'statements'],
15
+ },
16
+ 'arrow-return-shorthand': true,
17
+ curly: true,
18
+ eofline: true,
19
+ 'import-spacing': true,
20
+ indent: {
21
+ options: ['spaces'],
22
+ },
23
+ 'variable-name': {
24
+ options: ['ban-keywords', 'check-format', 'allow-pascal-case'],
25
+ },
26
+ semicolon: { options: ['always'] },
27
+ 'space-before-function-paren': {
28
+ options: {
29
+ anonymous: 'never',
30
+ asyncArrow: 'always',
31
+ constructor: 'never',
32
+ method: 'never',
33
+ named: 'never',
34
+ },
35
+ },
36
+ 'typedef-whitespace': {
37
+ options: [
38
+ {
39
+ 'call-signature': 'nospace',
40
+ 'index-signature': 'nospace',
41
+ parameter: 'nospace',
42
+ 'property-declaration': 'nospace',
43
+ 'variable-declaration': 'nospace',
44
+ },
45
+ {
46
+ 'call-signature': 'onespace',
47
+ 'index-signature': 'onespace',
48
+ parameter: 'onespace',
49
+ 'property-declaration': 'onespace',
50
+ 'variable-declaration': 'onespace',
51
+ },
52
+ ],
53
+ },
54
+ whitespace: {
55
+ options: [
56
+ 'check-branch',
57
+ 'check-decl',
58
+ 'check-operator',
59
+ 'check-separator',
60
+ 'check-type',
61
+ 'check-typecast',
62
+ ],
63
+ },
64
+ };
65
+ function default_1() {
66
+ return (tree, context) => {
67
+ const logger = context.logger;
68
+ // Update tslint dependency
69
+ const current = dependencies_1.getPackageJsonDependency(tree, 'tslint');
70
+ if (!current) {
71
+ logger.info('"tslint" in not a dependency of this workspace.');
72
+ return;
73
+ }
74
+ if (current.version !== exports.TSLINT_VERSION) {
75
+ dependencies_1.addPackageJsonDependency(tree, {
76
+ type: current.type,
77
+ name: 'tslint',
78
+ version: exports.TSLINT_VERSION,
79
+ overwrite: true,
80
+ });
81
+ }
82
+ // Update tslint config.
83
+ const tslintJsonAst = utils_1.readJsonFileAsAstObject(tree, TSLINT_CONFIG_PATH);
84
+ if (!tslintJsonAst) {
85
+ const config = ['tslint.js', 'tslint.yaml'].find(c => tree.exists(c));
86
+ if (config) {
87
+ logger.warn(`Expected a JSON configuration file but found "${config}".`);
88
+ }
89
+ else {
90
+ logger.warn('Cannot find "tslint.json" configuration file.');
91
+ }
92
+ return;
93
+ }
94
+ // Remove old/deprecated rules.
95
+ for (const rule of RULES_TO_DELETE) {
96
+ const tslintJsonAst = utils_1.readJsonFileAsAstObject(tree, TSLINT_CONFIG_PATH);
97
+ const rulesAst = json_utils_1.findPropertyInAstObject(tslintJsonAst, 'rules');
98
+ if ((rulesAst === null || rulesAst === void 0 ? void 0 : rulesAst.kind) !== 'object') {
99
+ break;
100
+ }
101
+ const recorder = tree.beginUpdate(TSLINT_CONFIG_PATH);
102
+ json_utils_1.removePropertyInAstObject(recorder, rulesAst, rule);
103
+ tree.commitUpdate(recorder);
104
+ }
105
+ // Add new rules only iif the configuration extends 'tslint:recommended'.
106
+ // This is because some rules conflict with prettier or other tools.
107
+ const extendsAst = json_utils_1.findPropertyInAstObject(tslintJsonAst, 'extends');
108
+ if (!extendsAst ||
109
+ (extendsAst.kind === 'string' && extendsAst.value !== 'tslint:recommended') ||
110
+ (extendsAst.kind === 'array' && extendsAst.elements.some(e => e.value !== 'tslint:recommended'))) {
111
+ logger.warn(`tslint configuration does not extend "tslint:recommended".`
112
+ + '\nMigration will terminate as some rules might conflict.');
113
+ return;
114
+ }
115
+ for (const [name, value] of Object.entries(RULES_TO_ADD)) {
116
+ const tslintJsonAst = utils_1.readJsonFileAsAstObject(tree, TSLINT_CONFIG_PATH);
117
+ const rulesAst = json_utils_1.findPropertyInAstObject(tslintJsonAst, 'rules');
118
+ if ((rulesAst === null || rulesAst === void 0 ? void 0 : rulesAst.kind) !== 'object') {
119
+ break;
120
+ }
121
+ if (json_utils_1.findPropertyInAstObject(rulesAst, name)) {
122
+ // Skip as rule already exists.
123
+ continue;
124
+ }
125
+ const recorder = tree.beginUpdate(TSLINT_CONFIG_PATH);
126
+ json_utils_1.insertPropertyInAstObjectInOrder(recorder, rulesAst, name, value, 4);
127
+ tree.commitUpdate(recorder);
128
+ }
129
+ };
130
+ }
131
+ exports.default = default_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "9.1.0-next.2",
3
+ "version": "9.1.0",
4
4
  "description": "Schematics specific to Angular",
5
5
  "keywords": [
6
6
  "angular",
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "schematics": "./collection.json",
16
16
  "dependencies": {
17
- "@angular-devkit/core": "9.1.0-next.2",
18
- "@angular-devkit/schematics": "9.1.0-next.2"
17
+ "@angular-devkit/core": "9.1.0",
18
+ "@angular-devkit/schematics": "9.1.0"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -9,17 +9,17 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.latestVersions = {
11
11
  // These versions should be kept up to date with latest Angular peer dependencies.
12
- Angular: '~9.1.0-next.3',
12
+ Angular: '~9.1.0',
13
13
  RxJs: '~6.5.4',
14
14
  ZoneJs: '~0.10.2',
15
- TypeScript: '~3.7.5',
15
+ TypeScript: '~3.8.3',
16
16
  TsLib: '^1.10.0',
17
17
  // The versions below must be manually updated when making a new devkit release.
18
18
  // For our e2e tests, these versions must match the latest tag present on the branch.
19
19
  // During RC periods they will not match the latest RC until there's a new git tag, and
20
20
  // should not be updated.
21
- DevkitBuildAngular: '~0.901.0-next.2',
22
- DevkitBuildNgPackagr: '~0.901.0-next.2',
23
- DevkitBuildWebpack: '~0.901.0-next.2',
21
+ DevkitBuildAngular: '~0.901.0',
22
+ DevkitBuildNgPackagr: '~0.901.0',
23
+ DevkitBuildWebpack: '~0.901.0',
24
24
  ngPackagr: '^9.0.0',
25
25
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "version": 1, <% if (packageManager) { %>
3
+ "version": 1,<% if (packageManager) { %>
4
4
  "cli": {
5
5
  "packageManager": "<%= packageManager %>"
6
6
  },<% } %>
@@ -40,7 +40,7 @@
40
40
  "karma-jasmine-html-reporter": "^1.4.2",
41
41
  "protractor": "~5.4.3",<% } %>
42
42
  "ts-node": "~8.3.0",
43
- "tslint": "~5.18.0",
43
+ "tslint": "~6.1.0",
44
44
  "typescript": "<%= latestVersions.TypeScript %>"
45
45
  }
46
46
  }
@@ -4,22 +4,34 @@
4
4
  "codelyzer"
5
5
  ],
6
6
  "rules": {
7
+ "align": {
8
+ "options": [
9
+ "parameters",
10
+ "statements"
11
+ ]
12
+ },
7
13
  "array-type": false,
8
- "arrow-parens": false,
14
+ "arrow-return-shorthand": true,
15
+ "curly": true,
9
16
  "deprecation": {
10
17
  "severity": "warning"
11
18
  },
19
+ "eofline": true,
12
20
  "import-blacklist": [
13
21
  true,
14
22
  "rxjs/Rx"
15
23
  ],
16
- "interface-name": false,
24
+ "import-spacing": true,
25
+ "indent": {
26
+ "options": [
27
+ "spaces"
28
+ ]
29
+ },
17
30
  "max-classes-per-file": false,
18
31
  "max-line-length": [
19
32
  true,
20
33
  140
21
34
  ],
22
- "member-access": false,
23
35
  "member-ordering": [
24
36
  true,
25
37
  {
@@ -31,7 +43,6 @@
31
43
  ]
32
44
  }
33
45
  ],
34
- "no-consecutive-blank-lines": false,
35
46
  "no-console": [
36
47
  true,
37
48
  "debug",
@@ -53,13 +64,59 @@
53
64
  true,
54
65
  "as-needed"
55
66
  ],
56
- "object-literal-sort-keys": false,
57
- "ordered-imports": false,
58
67
  "quotemark": [
59
68
  true,
60
69
  "single"
61
70
  ],
62
- "trailing-comma": false,
71
+ "semicolon": {
72
+ "options": [
73
+ "always"
74
+ ]
75
+ },
76
+ "space-before-function-paren": {
77
+ "options": {
78
+ "anonymous": "never",
79
+ "asyncArrow": "always",
80
+ "constructor": "never",
81
+ "method": "never",
82
+ "named": "never"
83
+ }
84
+ },
85
+ "typedef-whitespace": {
86
+ "options": [
87
+ {
88
+ "call-signature": "nospace",
89
+ "index-signature": "nospace",
90
+ "parameter": "nospace",
91
+ "property-declaration": "nospace",
92
+ "variable-declaration": "nospace"
93
+ },
94
+ {
95
+ "call-signature": "onespace",
96
+ "index-signature": "onespace",
97
+ "parameter": "onespace",
98
+ "property-declaration": "onespace",
99
+ "variable-declaration": "onespace"
100
+ }
101
+ ]
102
+ },
103
+ "variable-name": {
104
+ "options": [
105
+ "ban-keywords",
106
+ "check-format",
107
+ "allow-pascal-case"
108
+ ]
109
+ },
110
+ "whitespace": {
111
+ "options": [
112
+ "check-branch",
113
+ "check-decl",
114
+ "check-operator",
115
+ "check-separator",
116
+ "check-type",
117
+ "check-typecast"
118
+ ]
119
+ },
63
120
  "component-class-suffix": true,
64
121
  "contextual-lifecycle": true,
65
122
  "directive-class-suffix": true,