Skip to content

Commit ae73e44

Browse files
committed
feat(@schematics/angular): don't generate special package.json and no-any when using --strict
Following feedback from the community, which showed a high number of users found it hard to work with the `no-any` lint rule and also the `sideEffects` package.json file. With DevRel we decided to remove both features when generating a strict workspace and/or application.
1 parent 4e80c00 commit ae73e44

File tree

6 files changed

+3
-42
lines changed

6 files changed

+3
-42
lines changed

packages/schematics/angular/application/index_spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,6 @@ describe('Application Schematic', () => {
289289
});
290290
});
291291

292-
it('sideEffects property should be true when strict mode', async () => {
293-
const options = { ...defaultOptions, projectRoot: '', strict: true };
294-
295-
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
296-
.toPromise();
297-
const content = JSON.parse(tree.readContent('/src/app/package.json'));
298-
expect(content.sideEffects).toBe(false);
299-
});
300-
301-
it('sideEffects package.json should not exist when not in strict mode', async () => {
302-
const options = { ...defaultOptions, projectRoot: '', strict: false };
303-
304-
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
305-
.toPromise();
306-
expect(tree.exists('/src/app/package.json')).toBeFalse();
307-
});
308-
309292
describe('custom projectRoot', () => {
310293
it('should put app files in the right spot', async () => {
311294
const options = { ...defaultOptions, projectRoot: '' };

packages/schematics/angular/application/other-files/package.json.template

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/schematics/angular/application/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"x-user-analytics": 15
108108
},
109109
"strict": {
110-
"description": "Creates an application with stricter build optimization options.",
110+
"description": "Creates an application with stricter bundle budgets settings.",
111111
"type": "boolean",
112112
"default": false
113113
},

packages/schematics/angular/ng-new/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"x-user-analytics": 14
130130
},
131131
"strict": {
132-
"description": "Creates a workspace with stricter type checking and build optimization options.",
132+
"description": "Creates a workspace with stricter type checking and stricter bundle budgets settings.",
133133
"type": "boolean",
134134
"default": false
135135
},

packages/schematics/angular/workspace/files/tslint.json.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
"instance-method"
4343
]
4444
}
45-
],<% if (strict) { %>
46-
"no-any": true,<% } %>
45+
],
4746
"no-console": [
4847
true,
4948
"debug",

packages/schematics/angular/workspace/index_spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,4 @@ describe('Workspace Schematic', () => {
9090
expect(compilerOptions.strict).toBe(true);
9191
expect(angularCompilerOptions.strictTemplates).toBe(true);
9292
});
93-
94-
it('should not add strict lint options when false', async () => {
95-
const tree = await schematicRunner.runSchematicAsync('workspace', { ...defaultOptions, strict: false }).toPromise();
96-
const { rules } = JSON.parse(tree.readContent('/tslint.json'));
97-
expect(rules['no-any']).toBeUndefined();
98-
});
99-
100-
it('should add strict lint options when true', async () => {
101-
const tree = await schematicRunner.runSchematicAsync('workspace', { ...defaultOptions, strict: true }).toPromise();
102-
const { rules } = JSON.parse(tree.readContent('/tslint.json'));
103-
expect(rules['no-any']).toBe(true);
104-
});
10593
});

0 commit comments

Comments
 (0)