From 5986befcdc953c0e8c90c756ac1c89b8c4b66614 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 29 Jul 2021 15:54:21 +0200 Subject: [PATCH] feat(@schematics/angular): remove deprecated options With this change we removed several deprecated `@schematics/angular` deprecated options. BREAKING CHANGE: We removed several deprecated `@schematics/angular` deprecated options. - `lintFix` have been removed from all schematics. `ng lint --fix` should be used instead. - `legacyBrowsers` have been removed from the `application` schematics since IE 11 is no longer supported. - `configuration` has been removed from the `web-worker` as it was unused. - `target` has been removed from the `service-worker` as it was unused. --- docs/design/analytics.md | 1 - packages/angular/pwa/pwa/index_spec.ts | 1 - packages/angular/pwa/pwa/schema.json | 5 -- .../files/.browserslistrc.template | 4 +- .../schematics/angular/application/index.ts | 2 - .../angular/application/index_spec.ts | 19 ----- .../angular/application/schema.json | 12 --- packages/schematics/angular/class/schema.json | 7 -- .../schematics/angular/component/index.ts | 7 +- .../schematics/angular/component/schema.json | 6 -- .../schematics/angular/directive/index.ts | 7 +- .../schematics/angular/directive/schema.json | 6 -- packages/schematics/angular/enum/schema.json | 6 -- packages/schematics/angular/guard/schema.json | 6 -- .../angular/interceptor/schema.json | 6 -- .../schematics/angular/interface/schema.json | 6 -- packages/schematics/angular/library/index.ts | 2 - .../schematics/angular/library/schema.json | 6 -- .../migrations/migration-collection.json | 5 ++ .../migrations/update-13/schematic-options.ts | 55 ++++++++++++++ .../update-13/schematic-options_spec.ts | 76 +++++++++++++++++++ packages/schematics/angular/module/index.ts | 2 - .../schematics/angular/module/schema.json | 6 -- packages/schematics/angular/ng-new/index.ts | 1 - .../schematics/angular/ng-new/schema.json | 6 -- packages/schematics/angular/pipe/index.ts | 7 +- packages/schematics/angular/pipe/schema.json | 7 -- .../angular/service-worker/index_spec.ts | 1 - .../angular/service-worker/schema.d.ts | 22 ------ .../angular/service-worker/schema.json | 5 -- .../schematics/angular/service/schema.json | 6 -- .../angular/utility/generate-from-files.ts | 7 +- .../schematics/angular/utility/lint-fix.ts | 55 -------------- .../angular/web-worker/index_spec.ts | 1 - .../schematics/angular/web-worker/schema.json | 6 -- 35 files changed, 141 insertions(+), 236 deletions(-) create mode 100644 packages/schematics/angular/migrations/update-13/schematic-options.ts create mode 100644 packages/schematics/angular/migrations/update-13/schematic-options_spec.ts delete mode 100644 packages/schematics/angular/service-worker/schema.d.ts delete mode 100644 packages/schematics/angular/utility/lint-fix.ts diff --git a/docs/design/analytics.md b/docs/design/analytics.md index 88fcd37b8247..1f502b6ea59a 100644 --- a/docs/design/analytics.md +++ b/docs/design/analytics.md @@ -58,7 +58,6 @@ Note: There's a limit of 20 custom dimensions. | 12 | `Flag: --skip-tests` | `boolean` | | 13 | `Flag: --aot` | `boolean` | | 14 | `Flag: --minimal` | `boolean` | -| 15 | `Flag: --lint-fix` | `boolean` | | 16 | `Flag: --optimization` | `boolean` | | 17 | `Flag: --routing` | `boolean` | | 18 | `Flag: --skip-import` | `boolean` | diff --git a/packages/angular/pwa/pwa/index_spec.ts b/packages/angular/pwa/pwa/index_spec.ts index a5cc155950f7..35d0a47026a3 100644 --- a/packages/angular/pwa/pwa/index_spec.ts +++ b/packages/angular/pwa/pwa/index_spec.ts @@ -18,7 +18,6 @@ describe('PWA Schematic', () => { const defaultOptions: PwaOptions = { project: 'bar', target: 'build', - configuration: 'production', title: 'Fake Title', }; diff --git a/packages/angular/pwa/pwa/schema.json b/packages/angular/pwa/pwa/schema.json index 9f37b9dfb7ea..ff41cebe8335 100644 --- a/packages/angular/pwa/pwa/schema.json +++ b/packages/angular/pwa/pwa/schema.json @@ -16,11 +16,6 @@ "description": "The target to apply service worker to.", "default": "build" }, - "configuration": { - "type": "string", - "description": "The configuration to apply service worker to.", - "default": "production" - }, "title": { "type": "string", "description": "The title of the application." diff --git a/packages/schematics/angular/application/files/.browserslistrc.template b/packages/schematics/angular/application/files/.browserslistrc.template index ab263bdbed1d..4f9ac26980c1 100644 --- a/packages/schematics/angular/application/files/.browserslistrc.template +++ b/packages/schematics/angular/application/files/.browserslistrc.template @@ -13,6 +13,4 @@ last 1 Firefox version last 2 Edge major versions last 2 Safari major versions last 2 iOS major versions -Firefox ESR<% if (legacyBrowsers) { %> -IE 11<% } else { %> -not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.<% } %> +Firefox ESR diff --git a/packages/schematics/angular/application/index.ts b/packages/schematics/angular/application/index.ts index cd599cdb404c..d8ef8d477412 100644 --- a/packages/schematics/angular/application/index.ts +++ b/packages/schematics/angular/application/index.ts @@ -27,7 +27,6 @@ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; import { Schema as ComponentOptions } from '../component/schema'; import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies'; import { latestVersions } from '../utility/latest-versions'; -import { applyLintFix } from '../utility/lint-fix'; import { relativePathToWorkspaceRoot } from '../utility/paths'; import { validateProjectName } from '../utility/validation'; import { getWorkspace, updateWorkspace } from '../utility/workspace'; @@ -324,7 +323,6 @@ export default function (options: ApplicationOptions): Rule { MergeStrategy.Overwrite, ), options.skipPackageJson ? noop() : addDependenciesToPackageJson(options), - options.lintFix ? applyLintFix(appDir) : noop(), ]); }; } diff --git a/packages/schematics/angular/application/index_spec.ts b/packages/schematics/angular/application/index_spec.ts index 213f38683380..b7b6a10698e5 100644 --- a/packages/schematics/angular/application/index_spec.ts +++ b/packages/schematics/angular/application/index_spec.ts @@ -525,25 +525,6 @@ describe('Application Schematic', () => { }); }); - it(`should add support for IE 11 in '.browserslistrc' when 'legacyBrowsers' is true`, async () => { - const options: ApplicationOptions = { ...defaultOptions, legacyBrowsers: true }; - const tree = await schematicRunner - .runSchematicAsync('application', options, workspaceTree) - .toPromise(); - const content = tree.readContent('/projects/foo/.browserslistrc'); - expect(content).not.toContain('not IE 11'); - expect(content).toContain('IE 11'); - }); - - it(`should not add support for IE 11 in '.browserslistrc' when 'legacyBrowsers' is false`, async () => { - const options: ApplicationOptions = { ...defaultOptions, legacyBrowsers: false }; - const tree = await schematicRunner - .runSchematicAsync('application', options, workspaceTree) - .toPromise(); - const content = tree.readContent('/projects/foo/.browserslistrc'); - expect(content).toContain('not IE 11'); - }); - it(`should create kebab-case project folder names with camelCase project name`, async () => { const options: ApplicationOptions = { ...defaultOptions, name: 'myCool' }; const tree = await schematicRunner diff --git a/packages/schematics/angular/application/schema.json b/packages/schematics/angular/application/schema.json index f86ee3a33a4c..37e56c085d3e 100644 --- a/packages/schematics/angular/application/schema.json +++ b/packages/schematics/angular/application/schema.json @@ -101,23 +101,11 @@ "type": "boolean", "default": false }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the application.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." - }, "strict": { "description": "Creates an application with stricter bundle budgets settings.", "type": "boolean", "default": true, "x-user-analytics": 7 - }, - "legacyBrowsers": { - "type": "boolean", - "description": "Add support for legacy browsers like Internet Explorer using differential loading.", - "default": false, - "x-deprecated": "Legacy browsers support is deprecated since version 12. For more information, see https://angular.io/guide/browser-support" } }, "required": ["name"] diff --git a/packages/schematics/angular/class/schema.json b/packages/schematics/angular/class/schema.json index d5a6a24c4b30..e10969584782 100644 --- a/packages/schematics/angular/class/schema.json +++ b/packages/schematics/angular/class/schema.json @@ -38,13 +38,6 @@ "type": "string", "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".", "default": "" - }, - "lintFix": { - "type": "boolean", - "default": false, - "description": "Apply lint fixes after generating the class.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/component/index.ts b/packages/schematics/angular/component/index.ts index 19a0599d0946..d3f79bfae0f4 100644 --- a/packages/schematics/angular/component/index.ts +++ b/packages/schematics/angular/component/index.ts @@ -26,7 +26,6 @@ import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescri import { addDeclarationToModule, addExportToModule } from '../utility/ast-utils'; import { InsertChange } from '../utility/change'; import { buildRelativePath, findModuleFromOptions } from '../utility/find-module'; -import { applyLintFix } from '../utility/lint-fix'; import { parseName } from '../utility/parse-name'; import { validateHtmlSelector, validateName } from '../utility/validation'; import { buildDefaultPath, getWorkspace } from '../utility/workspace'; @@ -158,10 +157,6 @@ export default function (options: ComponentOptions): Rule { move(parsedPath.path), ]); - return chain([ - addDeclarationToNgModule(options), - mergeWith(templateSource), - options.lintFix ? applyLintFix(options.path) : noop(), - ]); + return chain([addDeclarationToNgModule(options), mergeWith(templateSource)]); }; } diff --git a/packages/schematics/angular/component/schema.json b/packages/schematics/angular/component/schema.json index 69ccab208465..115185cf9cb6 100644 --- a/packages/schematics/angular/component/schema.json +++ b/packages/schematics/angular/component/schema.json @@ -125,12 +125,6 @@ "default": false, "description": "The declaring NgModule exports this component.", "x-user-analytics": 19 - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the component.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/directive/index.ts b/packages/schematics/angular/directive/index.ts index 037c003de32a..18a16e993650 100644 --- a/packages/schematics/angular/directive/index.ts +++ b/packages/schematics/angular/directive/index.ts @@ -24,7 +24,6 @@ import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescri import { addDeclarationToModule, addExportToModule } from '../utility/ast-utils'; import { InsertChange } from '../utility/change'; import { buildRelativePath, findModuleFromOptions } from '../utility/find-module'; -import { applyLintFix } from '../utility/lint-fix'; import { parseName } from '../utility/parse-name'; import { validateHtmlSelector } from '../utility/validation'; import { buildDefaultPath, getWorkspace } from '../utility/workspace'; @@ -136,10 +135,6 @@ export default function (options: DirectiveOptions): Rule { move(parsedPath.path), ]); - return chain([ - addDeclarationToNgModule(options), - mergeWith(templateSource), - options.lintFix ? applyLintFix(options.path) : noop(), - ]); + return chain([addDeclarationToNgModule(options), mergeWith(templateSource)]); }; } diff --git a/packages/schematics/angular/directive/schema.json b/packages/schematics/angular/directive/schema.json index e516ff259af0..e56c131608f7 100644 --- a/packages/schematics/angular/directive/schema.json +++ b/packages/schematics/angular/directive/schema.json @@ -74,12 +74,6 @@ "default": false, "description": "The declaring NgModule exports this directive.", "x-user-analytics": 19 - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the directive.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/enum/schema.json b/packages/schematics/angular/enum/schema.json index bb575da10562..bb785e57468b 100644 --- a/packages/schematics/angular/enum/schema.json +++ b/packages/schematics/angular/enum/schema.json @@ -31,12 +31,6 @@ "type": { "type": "string", "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"." - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the enum.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/guard/schema.json b/packages/schematics/angular/guard/schema.json index 5d4ccb2134ad..76c55dfe3e68 100644 --- a/packages/schematics/angular/guard/schema.json +++ b/packages/schematics/angular/guard/schema.json @@ -39,12 +39,6 @@ "$source": "projectName" } }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the guard.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." - }, "implements": { "type": "array", "description": "Specifies which interfaces to implement.", diff --git a/packages/schematics/angular/interceptor/schema.json b/packages/schematics/angular/interceptor/schema.json index ee76df3c72e1..6bc844ef371f 100755 --- a/packages/schematics/angular/interceptor/schema.json +++ b/packages/schematics/angular/interceptor/schema.json @@ -38,12 +38,6 @@ "description": "Do not create \"spec.ts\" test files for the new interceptor.", "default": false, "x-user-analytics": 12 - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the interceptor.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/interface/schema.json b/packages/schematics/angular/interface/schema.json index 5763f1bd7f35..0a949d63d904 100644 --- a/packages/schematics/angular/interface/schema.json +++ b/packages/schematics/angular/interface/schema.json @@ -40,12 +40,6 @@ "$source": "argv", "index": 1 } - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the interface.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/library/index.ts b/packages/schematics/angular/library/index.ts index 35f999c35590..f2d709e1f9e2 100644 --- a/packages/schematics/angular/library/index.ts +++ b/packages/schematics/angular/library/index.ts @@ -25,7 +25,6 @@ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies'; import { JSONFile } from '../utility/json-file'; import { latestVersions } from '../utility/latest-versions'; -import { applyLintFix } from '../utility/lint-fix'; import { relativePathToWorkspaceRoot } from '../utility/paths'; import { validateProjectName } from '../utility/validation'; import { getWorkspace, updateWorkspace } from '../utility/workspace'; @@ -197,7 +196,6 @@ export default function (options: LibraryOptions): Rule { path: sourceDir, project: projectName, }), - options.lintFix ? applyLintFix(sourceDir) : noop(), (_tree: Tree, context: SchematicContext) => { if (!options.skipPackageJson && !options.skipInstall) { context.addTask(new NodePackageInstallTask()); diff --git a/packages/schematics/angular/library/schema.json b/packages/schematics/angular/library/schema.json index 418941b419d7..28cfed5098f9 100644 --- a/packages/schematics/angular/library/schema.json +++ b/packages/schematics/angular/library/schema.json @@ -43,12 +43,6 @@ "type": "boolean", "default": false, "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." - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the library.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": [] diff --git a/packages/schematics/angular/migrations/migration-collection.json b/packages/schematics/angular/migrations/migration-collection.json index d339c9fc98f8..0b2713c3b88b 100644 --- a/packages/schematics/angular/migrations/migration-collection.json +++ b/packages/schematics/angular/migrations/migration-collection.json @@ -129,6 +129,11 @@ "version": "9999.0.0", "factory": "./update-12/production-default-config", "description": "Optional migration to update Angular CLI workspace configurations to 'production' mode by default." + }, + "schematic-options-13": { + "version": "13.0.0", + "factory": "./update-13/schematic-options", + "description": "Remove no longer valid Angular schematic options from `angular.json`." } } } diff --git a/packages/schematics/angular/migrations/update-13/schematic-options.ts b/packages/schematics/angular/migrations/update-13/schematic-options.ts new file mode 100644 index 000000000000..2e3ebba60e69 --- /dev/null +++ b/packages/schematics/angular/migrations/update-13/schematic-options.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import { json } from '@angular-devkit/core'; +import { Rule } from '@angular-devkit/schematics'; +import { updateWorkspace } from '../../utility/workspace'; + +export default function (): Rule { + return updateWorkspace((workspace) => { + // Update root level schematics options if present + const rootSchematics = workspace.extensions.schematics; + if (rootSchematics && json.isJsonObject(rootSchematics)) { + updateSchematicsField(rootSchematics); + } + + // Update project level schematics options if present + for (const [, project] of workspace.projects) { + const projectSchematics = project.extensions.schematics; + if (projectSchematics && json.isJsonObject(projectSchematics)) { + updateSchematicsField(projectSchematics); + } + } + }); +} + +function updateSchematicsField(schematics: json.JsonObject): void { + for (const [schematicName, schematicOptions] of Object.entries(schematics)) { + if (!json.isJsonObject(schematicOptions)) { + continue; + } + + if (schematicName.startsWith('@schematics/angular')) { + delete schematicOptions.lintFix; + } + + switch (schematicName) { + case '@schematics/angular:service-worker': + delete schematicOptions.configuration; + break; + case '@schematics/angular:web-worker': + delete schematicOptions.target; + break; + case '@schematics/angular:application': + delete schematicOptions.legacyBrowsers; + break; + default: + break; + } + } +} diff --git a/packages/schematics/angular/migrations/update-13/schematic-options_spec.ts b/packages/schematics/angular/migrations/update-13/schematic-options_spec.ts new file mode 100644 index 000000000000..4c0907f307f0 --- /dev/null +++ b/packages/schematics/angular/migrations/update-13/schematic-options_spec.ts @@ -0,0 +1,76 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import { EmptyTree } from '@angular-devkit/schematics'; +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; + +describe('Migration to remove schematics old options in angular.json', () => { + const workspacePath = '/angular.json'; + const schematicName = 'schematic-options-13'; + + const schematicRunner = new SchematicTestRunner( + 'migrations', + require.resolve('../migration-collection.json'), + ); + + let tree: UnitTestTree; + + beforeEach(async () => { + tree = new UnitTestTree(new EmptyTree()); + tree = await schematicRunner + .runExternalSchematicAsync( + require.resolve('../../collection.json'), + 'ng-new', + { + name: 'migration-test', + version: '1.2.3', + directory: '.', + }, + tree, + ) + .toPromise(); + }); + + describe('schematic options', () => { + it('should remove `skipTests` from `@schematics/angular`', async () => { + const workspace = JSON.parse(tree.readContent(workspacePath)); + workspace.schematics = { + '@schematics/angular:module': { + lintFix: true, + }, + }; + tree.overwrite(workspacePath, JSON.stringify(workspace, undefined, 2)); + + const tree2 = await schematicRunner + .runSchematicAsync(schematicName, {}, tree.branch()) + .toPromise(); + const { schematics } = JSON.parse(tree2.readContent(workspacePath)); + expect(schematics['@schematics/angular:module'].lintFix).toBeUndefined(); + }); + + it('should not remove `lintFix` from non `@schematics/angular` schematic', async () => { + const workspace = JSON.parse(tree.readContent(workspacePath)); + workspace.schematics = { + '@schematics/angular:component': { + lintFix: true, + }, + '@custom/some-other:module': { + lintFix: true, + }, + }; + tree.overwrite(workspacePath, JSON.stringify(workspace, undefined, 2)); + + const tree2 = await schematicRunner + .runSchematicAsync(schematicName, {}, tree.branch()) + .toPromise(); + const { schematics } = JSON.parse(tree2.readContent(workspacePath)); + expect(schematics['@schematics/angular:component'].lintFix).toBeUndefined(); + expect(schematics['@custom/some-other:module'].lintFix).toBeTrue(); + }); + }); +}); diff --git a/packages/schematics/angular/module/index.ts b/packages/schematics/angular/module/index.ts index efc43130bd09..3f9cf17e3fbc 100644 --- a/packages/schematics/angular/module/index.ts +++ b/packages/schematics/angular/module/index.ts @@ -31,7 +31,6 @@ import { buildRelativePath, findModuleFromOptions, } from '../utility/find-module'; -import { applyLintFix } from '../utility/lint-fix'; import { parseName } from '../utility/parse-name'; import { createDefaultPath } from '../utility/workspace'; import { Schema as ModuleOptions, RoutingScope } from './schema'; @@ -190,7 +189,6 @@ export default function (options: ModuleOptions): Rule { addRouteDeclarationToNgModule(options, routingModulePath), mergeWith(templateSource), isLazyLoadedModuleGen ? schematic('component', componentOptions) : noop(), - options.lintFix ? applyLintFix(options.path) : noop(), ]); }; } diff --git a/packages/schematics/angular/module/schema.json b/packages/schematics/angular/module/schema.json index fe8716c2162f..bd7c65225d49 100644 --- a/packages/schematics/angular/module/schema.json +++ b/packages/schematics/angular/module/schema.json @@ -59,12 +59,6 @@ "type": "string", "description": "The declaring NgModule.", "alias": "m" - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the module.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/ng-new/index.ts b/packages/schematics/angular/ng-new/index.ts index fb57365c41b0..50a02b7a10fd 100644 --- a/packages/schematics/angular/ng-new/index.ts +++ b/packages/schematics/angular/ng-new/index.ts @@ -63,7 +63,6 @@ export default function (options: NgNewOptions): Rule { skipInstall: true, strict: options.strict, minimal: options.minimal, - legacyBrowsers: options.legacyBrowsers || undefined, }; return chain([ diff --git a/packages/schematics/angular/ng-new/schema.json b/packages/schematics/angular/ng-new/schema.json index 33cac6a11bf3..15b3c184ec02 100644 --- a/packages/schematics/angular/ng-new/schema.json +++ b/packages/schematics/angular/ng-new/schema.json @@ -134,12 +134,6 @@ "default": true, "x-user-analytics": 7 }, - "legacyBrowsers": { - "type": "boolean", - "description": "Add support for legacy browsers like Internet Explorer using differential loading.", - "default": false, - "x-deprecated": "Legacy browsers support is deprecated since version 12. For more information, see https://angular.io/guide/browser-support" - }, "packageManager": { "description": "The package manager used to install dependencies.", "type": "string", diff --git a/packages/schematics/angular/pipe/index.ts b/packages/schematics/angular/pipe/index.ts index 858c51225b9a..6aa5c516d3bf 100644 --- a/packages/schematics/angular/pipe/index.ts +++ b/packages/schematics/angular/pipe/index.ts @@ -24,7 +24,6 @@ import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescri import { addDeclarationToModule, addExportToModule } from '../utility/ast-utils'; import { InsertChange } from '../utility/change'; import { buildRelativePath, findModuleFromOptions } from '../utility/find-module'; -import { applyLintFix } from '../utility/lint-fix'; import { parseName } from '../utility/parse-name'; import { createDefaultPath } from '../utility/workspace'; import { Schema as PipeOptions } from './schema'; @@ -113,10 +112,6 @@ export default function (options: PipeOptions): Rule { move(parsedPath.path), ]); - return chain([ - addDeclarationToNgModule(options), - mergeWith(templateSource), - options.lintFix ? applyLintFix(options.path) : noop(), - ]); + return chain([addDeclarationToNgModule(options), mergeWith(templateSource)]); }; } diff --git a/packages/schematics/angular/pipe/schema.json b/packages/schematics/angular/pipe/schema.json index d65280d30555..230785ae3bb8 100644 --- a/packages/schematics/angular/pipe/schema.json +++ b/packages/schematics/angular/pipe/schema.json @@ -55,13 +55,6 @@ "default": false, "description": "The declaring NgModule exports this pipe.", "x-user-analytics": 19 - }, - "lintFix": { - "type": "boolean", - "default": false, - "description": "Apply lint fixes after generating the pipe.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/service-worker/index_spec.ts b/packages/schematics/angular/service-worker/index_spec.ts index 8b3b9cdef1ad..be555e0f3fd4 100644 --- a/packages/schematics/angular/service-worker/index_spec.ts +++ b/packages/schematics/angular/service-worker/index_spec.ts @@ -19,7 +19,6 @@ describe('Service Worker Schematic', () => { const defaultOptions: ServiceWorkerOptions = { project: 'bar', target: 'build', - configuration: '', }; let appTree: UnitTestTree; diff --git a/packages/schematics/angular/service-worker/schema.d.ts b/packages/schematics/angular/service-worker/schema.d.ts deleted file mode 100644 index d2fa68faa33a..000000000000 --- a/packages/schematics/angular/service-worker/schema.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -export interface Schema { - /** - * The name of the project. - */ - project: string; - /** - * The target to apply service worker to. - */ - target: string; - /** - * The configuration to apply service worker to. - */ - configuration: string; -} diff --git a/packages/schematics/angular/service-worker/schema.json b/packages/schematics/angular/service-worker/schema.json index e1399b728a5d..af19ad3384fe 100644 --- a/packages/schematics/angular/service-worker/schema.json +++ b/packages/schematics/angular/service-worker/schema.json @@ -17,11 +17,6 @@ "type": "string", "description": "The target to apply service worker to.", "default": "build" - }, - "configuration": { - "type": "string", - "description": "The configuration to apply service worker to.", - "x-deprecated": "No longer has an effect." } }, "required": ["project"] diff --git a/packages/schematics/angular/service/schema.json b/packages/schematics/angular/service/schema.json index 50674b0109dd..5c389303934a 100644 --- a/packages/schematics/angular/service/schema.json +++ b/packages/schematics/angular/service/schema.json @@ -38,12 +38,6 @@ "description": "Do not create \"spec.ts\" test files for the new service.", "default": false, "x-user-analytics": 12 - }, - "lintFix": { - "type": "boolean", - "description": "Apply lint fixes after generating the service.", - "x-user-analytics": 15, - "x-deprecated": "Use \"ng lint --fix\" directly instead." } }, "required": ["name"] diff --git a/packages/schematics/angular/utility/generate-from-files.ts b/packages/schematics/angular/utility/generate-from-files.ts index 7a5446e40bca..5392bb545065 100644 --- a/packages/schematics/angular/utility/generate-from-files.ts +++ b/packages/schematics/angular/utility/generate-from-files.ts @@ -19,13 +19,11 @@ import { noop, url, } from '@angular-devkit/schematics'; -import { applyLintFix } from './lint-fix'; import { parseName } from './parse-name'; import { createDefaultPath } from './workspace'; export interface GenerateFromFilesOptions { flat?: boolean; - lintFix?: boolean; name: string; path?: string; prefix?: string; @@ -56,9 +54,6 @@ export function generateFromFiles( move(parsedPath.path + (options.flat ? '' : '/' + strings.dasherize(options.name))), ]); - return chain([ - mergeWith(templateSource), - options.lintFix ? applyLintFix(options.path) : noop(), - ]); + return chain([mergeWith(templateSource)]); }; } diff --git a/packages/schematics/angular/utility/lint-fix.ts b/packages/schematics/angular/utility/lint-fix.ts deleted file mode 100644 index 78994b2d3706..000000000000 --- a/packages/schematics/angular/utility/lint-fix.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import { - DirEntry, - Rule, - SchematicContext, - SchematicsException, - Tree, -} from '@angular-devkit/schematics'; -import { TslintFixTask } from '@angular-devkit/schematics/tasks'; - -export function applyLintFix(path = '/'): Rule { - return (tree: Tree, context: SchematicContext) => { - // Find the closest tslint.json or tslint.yaml - let dir: DirEntry | null = tree.getDir(path.substr(0, path.lastIndexOf('/'))); - - do { - if ((dir.subfiles as string[]).some((f) => f === 'tslint.json' || f === 'tslint.yaml')) { - break; - } - - dir = dir.parent; - } while (dir !== null); - - if (dir === null) { - throw new SchematicsException( - 'Asked to run lint fixes, but could not find a tslint.json or tslint.yaml config file.', - ); - } - - // Only include files that have been touched. - const files = tree.actions.reduce((acc: Set, action) => { - const path = action.path.substr(1); // Remove the starting '/'. - if (path.endsWith('.ts') && dir && action.path.startsWith(dir.path)) { - acc.add(path); - } - - return acc; - }, new Set()); - - context.addTask( - new TslintFixTask({ - ignoreErrors: true, - tsConfigPath: 'tsconfig.json', - files: [...files], - }), - ); - }; -} diff --git a/packages/schematics/angular/web-worker/index_spec.ts b/packages/schematics/angular/web-worker/index_spec.ts index c10c4f74b625..25f476c84204 100644 --- a/packages/schematics/angular/web-worker/index_spec.ts +++ b/packages/schematics/angular/web-worker/index_spec.ts @@ -19,7 +19,6 @@ describe('Web Worker Schematic', () => { ); const defaultOptions: WebWorkerOptions = { project: 'bar', - target: 'build', name: 'app', snippet: true, }; diff --git a/packages/schematics/angular/web-worker/schema.json b/packages/schematics/angular/web-worker/schema.json index 6f4f929f0190..f1370164479b 100644 --- a/packages/schematics/angular/web-worker/schema.json +++ b/packages/schematics/angular/web-worker/schema.json @@ -19,12 +19,6 @@ "$source": "projectName" } }, - "target": { - "type": "string", - "description": "The target to apply web worker to.", - "default": "build", - "x-deprecated": "No longer has an effect." - }, "name": { "type": "string", "description": "The name of the worker.",