Skip to content

Commit 16e6ba9

Browse files
authored
refactor: upgrade prettier to support new Angular syntax (#1604)
1 parent 44b29cf commit 16e6ba9

File tree

223 files changed

+911
-1205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+911
-1205
lines changed

.all-contributorsrc

+130-442
Large diffs are not rendered by default.

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"singleQuote": true,
33
"overrides": [
4+
{
5+
"files": "*.md",
6+
"options": {
7+
"printWidth": 80
8+
}
9+
},
410
{
511
"files": "*.analog",
612
"options": {

apps/analog-app-e2e-cypress/src/e2e/cart.cy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Cart', () => {
1515
onBeforeLoad: (win) => {
1616
cy.stub(win.console, 'warn').as('consoleWarn');
1717
},
18-
})
18+
}),
1919
);
2020

2121
it(`Given the user has added a phone to the cart
@@ -33,7 +33,7 @@ describe('Cart', () => {
3333
cart.navigateTo();
3434

3535
Object.values(phones).forEach((phone) =>
36-
cart.getPriceByName(phone.name).contains(phone.price)
36+
cart.getPriceByName(phone.name).contains(phone.price),
3737
);
3838
});
3939

@@ -55,7 +55,7 @@ describe('Cart', () => {
5555
cy.get('@consoleWarn').should(
5656
'have.been.calledWithMatch',
5757
/your order has been submitted/i,
58-
{ name, address }
58+
{ name, address },
5959
);
6060
cart.getItems().should('not.exist');
6161
});

apps/analog-app-e2e-cypress/src/e2e/products.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Products', () => {
2020

2121
cy.on('window:alert', (alert) => {
2222
expect(alert).to.contain(
23-
/you will be notified when the product goes on sale/i
23+
/you will be notified when the product goes on sale/i,
2424
);
2525
});
2626
});

apps/analog-app-e2e-playwright/tests/app.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('My Store', () => {
3232
test(`Given the user has navigated to the home page
3333
Then the app title is visible`, async () => {
3434
await expect(
35-
page.locator('role=heading[level=1] >> text=My Store')
35+
page.locator('role=heading[level=1] >> text=My Store'),
3636
).toContain(/My Store/i);
3737
});
3838
});

apps/analog-app-e2e-playwright/tests/cart.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Cart', () => {
7070
});
7171
await cartPage.navigateTo();
7272
expect(
73-
await cartPage.getPriceByName(phone.name, phone.price).elementHandle()
73+
await cartPage.getPriceByName(phone.name, phone.price).elementHandle(),
7474
).toBeTruthy();
7575
});
7676

@@ -92,12 +92,12 @@ describe('Cart', () => {
9292

9393
for (const phone of allPhones) {
9494
expect(
95-
await cartPage.getPriceByName(phone.name, phone.price).elementHandle()
95+
await cartPage.getPriceByName(phone.name, phone.price).elementHandle(),
9696
).toBeTruthy();
9797
}
9898

9999
expect(await cartPage.cartItems().elementHandles()).toHaveLength(
100-
allPhones.length
100+
allPhones.length,
101101
);
102102
});
103103

@@ -132,7 +132,7 @@ describe('Cart', () => {
132132
await cartPage.purchaseOrder();
133133

134134
expect(await message[0].evaluate((p) => p)).toMatch(
135-
/your order has been submitted/i
135+
/your order has been submitted/i,
136136
);
137137
expect(await message[1].evaluate((p) => p)).toEqual({ name, address });
138138
expect(await cartPage.cartItems().elementHandles()).toHaveLength(0);

apps/analog-app-e2e-playwright/tests/products.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('Products', () => {
6363

6464
await productsListPage.getNotifyButtonByName(phones.xl.name).click();
6565
expect(dialogMessage).toMatch(
66-
/you will be notified when the product goes on sale/i
66+
/you will be notified when the product goes on sale/i,
6767
);
6868
});
6969

@@ -75,7 +75,7 @@ describe('Products', () => {
7575
const phone = phones.standard;
7676
await productsListPage.navigateToDetail(phone.name);
7777
expect(await productDetailPage.getPrice().textContent()).toContain(
78-
phone.price
78+
phone.price,
7979
);
8080
});
8181

apps/analog-app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

apps/analog-app/src/app/app.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export const appConfig: ApplicationConfig = {
2525
provideFileRouter(
2626
withNavigationErrorHandler(console.error),
2727
withDebugRoutes(),
28-
withExtraRoutes(fallbackRoutes)
28+
withExtraRoutes(fallbackRoutes),
2929
),
3030
provideHttpClient(
3131
withFetch(),
32-
withInterceptors([requestContextInterceptor])
32+
withInterceptors([requestContextInterceptor]),
3333
),
3434
provideClientHydration(withEventReplay()),
3535
],

apps/analog-app/src/app/cart.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class CartService {
2525

2626
getShippingPrices() {
2727
return this.http.get<{ type: string; price: number }[]>(
28-
'/assets/shipping.json'
28+
'/assets/shipping.json',
2929
);
3030
}
3131
}

apps/analog-app/src/app/pages/newsletter.page.ts

+19-18
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,25 @@ type FormErrors =
1616
<h3>Newsletter Signup</h3>
1717
1818
@if (!signedUp()) {
19-
<form
20-
method="post"
21-
(onSuccess)="onSuccess()"
22-
(onError)="onError($any($event))"
23-
(onStateChange)="errors.set(undefined)"
24-
>
25-
<div>
26-
<label for="email"> Email </label>
27-
<input type="email" name="email" />
28-
</div>
29-
30-
<button class="button" type="submit">Submit</button>
31-
</form>
32-
33-
@if( errors()?.email ) {
34-
<p>{{ errors()?.email }}</p>
35-
} } @else {
36-
<div>Thanks for signing up!</div>
19+
<form
20+
method="post"
21+
(onSuccess)="onSuccess()"
22+
(onError)="onError($any($event))"
23+
(onStateChange)="errors.set(undefined)"
24+
>
25+
<div>
26+
<label for="email"> Email </label>
27+
<input type="email" name="email" />
28+
</div>
29+
30+
<button class="button" type="submit">Submit</button>
31+
</form>
32+
33+
@if (errors()?.email) {
34+
<p>{{ errors()?.email }}</p>
35+
}
36+
} @else {
37+
<div>Thanks for signing up!</div>
3738
}
3839
`,
3940
})

apps/analog-app/src/app/pages/products.[productId].page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class ProductDetailsComponent implements OnInit {
4242
.subscribe((products) => {
4343
// Find the product that correspond with the id provided in route.
4444
this.product = products.find(
45-
(product) => product.id === productIdFromRoute
45+
(product) => product.id === productIdFromRoute,
4646
);
4747
});
4848
}

apps/analog-app/src/app/pages/search.page.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import type { load } from './search.server';
1919
<button class="button" type="submit">Submit</button>
2020
</form>
2121
22-
@if(searchTerm()) {
23-
<p>Search Term: {{ searchTerm() }}</p>
22+
@if (searchTerm()) {
23+
<p>Search Term: {{ searchTerm() }}</p>
2424
}
2525
`,
2626
})

apps/analog-app/src/main-cf.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function bootstrap() {
1919
export default async function render(
2020
url: string,
2121
document: string,
22-
serverContext: ServerContext
22+
serverContext: ServerContext,
2323
) {
2424
const html = await renderApplication(bootstrap, {
2525
document,

apps/analog-app/src/test-setup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import { getTestBed } from '@angular/core/testing';
88

99
getTestBed().initTestEnvironment(
1010
BrowserDynamicTestingModule,
11-
platformBrowserDynamicTesting()
11+
platformBrowserDynamicTesting(),
1212
);

apps/analog-preset-e2e/tests/analog-preset.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('analog-preset-e2e', () => {
88

99
await runCommandAsync(
1010
`npx create-nx-workspace@latest ${project} --preset @analogjs/platform --analogAppName analog-app --no-nx-cloud`,
11-
{ cwd: process.cwd() }
11+
{ cwd: process.cwd() },
1212
);
1313

1414
await runCommandAsync(`nx test analog-app`, {
@@ -20,7 +20,7 @@ describe('analog-preset-e2e', () => {
2020
});
2121

2222
expect(() =>
23-
checkFilesExist(`${tmpDir}/dist/analog-app/client/index.html`)
23+
checkFilesExist(`${tmpDir}/dist/analog-app/client/index.html`),
2424
).not.toThrow();
2525

2626
rmdirSync(tmpDir, { recursive: true });

apps/astro-app-e2e-playwright/tests/app.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@ describe.skip('AstroApp', () => {
3333
describe('Given the user has navigated to the home page', () => {
3434
test('Then client side rendered CardComponent is rendered', async () => {
3535
const componentLocator = page.locator(
36-
'astro-island[component-export="CardComponent"]'
36+
'astro-island[component-export="CardComponent"]',
3737
);
3838
await expect(
39-
componentLocator.locator('>> text=Angular (Client Side)')
39+
componentLocator.locator('>> text=Angular (Client Side)'),
4040
).toContain(/Angular \(Client Side\)/i);
4141
});
4242

4343
test('Then server side rendered CardComponent is rendered', async () => {
4444
const componentLocator = page.locator('astro-card');
4545
await expect(
46-
componentLocator.locator('>> text=Angular (server side binding)')
46+
componentLocator.locator('>> text=Angular (server side binding)'),
4747
).toContain(/Angular \(server side binding\)/i);
4848
});
4949

5050
test.skip('Then client side rendered CardComponent should emit an event on click', async () => {
5151
const console = waitForConsole();
5252
const componentLocator = page.locator(
53-
'[data-analog-id=card-component-1]'
53+
'[data-analog-id=card-component-1]',
5454
);
5555
const elementLocator = componentLocator.locator('li');
5656
await elementLocator.click();
5757

5858
await expect(await console).toBe(
59-
'event received from card-component-1: clicked'
59+
'event received from card-component-1: clicked',
6060
);
6161
});
6262
});
@@ -68,7 +68,7 @@ describe.skip('AstroApp', () => {
6868
it('Then an Angular component should be rendered', async () => {
6969
const componentLocator = page.locator('astro-card');
7070
await expect(componentLocator.locator('>> text=Angular')).toContain(
71-
/Angular/
71+
/Angular/,
7272
);
7373
});
7474
});

apps/blog-app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

apps/blog-app/src/app/app.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export const appConfig: ApplicationConfig = {
1717
withMarkdownRenderer({
1818
loadMermaid: !import.meta.env.SSR ? () => import('mermaid') : undefined,
1919
}),
20-
withShikiHighlighter()
20+
withShikiHighlighter(),
2121
),
2222
provideFileRouter(
2323
withInMemoryScrolling({ anchorScrolling: 'enabled' }),
24-
withEnabledBlockingInitialNavigation()
24+
withEnabledBlockingInitialNavigation(),
2525
),
2626
],
2727
};

apps/blog-app/src/app/pages/archived/[slug].page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export default class ArchivedPostComponent {
4444
readonly toc$ = this.post$.pipe(
4545
map(() => {
4646
return this.renderer.getContentHeadings();
47-
})
47+
}),
4848
);
4949
}

apps/blog-app/src/app/pages/archived/resolvers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ArchivedPostAttributes } from './models';
55

66
// temporary
77
function injectActivePostAttributes(
8-
route: ActivatedRouteSnapshot
8+
route: ActivatedRouteSnapshot,
99
): ArchivedPostAttributes {
1010
const file = injectContentFiles<ArchivedPostAttributes>().find(
1111
(contentFile) => {
@@ -14,7 +14,7 @@ function injectActivePostAttributes(
1414
`/src/content/archived/${route.params['slug']}.md` ||
1515
contentFile.slug === route.params['slug']
1616
);
17-
}
17+
},
1818
);
1919

2020
return file!.attributes;

apps/blog-app/src/app/pages/blog/[slug].page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ export default class BlogPostComponent {
4141
readonly toc$ = this.post$.pipe(
4242
map(() => {
4343
return this.renderer.getContentHeadings();
44-
})
44+
}),
4545
);
4646
}

apps/blog-app/src/app/pages/blog/resolvers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PostAttributes } from './models';
66

77
// temporary
88
function injectActivePostAttributes(
9-
route: ActivatedRouteSnapshot
9+
route: ActivatedRouteSnapshot,
1010
): PostAttributes {
1111
const file = injectContentFiles<PostAttributes>().find((contentFile) => {
1212
return (

apps/blog-app/src/server/routes/v1/[...slug].ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ImageResponse } from '@analogjs/content/og';
44

55
export default defineEventHandler(async (event) => {
66
const fontFile = await fetch(
7-
'https://og-playground.vercel.app/inter-latin-ext-700-normal.woff'
7+
'https://og-playground.vercel.app/inter-latin-ext-700-normal.woff',
88
);
99
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
1010
const query = getQuery(event); // query params

0 commit comments

Comments
 (0)