Skip to content

Commit b3de106

Browse files
committed
Merge branch 'main' into feat/478-view-only-links
# Conflicts: # src/app/features/files/pages/files/files.component.html # src/app/features/files/pages/files/files.component.ts # src/app/features/project/contributors/components/create-view-link-dialog/create-view-link-dialog.component.ts # src/app/features/project/overview/project-overview.component.ts # src/app/shared/mappers/registration/page-schema.mapper.ts # src/app/shared/stores/addons/addons.state.ts
2 parents 1a37d2c + 81b460d commit b3de106

193 files changed

Lines changed: 3414 additions & 1392 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"id": 7359757,
3+
"name": "All Branch Rules",
4+
"target": "branch",
5+
"source_type": "Repository",
6+
"source": "CenterForOpenScience/angular-osf",
7+
"enforcement": "disabled",
8+
"conditions": {
9+
"ref_name": {
10+
"exclude": ["refs/heads/main", "refs/heads/develop"],
11+
"include": ["~ALL"]
12+
}
13+
},
14+
"rules": [
15+
{
16+
"type": "deletion"
17+
},
18+
{
19+
"type": "required_review_thread_resolution",
20+
"parameters": {
21+
"enabled": true
22+
}
23+
},
24+
{
25+
"type": "pull_request",
26+
"parameters": {
27+
"required_approving_review_count": 1,
28+
"dismiss_stale_reviews_on_push": true,
29+
"require_code_owner_review": false,
30+
"require_last_push_approval": true,
31+
"automatic_copilot_code_review_enabled": false,
32+
"allowed_merge_methods": ["squash"]
33+
}
34+
}
35+
],
36+
"bypass_actors": []
37+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"id": 7359601,
3+
"name": "Main/Develop Branch Rules",
4+
"target": "branch",
5+
"source_type": "Repository",
6+
"source": "CenterForOpenScience/angular-osf",
7+
"enforcement": "active",
8+
"conditions": {
9+
"ref_name": {
10+
"exclude": [],
11+
"include": ["~DEFAULT_BRANCH", "refs/heads/develop"]
12+
}
13+
},
14+
"rules": [
15+
{
16+
"type": "deletion"
17+
},
18+
{
19+
"type": "non_fast_forward"
20+
},
21+
{
22+
"type": "merge_queue",
23+
"parameters": {
24+
"merge_method": "SQUASH",
25+
"max_entries_to_build": 8,
26+
"min_entries_to_merge": 1,
27+
"max_entries_to_merge": 5,
28+
"min_entries_to_merge_wait_minutes": 5,
29+
"grouping_strategy": "ALLGREEN",
30+
"check_response_timeout_minutes": 90
31+
}
32+
},
33+
{
34+
"type": "required_review_thread_resolution",
35+
"parameters": {
36+
"enabled": true
37+
}
38+
},
39+
{
40+
"type": "pull_request",
41+
"parameters": {
42+
"required_approving_review_count": 1,
43+
"dismiss_stale_reviews_on_push": true,
44+
"require_code_owner_review": false,
45+
"require_last_push_approval": true,
46+
"automatic_copilot_code_review_enabled": false,
47+
"allowed_merge_methods": ["squash"]
48+
}
49+
}
50+
],
51+
"bypass_actors": []
52+
}

.github/workflows/review.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/github-script@v7
1919
with:
2020
script: |
21-
const {owner, repo} = context.repo;
21+
const { owner, repo } = context.repo;
2222
2323
// Determine PR number for both pull_request and pull_request_review events
2424
let number;
@@ -41,11 +41,13 @@ jobs:
4141
const latestByUser = new Map();
4242
for (const r of reviews) latestByUser.set(r.user.id, r.state);
4343
44-
// Count approvals
4544
const approvals = [...latestByUser.values()].filter(s => s === 'APPROVED').length;
45+
const hasRequestChanges = [...latestByUser.values()].includes('CHANGES_REQUESTED');
4646
4747
if (approvals < 1) {
4848
core.setFailed(`PR #${number} requires at least one approving review before merging.`);
49+
} else if (hasRequestChanges) {
50+
core.setFailed(`PR #${number} cannot be merged because at least one reviewer has requested changes.`);
4951
} else {
5052
core.info(`Approvals found: ${approvals}. Check passed.`);
5153
}

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ take up to 60 seconds once the docker build finishes.
1717
### First steps
1818

1919
- Install git commit template: [Commit Template](docs/commit.template.md).
20-
- Volta: [Volta](#volta)
20+
- [Volta](#volta)
2121

2222
### Recommended
2323

24-
- Compodoc: [Compodoc Conventions](docs/compodoc.md).
25-
- Docker Commands: [Docker Commands](docs/docker.md).
26-
- Git Conventions: [Git Conventions](docs/git-convention.md).
27-
- NGXS: [NGXS Conventions](docs/ngxs.md).
24+
- [Compodoc Conventions](docs/compodoc.md).
25+
- [Docker Commands](docs/docker.md).
26+
- [ESLint Strategy](docs/eslint.md).
27+
- [Git Conventions](docs/git-convention.md).
28+
- [NGXS Conventions](docs/ngxs.md).
29+
- [Testing Strategy](docs/testing.md).
2830

2931
### Optional
3032

angular.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@
7878
"outputHashing": "none",
7979
"namedChunks": true
8080
},
81+
"local": {
82+
"optimization": false,
83+
"extractLicenses": false,
84+
"sourceMap": true,
85+
"fileReplacements": [
86+
{
87+
"replace": "src/environments/environment.ts",
88+
"with": "src/environments/environment.local.ts"
89+
}
90+
]
91+
},
8192
"development": {
8293
"optimization": false,
8394
"extractLicenses": false,
@@ -101,6 +112,10 @@
101112
"development": {
102113
"buildTarget": "osf:build:development",
103114
"hmr": false
115+
},
116+
"local": {
117+
"buildTarget": "osf:build:local",
118+
"hmr": false
104119
}
105120
},
106121
"defaultConfiguration": "development"

docs/eslint.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Linting Strategy – OSF Angular
2+
3+
---
4+
5+
## Overview
6+
7+
This project uses a **unified, modern ESLint flat config** approach to enforce consistent coding styles, accessibility standards, and TypeScript best practices. Linting runs on:
8+
9+
- TypeScript (`*.ts`)
10+
- HTML templates (`*.html`)
11+
- Specs (`*.spec.ts`)
12+
13+
It also integrates into the **Git workflow** via `pre-commit` hooks to ensure clean, compliant code before every commit.
14+
15+
---
16+
17+
## Linting Commands
18+
19+
```bash
20+
# Run full project lint
21+
npm run lint
22+
```
23+
24+
---
25+
26+
## ESLint Config Structure
27+
28+
### 1. TypeScript Files (`**/*.ts`)
29+
30+
**Extends**:
31+
32+
- `@eslint/js` → base ESLint config
33+
- `typescript-eslint` recommended & stylistic configs
34+
- `angular-eslint` TypeScript rules
35+
- `eslint-plugin-prettier/recommended`
36+
37+
**Plugins**:
38+
39+
- `eslint-plugin-import`
40+
- `eslint-plugin-simple-import-sort`
41+
- `eslint-plugin-unused-imports`
42+
43+
**Key Rules**:
44+
45+
- Enforces Angular selector styles:
46+
- Directives → `osfFoo` (camelCase)
47+
- Components → `<osf-bar>` (kebab-case)
48+
- Enforces import sorting and duplicate prevention
49+
- Removes unused imports automatically
50+
- Allows unused variables named `_` to support convention (e.g., destructuring)
51+
52+
---
53+
54+
### 2. HTML Templates (`**/*.html`)
55+
56+
**Extends**:
57+
58+
- `angular-eslint/templateRecommended`
59+
- `angular-eslint/templateAccessibility`
60+
61+
**Parser**:
62+
63+
- `@angular-eslint/template-parser`
64+
65+
**Key A11y Rules** (All Set to `"error"`):
66+
67+
- `alt-text`
68+
- `valid-aria`
69+
- `click-events-have-key-events`
70+
- `role-has-required-aria`
71+
- `interactive-supports-focus`
72+
- `no-distracting-elements`
73+
- `no-autofocus`
74+
- `label-has-associated-control`
75+
76+
> This enforces **WCAG accessibility compliance** directly in Angular templates.
77+
78+
---
79+
80+
### 3. Test Files (`**/*.spec.ts`)
81+
82+
Loosened restrictions for developer convenience:
83+
84+
```ts
85+
'@typescript-eslint/no-explicit-any': 'off',
86+
'@typescript-eslint/no-empty-function': 'off',
87+
```
88+
89+
---
90+
91+
## Pre-Commit Hook
92+
93+
The `pre-commit` file includes:
94+
95+
- `npx lint-staged` → Lint only **staged files** before every commit
96+
- Ensures **TypeScript and template linting** run automatically
97+
98+
## Summary
99+
100+
| File Type | Purpose | Key Rules |
101+
| ------------ | ------------------------------------- | --------------------------------------- |
102+
| `*.ts` | Lint Angular + TS logic | Unused imports, selector rules, sorting |
103+
| `*.html` | Enforce a11y & Angular best practices | All template a11y rules enforced |
104+
| `*.spec.ts` | Relaxed for test convenience | Some TS rules turned off |
105+
| `pre-commit` | Git hook to lint before committing | Ensures consistent PR quality |

0 commit comments

Comments
 (0)