Skip to content

Commit 032886d

Browse files
sean-perkinsgithub-actions[bot]
authored andcommitted
chore: prettier formatting
1 parent 44806ee commit 032886d

File tree

3 files changed

+45
-24
lines changed

3 files changed

+45
-24
lines changed

apps/angular/ionic-angular-standalone/src/app/router-link/router-link.page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ import { IonicModule } from '@ionic/angular';
99
imports: [IonicModule],
1010
})
1111
export class RouterLinkPage {
12-
constructor() { }
12+
constructor() {}
1313
}

packages/cli/src/angular/migrations/standalone/0002-import-standalone-component.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe("migrateComponents", () => {
200200
imports: [IonRouterLinkWithHref]
201201
})
202202
export class MyComponent { }
203-
`)
203+
`),
204204
);
205205
});
206206

@@ -236,7 +236,7 @@ describe("migrateComponents", () => {
236236
imports: [IonRouterLinkWithHref]
237237
})
238238
export class MyComponent { }
239-
`)
239+
`),
240240
);
241241
});
242242

@@ -272,7 +272,7 @@ describe("migrateComponents", () => {
272272
imports: [IonRouterLinkWithHref]
273273
})
274274
export class MyComponent { }
275-
`)
275+
`),
276276
);
277277
});
278278
});
@@ -312,7 +312,7 @@ describe("migrateComponents", () => {
312312
imports: [IonRouterLink, IonButton]
313313
})
314314
export class MyComponent { }
315-
`)
315+
`),
316316
);
317317
});
318318

@@ -350,7 +350,7 @@ describe("migrateComponents", () => {
350350
imports: [IonRouterLink, IonButton]
351351
})
352352
export class MyComponent { }
353-
`)
353+
`),
354354
);
355355
});
356356

@@ -388,11 +388,10 @@ describe("migrateComponents", () => {
388388
imports: [IonRouterLink, IonButton]
389389
})
390390
export class MyComponent { }
391-
`)
391+
`),
392392
);
393393
});
394-
})
395-
394+
});
396395
});
397396

398397
describe("single component angular modules", () => {

packages/cli/src/angular/migrations/standalone/0002-import-standalone-component.ts

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ export const migrateComponents = async (
3939
if (sourceFile.getFilePath().endsWith(".html")) {
4040
const htmlAsString = sourceFile.getFullText();
4141

42-
const { skippedIconsHtml, ionIcons, ionicComponents, hasRouterLink, hasRouterLinkWithHref } =
43-
detectIonicComponentsAndIcons(htmlAsString, sourceFile.getFilePath());
42+
const {
43+
skippedIconsHtml,
44+
ionIcons,
45+
ionicComponents,
46+
hasRouterLink,
47+
hasRouterLinkWithHref,
48+
} = detectIonicComponentsAndIcons(htmlAsString, sourceFile.getFilePath());
4449

4550
if (ionicComponents.length > 0 || ionIcons.length > 0) {
4651
const tsSourceFile =
@@ -63,11 +68,16 @@ export const migrateComponents = async (
6368
} else if (sourceFile.getFilePath().endsWith(".ts")) {
6469
const templateAsString = getComponentTemplateAsString(sourceFile);
6570
if (templateAsString) {
66-
const { skippedIconsHtml, ionIcons, ionicComponents, hasRouterLink, hasRouterLinkWithHref } =
67-
detectIonicComponentsAndIcons(
68-
templateAsString,
69-
sourceFile.getFilePath(),
70-
);
71+
const {
72+
skippedIconsHtml,
73+
ionIcons,
74+
ionicComponents,
75+
hasRouterLink,
76+
hasRouterLinkWithHref,
77+
} = detectIonicComponentsAndIcons(
78+
templateAsString,
79+
sourceFile.getFilePath(),
80+
);
7181

7282
await migrateAngularComponentClass(
7383
sourceFile,
@@ -125,7 +135,11 @@ async function migrateAngularComponentClass(
125135
}
126136

127137
if (hasRouterLinkWithHref) {
128-
addImportToClass(sourceFile, "IonRouterLinkWithHref", "@ionic/angular/standalone");
138+
addImportToClass(
139+
sourceFile,
140+
"IonRouterLinkWithHref",
141+
"@ionic/angular/standalone",
142+
);
129143
addImportToComponentDecorator(sourceFile, "IonRouterLinkWithHref");
130144
}
131145

@@ -231,9 +245,13 @@ function detectIonicComponentsAndIcons(htmlAsString: string, filePath: string) {
231245
ionicComponents.push(node.name);
232246
}
233247

234-
const routerLink = node.attributes.find(
235-
(a: any) => a.name === 'routerLink' || a.name == 'routerDirection' || a.name === 'routerAction'
236-
) !== undefined;
248+
const routerLink =
249+
node.attributes.find(
250+
(a: any) =>
251+
a.name === "routerLink" ||
252+
a.name == "routerDirection" ||
253+
a.name === "routerAction",
254+
) !== undefined;
237255

238256
if (!hasRouterLink && routerLink) {
239257
hasRouterLink = true;
@@ -280,10 +298,14 @@ function detectIonicComponentsAndIcons(htmlAsString: string, filePath: string) {
280298
}
281299
}
282300

283-
if (node.name === 'a') {
284-
const routerLinkWithHref = node.attributes.find(
285-
(a: any) => a.name === 'routerLink' || a.name == 'routerDirection' || a.name === 'routerAction'
286-
) !== undefined;
301+
if (node.name === "a") {
302+
const routerLinkWithHref =
303+
node.attributes.find(
304+
(a: any) =>
305+
a.name === "routerLink" ||
306+
a.name == "routerDirection" ||
307+
a.name === "routerAction",
308+
) !== undefined;
287309

288310
if (!hasRouterLinkWithHref && routerLinkWithHref) {
289311
hasRouterLinkWithHref = true;

0 commit comments

Comments
 (0)