Skip to content

Commit 81e1a28

Browse files
alan-agius4Keen Yee Liau
authored and
Keen Yee Liau
committed
fix(@schematics/angular): remove lint target from minimal projects
Minimal projects are considered as throw-away projects and only a small subset of features are supported. More context #13408 and #13354 Closes #14727
1 parent 4d7388f commit 81e1a28

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

packages/schematics/angular/application/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
261261
scripts: [],
262262
},
263263
},
264-
lint: {
264+
lint: options.minimal ? undefined : {
265265
builder: Builders.TsLint,
266266
options: {
267267
tsConfig: [

packages/schematics/angular/application/index_spec.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ describe('Application Schematic', () => {
174174
expect(karmaConf).toContain(`dir: require('path').join(__dirname, '../../coverage/foo')`);
175175
});
176176

177-
it('minimal=true should not create e2e and test targets', async () => {
177+
it('minimal=true should not create e2e, lint and test targets', async () => {
178178
const options = { ...defaultOptions, minimal: true };
179179
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
180180
.toPromise();
181181
const config = JSON.parse(tree.readContent('/angular.json'));
182182
const architect = config.projects.foo.architect;
183183
expect(architect.test).not.toBeDefined();
184184
expect(architect.e2e).not.toBeDefined();
185+
expect(architect.e2e).not.toBeDefined();
185186
});
186187

187188
it('should create correct files when using minimal', async () => {
@@ -271,6 +272,18 @@ describe('Application Schematic', () => {
271272
const packageJson = JSON.parse(tree.readContent('package.json'));
272273
expect(packageJson.devDependencies['@angular-devkit/build-angular']).toBeUndefined();
273274
});
275+
276+
it('should set the lint tsConfig option', async () => {
277+
const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree)
278+
.toPromise();
279+
const workspace = JSON.parse(tree.readContent('/angular.json'));
280+
const lintOptions = workspace.projects.foo.architect.lint.options;
281+
expect(lintOptions.tsConfig).toEqual([
282+
'projects/foo/tsconfig.app.json',
283+
'projects/foo/tsconfig.spec.json',
284+
'projects/foo/e2e/tsconfig.json',
285+
]);
286+
});
274287
});
275288

276289
describe('custom projectRoot', () => {

packages/schematics/angular/e2e/index_spec.ts

-12
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,5 @@ describe('Application Schematic', () => {
9898
expect(e2eOptions.protractorConfig).toEqual('projects/foo/e2e/protractor.conf.js');
9999
expect(e2eOptions.devServerTarget).toEqual('foo:serve');
100100
});
101-
102-
it('should set the lint options', async () => {
103-
const tree = await schematicRunner.runSchematicAsync('e2e', defaultOptions, applicationTree)
104-
.toPromise();
105-
const workspace = JSON.parse(tree.readContent('/angular.json'));
106-
const lintOptions = workspace.projects.foo.architect.lint.options;
107-
expect(lintOptions.tsConfig).toEqual([
108-
'projects/foo/tsconfig.app.json',
109-
'projects/foo/tsconfig.spec.json',
110-
'projects/foo/e2e/tsconfig.json',
111-
]);
112-
});
113101
});
114102
});

0 commit comments

Comments
 (0)