Skip to content

Commit f5a1b35

Browse files
authored
style: format whole project with prettier (#194)
Formats the whole project with prettier and integrate a prettier check into CI
1 parent 9e4b5f6 commit f5a1b35

File tree

120 files changed

+1296
-959
lines changed

Some content is hidden

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

120 files changed

+1296
-959
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
node-version: '18'
2020
cache: "pnpm"
2121
- run: pnpm install --frozen-lockfile
22+
- run: pnpm run format:check
2223
- run: pnpm run lint:all
2324
- run: pnpm run test:all
2425
- run: pnpm run test:e2e

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true,
3+
"plugins": ["prettier-plugin-organize-imports"]
34
}

.vscode/settings.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"files.exclude": {
3-
"**/.git": true,
4-
"**/.svn": true,
5-
"**/.hg": true,
6-
"**/CVS": true,
7-
"**/.DS_Store": true,
8-
"**/Thumbs.db": true
9-
},
10-
"hide-files.files": []
11-
}
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.svn": true,
5+
"**/.hg": true,
6+
"**/CVS": true,
7+
"**/.DS_Store": true,
8+
"**/Thumbs.db": true
9+
},
10+
"hide-files.files": []
11+
}

CONTRIBUTING.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ This document describes how we manage Angular version compatibility, branching,
88

99
We support multiple Angular versions in parallel using **versioned branches** and **matching npm major versions**:
1010

11-
| Git Branch | Angular Version Support | npm Version | npm Tag | Purpose |
12-
|------------|--------------------------|--------------|--------------|----------------------------------|
13-
| `main` | Angular 20+ | `20.x` | `latest` | Active development |
14-
| `v19` | Angular 15–19 | `19.x` | `angular19` | Maintenance only |
15-
| `v20` | Angular 20 | `20.x` | (optional) | Frozen once `main` moves to v21 |
16-
| `v21` | Angular 21 (future) | `21.x` | `latest` | Active once Angular 21 is current |
11+
| Git Branch | Angular Version Support | npm Version | npm Tag | Purpose |
12+
| ---------- | ----------------------- | ----------- | ----------- | --------------------------------- |
13+
| `main` | Angular 20+ | `20.x` | `latest` | Active development |
14+
| `v19` | Angular 15–19 | `19.x` | `angular19` | Maintenance only |
15+
| `v20` | Angular 20 | `20.x` | (optional) | Frozen once `main` moves to v21 |
16+
| `v21` | Angular 21 (future) | `21.x` | `latest` | Active once Angular 21 is current |
1717

1818
---
1919

@@ -37,12 +37,14 @@ src/
3737
Control what is exported in each branch:
3838

3939
### In `main` (Angular 20):
40+
4041
```ts
4142
export * from './src/core';
4243
export * from './src/angular/v20/http-resource-feature';
4344
```
4445

4546
### In `v19`:
47+
4648
```ts
4749
export * from './src/core';
4850
// Do not export v20 or v21 features
@@ -53,6 +55,7 @@ export * from './src/core';
5355
## 🔁 npm Publishing Commands
5456

5557
### From `v19`:
58+
5659
```bash
5760
git checkout v19
5861
npm version 19.x.y
@@ -61,6 +64,7 @@ git push origin v19 --tags
6164
```
6265

6366
### From `main` (Angular 20):
67+
6468
```bash
6569
git checkout main
6670
npm version 20.x.y
@@ -69,6 +73,7 @@ git push origin main --tags
6973
```
7074

7175
### When Angular 21 is released:
76+
7277
```bash
7378
git checkout main
7479
git checkout -b v20 # Freeze Angular 20
@@ -84,11 +89,11 @@ npm publish # This becomes new `latest`
8489
## ❌ Deprecated or Obsolete Features
8590

8691
- If a feature becomes redundant (e.g. `signalFromObservable` now built into Angular):
87-
- **Keep** it in `v19`
88-
- In `main`:
89-
- **Option 1:** Re-export from Angular
90-
- **Option 2:** Mark as `@deprecated`
91-
- **Option 3:** Remove entirely
92+
- **Keep** it in `v19`
93+
- In `main`:
94+
- **Option 1:** Re-export from Angular
95+
- **Option 2:** Mark as `@deprecated`
96+
- **Option 3:** Remove entirely
9297
- No need to move old features to a `legacy/` folder - just delete them per branch. Git history preserves them.
9398

9499
---
@@ -102,6 +107,7 @@ Use a GitHub Actions matrix to test:
102107
- (future) `main` with Angular 21
103108

104109
Each job should:
110+
105111
- Verify `peerDependencies`
106112
- Run build, lint, test
107113

@@ -111,8 +117,8 @@ Each job should:
111117

112118
- All **new development** goes into `main`
113119
- If a feature is **backportable** to Angular 19:
114-
- Cherry-pick into `v19`
115-
- Avoid Angular 20+ APIs in `v19` (like `httpResource`, `linkedSignal`)
120+
- Cherry-pick into `v19`
121+
- Avoid Angular 20+ APIs in `v19` (like `httpResource`, `linkedSignal`)
116122
- Clearly document breaking changes in changelog
117123
- Update `public-api.ts` carefully in each branch
118124

apps/demo/e2e/conditional.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
test.describe('conditional', () => {
44
test.beforeEach(async ({ page }) => {

apps/demo/e2e/devtools.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { test, expect } from '@playwright/test';
21
import { Action } from '@ngrx/store';
2+
import { expect, test } from '@playwright/test';
33

44
test.describe('DevTools', () => {
55
test('DevTools do not throw an error when not available', async ({
@@ -10,7 +10,7 @@ test.describe('DevTools', () => {
1010
page.on('pageerror', (error) => errors.push(error));
1111
await page.getByRole('link', { name: 'DevTools' }).click();
1212
await expect(
13-
page.getByRole('row', { name: 'Go for a walk' })
13+
page.getByRole('row', { name: 'Go for a walk' }),
1414
).toBeVisible();
1515
});
1616

@@ -41,7 +41,7 @@ test.describe('DevTools', () => {
4141
.click();
4242

4343
await expect(
44-
page.getByRole('region', { name: 'Go for a walk' })
44+
page.getByRole('region', { name: 'Go for a walk' }),
4545
).toBeVisible();
4646
await expect(page.getByRole('region', { name: 'Exercise' })).toBeVisible();
4747

@@ -55,7 +55,7 @@ test.describe('DevTools', () => {
5555
.click();
5656

5757
await expect(
58-
page.getByRole('region', { name: 'Go for a walk' })
58+
page.getByRole('region', { name: 'Go for a walk' }),
5959
).toBeHidden();
6060
await expect(page.getByRole('region', { name: 'Exercise' })).toBeHidden();
6161

apps/demo/e2e/feature-factory.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
test.describe('feature factory', () => {
44
test.beforeEach(async ({ page }) => {

apps/demo/e2e/immutable-state.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
test.describe('immutable state', () => {
44
test.beforeEach(async ({ page }) => {
@@ -11,7 +11,7 @@ test.describe('immutable state', () => {
1111
const errorInConsole = page.waitForEvent('console');
1212
await page.getByRole('button', { name: position }).click();
1313
expect((await errorInConsole).text()).toContain(
14-
`Cannot assign to read only property 'id'`
14+
`Cannot assign to read only property 'id'`,
1515
);
1616
});
1717
}
@@ -21,7 +21,7 @@ test.describe('immutable state', () => {
2121
await page.getByRole('textbox').focus();
2222
await page.keyboard.press('Space');
2323
expect((await errorInConsole).text()).toContain(
24-
`Cannot assign to read only property 'name'`
24+
`Cannot assign to read only property 'name'`,
2525
);
2626
});
2727
});

apps/demo/e2e/reset.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
test('has title', async ({ page }) => {
44
await page.goto('');
@@ -13,18 +13,18 @@ test('has title', async ({ page }) => {
1313
.click();
1414

1515
await expect(
16-
page.getByRole('row', { name: 'Go for a walk' }).getByRole('checkbox')
16+
page.getByRole('row', { name: 'Go for a walk' }).getByRole('checkbox'),
1717
).toBeChecked();
1818
await expect(
19-
page.getByRole('row', { name: 'Exercise' }).getByRole('checkbox')
19+
page.getByRole('row', { name: 'Exercise' }).getByRole('checkbox'),
2020
).toBeChecked();
2121

2222
await page.getByRole('button', { name: 'Reset State' }).click();
2323

2424
await expect(
25-
page.getByRole('row', { name: 'Go for a walk' }).getByRole('checkbox')
25+
page.getByRole('row', { name: 'Go for a walk' }).getByRole('checkbox'),
2626
).not.toBeChecked();
2727
await expect(
28-
page.getByRole('row', { name: 'Exercise' }).getByRole('checkbox')
28+
page.getByRole('row', { name: 'Exercise' }).getByRole('checkbox'),
2929
).not.toBeChecked();
3030
});

apps/demo/src/app/app.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import { CommonModule } from '@angular/common';
12
import { Component } from '@angular/core';
2-
import { MatTableModule } from '@angular/material/table';
33
import { MatCheckboxModule } from '@angular/material/checkbox';
44
import { MatIconModule } from '@angular/material/icon';
5-
import { RouterLink, RouterOutlet } from '@angular/router';
6-
import { CommonModule } from '@angular/common';
7-
import { MatToolbarModule } from '@angular/material/toolbar';
85
import { MatListModule } from '@angular/material/list';
96
import {
107
MatDrawer,
118
MatDrawerContainer,
129
MatDrawerContent,
1310
} from '@angular/material/sidenav';
11+
import { MatTableModule } from '@angular/material/table';
12+
import { MatToolbarModule } from '@angular/material/toolbar';
13+
import { RouterLink, RouterOutlet } from '@angular/router';
1414

1515
@Component({
1616
selector: 'demo-root',
@@ -33,7 +33,8 @@ import {
3333
display: inline;
3434
}
3535
.content {
36-
margin: 4em;
37-
}`,
36+
margin: 4em;
37+
}
38+
`,
3839
})
3940
export class AppComponent {}

0 commit comments

Comments
 (0)