source: trip-planner-front/node_modules/@angular/material/schematics/ng-update/migrations/misc-checks/misc-property-names.mjs

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.2 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.MiscPropertyNamesMigration = void 0;
11const schematics_1 = require("@angular/cdk/schematics");
12const ts = require("typescript");
13/**
14 * Migration that walks through every property access expression and and reports a failure if
15 * a given property name no longer exists but cannot be automatically migrated.
16 */
17class MiscPropertyNamesMigration extends schematics_1.Migration {
18 constructor() {
19 super(...arguments);
20 // Only enable this rule if the migration targets version 6. The rule
21 // currently only includes migrations for V6 deprecations.
22 this.enabled = this.targetVersion === schematics_1.TargetVersion.V6;
23 }
24 visitNode(node) {
25 if (ts.isPropertyAccessExpression(node)) {
26 this._visitPropertyAccessExpression(node);
27 }
28 }
29 _visitPropertyAccessExpression(node) {
30 const hostType = this.typeChecker.getTypeAtLocation(node.expression);
31 const typeName = hostType && hostType.symbol && hostType.symbol.getName();
32 // Migration for: https://github.com/angular/components/pull/10398 (v6)
33 if (typeName === 'MatListOption' && node.name.text === 'selectionChange') {
34 this.createFailureAtNode(node, `Found deprecated property "selectionChange" of ` +
35 `class "MatListOption". Use the "selectionChange" property on the ` +
36 `parent "MatSelectionList" instead.`);
37 }
38 // Migration for: https://github.com/angular/components/pull/10413 (v6)
39 if (typeName === 'MatDatepicker' && node.name.text === 'selectedChanged') {
40 this.createFailureAtNode(node, `Found deprecated property "selectedChanged" of ` +
41 `class "MatDatepicker". Use the "dateChange" or "dateInput" methods ` +
42 `on "MatDatepickerInput" instead.`);
43 }
44 }
45}
46exports.MiscPropertyNamesMigration = MiscPropertyNamesMigration;
47//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJma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lvbkNoYW5nZScpIHtcbiAgICAgIHRoaXMuY3JlYXRlRmFpbHVyZUF0Tm9kZShcbiAgICAgICAgICBub2RlLFxuICAgICAgICAgIGBGb3VuZCBkZXByZWNhdGVkIHByb3BlcnR5IFwic2VsZWN0aW9uQ2hhbmdlXCIgb2YgYCArXG4gICAgICAgICAgICAgIGBjbGFzcyBcIk1hdExpc3RPcHRpb25cIi4gVXNlIHRoZSBcInNlbGVjdGlvbkNoYW5nZVwiIHByb3BlcnR5IG9uIHRoZSBgICtcbiAgICAgICAgICAgICAgYHBhcmVudCBcIk1hdFNlbGVjdGlvbkxpc3RcIiBpbnN0ZWFkLmApO1xuICAgIH1cblxuICAgIC8vIE1pZ3JhdGlvbiBmb3I6IGh0dHBzOi8vZ2l0aHViLmNvbS9hbmd1bGFyL2NvbXBvbmVudHMvcHVsbC8xMDQxMyAodjYpXG4gICAgaWYgKHR5cGVOYW1lID09PSAnTWF0RGF0ZXBpY2tlcicgJiYgbm9kZS5uYW1lLnRleHQgPT09ICdzZWxlY3RlZENoYW5nZWQnKSB7XG4gICAgICB0aGlzLmNyZWF0ZUZhaWx1cmVBdE5vZGUoXG4gICAgICAgICAgbm9kZSxcbiAgICAgICAgICBgRm91bmQgZGVwcmVjYXRlZCBwcm9wZXJ0eSBcInNlbGVjdGVkQ2hhbmdlZFwiIG9mIGAgK1xuICAgICAgICAgICAgICBgY2xhc3MgXCJNYXREYXRlcGlja2VyXCIuIFVzZSB0aGUgXCJkYXRlQ2hhbmdlXCIgb3IgXCJkYXRlSW5wdXRcIiBtZXRob2RzIGAgK1xuICAgICAgICAgICAgICBgb24gXCJNYXREYXRlcGlja2VySW5wdXRcIiBpbnN0ZWFkLmApO1xuICAgIH1cbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.