Skip to content

Commit 9e9d456

Browse files
ci: enable Prettier formatting (#1311)
## This PR Enables Prettier for the repository, adding scripts to the root package for checking + applying formatting. Adds a new CI job to check formatting on PRs (and also moves the lint to there, as I don't think lint needs to run across the Node.js version matrix). I've also added husky + lint-staged to automatically run Prettier against files being committed locally, but happy to pull that back out if folks would prefer not to have that. ### Related Issues Resolves #1302 ### Notes I'd recommend reviewing the commits individually, except the last commit, which was just the result of actually running Prettier. --------- Signed-off-by: MattIPv4 <[email protected]> Co-authored-by: Lukas Reining <[email protected]>
1 parent 7dc79e1 commit 9e9d456

File tree

128 files changed

+1120
-1061
lines changed

Some content is hidden

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

128 files changed

+1120
-1061
lines changed

.github/ISSUE_TEMPLATE/bug.yaml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: 🐞 Bug
22
description: Found a bug? We are sorry about that! Let us know! 🐛
3-
title: "[BUG] "
3+
title: '[BUG] '
44
labels: [bug, Needs Triage]
55
body:
6-
- type: textarea
7-
attributes:
8-
label: Observed behavior
9-
description: What are you trying to do? Describe what you think went wrong during this.
10-
validations:
11-
required: false
12-
- type: textarea
13-
attributes:
14-
label: Expected Behavior
15-
description: A concise description of what you expected to happen.
16-
validations:
17-
required: false
18-
- type: textarea
19-
attributes:
20-
label: Steps to reproduce
21-
description: Describe as best you can the problem. Please provide us scenario file, logs or anything you have that can help us to understand.
22-
validations:
23-
required: false
6+
- type: textarea
7+
attributes:
8+
label: Observed behavior
9+
description: What are you trying to do? Describe what you think went wrong during this.
10+
validations:
11+
required: false
12+
- type: textarea
13+
attributes:
14+
label: Expected Behavior
15+
description: A concise description of what you expected to happen.
16+
validations:
17+
required: false
18+
- type: textarea
19+
attributes:
20+
label: Steps to reproduce
21+
description: Describe as best you can the problem. Please provide us scenario file, logs or anything you have that can help us to understand.
22+
validations:
23+
required: false
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: 📓 Documentation
22
description: Any documentation related issue/addition.
3-
title: "[DOC] "
3+
title: '[DOC] '
44
labels: [documentation, Needs Triage]
55
body:
6-
- type: textarea
7-
attributes:
8-
label: Change in the documentation
9-
description: What should we add/remove/update in the documentation?
10-
validations:
11-
required: false
6+
- type: textarea
7+
attributes:
8+
label: Change in the documentation
9+
description: What should we add/remove/update in the documentation?
10+
validations:
11+
required: false
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: 💡 Feature
22
description: Add new functionality to the project.
3-
title: "[FEATURE] "
3+
title: '[FEATURE] '
44
labels: [enhancement, Needs Triage]
55
body:
6-
- type: textarea
7-
attributes:
8-
label: Requirements
9-
description: |
10-
Ask us what you want! Please provide as many details as possible and describe how it should work.
6+
- type: textarea
7+
attributes:
8+
label: Requirements
9+
description: |
10+
Ask us what you want! Please provide as many details as possible and describe how it should work.
1111
12-
Note: Spec and architecture changes require an [OFEP](https://github.com/open-feature/ofep).
13-
validations:
14-
required: false
12+
Note: Spec and architecture changes require an [OFEP](https://github.com/open-feature/ofep).
13+
validations:
14+
required: false

.github/workflows/audit-pending-releases.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- "release-please**"
4+
- 'release-please**'
55

66
env:
77
CORE_PACKAGE: core
@@ -29,6 +29,6 @@ jobs:
2929
- name: Setup Node
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version-file: ".nvmrc"
33-
registry-url: "https://registry.npmjs.org"
34-
cache: "npm"
32+
node-version-file: '.nvmrc'
33+
registry-url: 'https://registry.npmjs.org'
34+
cache: 'npm'

.github/workflows/coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-node@v4
1717
with:
18-
registry-url: "https://registry.npmjs.org"
19-
node-version-file: ".nvmrc"
20-
cache: "npm"
18+
registry-url: 'https://registry.npmjs.org'
19+
node-version-file: '.nvmrc'
20+
cache: 'npm'
2121

2222
- name: Install
2323
run: npm ci

.github/workflows/dco-merge-group.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: ${{ github.actor != 'renovate[bot]' }}
1111
steps:
12-
- run: echo "dummy DCO workflow (it won't run any check actually) to trigger by merge_group in order to enable merge queue"
12+
- run: echo "dummy DCO workflow (it won't run any check actually) to trigger by merge_group in order to enable merge queue"

.github/workflows/pr-checks.yaml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
merge_group:
1212

1313
jobs:
14-
build-test-lint:
14+
build-test:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
@@ -26,32 +26,48 @@ jobs:
2626
uses: actions/setup-node@v4
2727
with:
2828
node-version: ${{ matrix.node-version }}
29-
cache: "npm"
29+
cache: 'npm'
3030

3131
- name: Install
3232
run: npm ci
3333

3434
- name: Build
3535
run: npm run build
3636

37-
- name: Lint
38-
run: npm run lint
39-
4037
- name: Test Jest Projects
4138
run: npm run test:jest
4239

4340
- name: Test Angular SDK
4441
run: npm run test:angular
4542

43+
format-lint:
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version-file: '.nvmrc'
51+
cache: 'npm'
52+
53+
- name: Install
54+
run: npm ci
55+
56+
- name: Format
57+
run: npm run format
58+
59+
- name: Lint
60+
run: npm run lint
61+
4662
codecov-and-docs:
4763
runs-on: ubuntu-latest
4864

4965
steps:
5066
- uses: actions/checkout@v4
5167
- uses: actions/setup-node@v4
5268
with:
53-
node-version-file: ".nvmrc"
54-
cache: "npm"
69+
node-version-file: '.nvmrc'
70+
cache: 'npm'
5571

5672
- name: Install
5773
run: npm ci
@@ -72,8 +88,8 @@ jobs:
7288
- uses: actions/checkout@v4
7389
- uses: actions/setup-node@v4
7490
with:
75-
node-version-file: ".nvmrc"
76-
cache: "npm"
91+
node-version-file: '.nvmrc'
92+
cache: 'npm'
7793

7894
- name: Install
7995
run: npm ci

.github/workflows/release-please.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
command: manifest
1818
token: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}}
1919
default-branch: main
20-
signoff: "OpenFeature Bot <[email protected]>"
20+
signoff: 'OpenFeature Bot <[email protected]>'
2121
outputs:
2222
release_created: ${{ steps.release.outputs.releases_created }}
2323
all: ${{ toJSON(steps.release.outputs) }}
@@ -42,7 +42,7 @@ jobs:
4242
- name: Setup Node
4343
uses: actions/setup-node@v4
4444
with:
45-
node-version-file: ".nvmrc"
45+
node-version-file: '.nvmrc'
4646
- name: Update npm to >=11.5.1 (for OIDC support)
4747
run: npm install -g npm@^11.5.1
4848
- name: Install dependencies
@@ -70,9 +70,9 @@ jobs:
7070
- name: Setup Node
7171
uses: actions/setup-node@v4
7272
with:
73-
node-version-file: ".nvmrc"
74-
registry-url: "https://registry.npmjs.org"
75-
cache: "npm"
73+
node-version-file: '.nvmrc'
74+
registry-url: 'https://registry.npmjs.org'
75+
cache: 'npm'
7676
- name: Update npm (for OIDC auth)
7777
run: npm install -g npm@^11.5.1
7878
- name: Build Packages

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*": "npx prettier --write --ignore-unknown"
3+
}

0 commit comments

Comments
 (0)