Skip to content

Commit 4da603e

Browse files
Yarn 4 + ESLint 9 + PnP Support (3) (#1506)
[no important files changed] * Upgrade to Yarn 4, ESLint 9, and add PnP support * Upgrade SDKs * Sync * Format files * Fix .vscode files, upgrade all tests to new format * Update workflows to Node LTS @ 20 * Fix lint issues * Remove babel transpilation for common actions * Simplify changed files check * Ensure tsconfig.json is present * Switch to corepack yarn
1 parent 84e5841 commit 4da603e

File tree

1,361 files changed

+15441
-102726
lines changed

Some content is hidden

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

1,361 files changed

+15441
-102726
lines changed

.eslintignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/action-format.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ jobs:
6060
git clone $HEAD_REPO .
6161
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
6262
63-
- name: Use Node.js LTS (18.x)
64-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
63+
- name: Use Node.js LTS (20.x)
64+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
6565
with:
66-
node-version: '18'
66+
node-version: 20.x
6767
- name: Install project development dependencies
6868
run: npm install --no-save
6969
- name: 'Format code'

.github/workflows/action-sync.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ jobs:
6161
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
6262
6363
- name: 'Install dependencies'
64-
run: yarn install
64+
run: |
65+
corepack enable yarn
66+
corepack yarn install
6567
- name: 'Sync exercises'
66-
run: yarn sync
68+
run: corepack yarn sync
6769

6870
- name: 'Commit changes'
6971
run: |

.github/workflows/ci.js.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,41 @@ jobs:
1212
runs-on: ubuntu-22.04
1313

1414
steps:
15-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
16-
- name: Use Node.js LTS (18.x)
17-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
15+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16+
- name: Use Node.js LTS (20.x)
17+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1818
with:
19-
node-version: 18.x
19+
node-version: 20.x
2020

2121
- name: Install project dependencies
22-
run: yarn install --frozen-lockfile
22+
run: |
23+
corepack enable yarn
24+
corepack yarn install --immutable
2325
2426
- name: Run exercism/typescript ci precheck (checks config, lint code, and runs tests) for all exercises
25-
run: yarn ci:check
27+
run: corepack yarn ci:check
2628

2729
ci:
2830
runs-on: ubuntu-22.04
2931

3032
strategy:
3133
matrix:
32-
node-version: [18.x, 20.x]
34+
node-version: [20.x, 22.x]
3335

3436
steps:
35-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
37+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
3638
- name: Use Node.js ${{ matrix.node-version }}
37-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
39+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
3840
with:
3941
node-version: ${{ matrix.node-version }}
4042

4143
- name: Install project dependencies
42-
run: yarn install --frozen-lockfile
44+
run: |
45+
corepack enable yarn
46+
corepack yarn install --immutable
4347
4448
- name: Run exercism/typescript ci (checks config, lint code, and runs tests) for all exercises
45-
run: yarn ci
49+
run: corepack yarn ci
4650

4751
impersonate:
4852
# This job tries to run tests for the 'hello-world' exercise, but
@@ -54,7 +58,7 @@ jobs:
5458
steps:
5559
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
5660
- name: Use Node.js 20.x
57-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
61+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
5862
with:
5963
node-version: 20.x
6064

@@ -69,8 +73,10 @@ jobs:
6973
7074
- name: Install project dependencies
7175
working-directory: exercises/practice/hello-world
72-
run: yarn install --no-immutable
76+
run: |
77+
corepack enable yarn
78+
corepack yarn install --immutable
7379
7480
- name: Run tests
7581
working-directory: exercises/practice/hello-world
76-
run: yarn test
82+
run: corepack yarn test

.github/workflows/pr.ci.js.yml

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,64 @@ jobs:
1111

1212
steps:
1313
- name: Checkout PR
14-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
15-
16-
- name: Use Node.js LTS (18.x)
17-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
14+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
15+
with:
16+
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
17+
- name: Get changed files
18+
id: changed-files
19+
run: |
20+
if ${{ github.event_name == 'pull_request' }}; then
21+
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
22+
else
23+
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
24+
fi
25+
26+
- name: Use Node.js LTS (20.x)
27+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1828
with:
19-
node-version: 18.x
29+
node-version: 20.x
2030

2131
- name: Install project dependencies
22-
run: yarn install --frozen-lockfile
32+
run: |
33+
corepack enable yarn
34+
corepack yarn install --immutable
2335
2436
- name: Run exercism/typescript ci precheck (stub files, config integrity) for changed exercises
25-
run: |
26-
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
27-
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
28-
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|ts|tsx|md|json)$")) | .filename' | \
29-
xargs -r yarn dlx -p @babel/core -p @babel/node babel-node scripts/pr-check
37+
run: corepack yarn node scripts/pr-check.mjs ${{ steps.changed-files.outputs.changed_files }}
3038

3139
ci:
3240
runs-on: ubuntu-22.04
3341

3442
strategy:
3543
matrix:
36-
node-version: [18.x, 20.x]
44+
node-version: [20.x, 22.x]
3745

3846
steps:
3947
- name: Checkout PR
40-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
48+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
49+
with:
50+
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
51+
- name: Get changed files
52+
id: changed-files
53+
run: |
54+
if ${{ github.event_name == 'pull_request' }}; then
55+
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
56+
else
57+
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
58+
fi
4159
4260
- name: Use Node.js ${{ matrix.node-version }}
43-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
61+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
4462
with:
4563
node-version: ${{ matrix.node-version }}
4664

4765
- name: Install project dependencies
48-
run: yarn install --frozen-lockfile
66+
run: |
67+
corepack enable yarn
68+
corepack yarn install --immutable
4969
5070
- name: Run exercism/typescript ci (runs tests) for changed/added exercises
51-
run: |
52-
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
53-
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
54-
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|ts|tsx|md|json)$")) | .filename' | \
55-
xargs -r yarn dlx -p @babel/core -p @babel/node babel-node scripts/pr
71+
run: corepack yarn node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}
5672

5773
impersonate:
5874
# This job tries to run tests for the 'hello-world' exercise, but
@@ -62,9 +78,9 @@ jobs:
6278
runs-on: ubuntu-22.04
6379

6480
steps:
65-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
81+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
6682
- name: Use Node.js 20.x
67-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
83+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
6884
with:
6985
node-version: 20.x
7086

@@ -79,8 +95,10 @@ jobs:
7995
8096
- name: Install project dependencies
8197
working-directory: exercises/practice/hello-world
82-
run: yarn install --no-immutable
98+
run: |
99+
corepack enable yarn
100+
corepack yarn install --no-immutable
83101
84102
- name: Run tests
85103
working-directory: exercises/practice/hello-world
86-
run: yarn test
104+
run: corepack yarn test

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ bin/configlet.exe
4242
!/.yarn/versions
4343

4444
# Maintainer specific generated files
45-
/exercises/**/yarn.lock
4645
/tmp_exercises
4746
/tmp
4847
exercise-package.json

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
exercises/**/README.md
55
!/README.md
66

7+
.vscode/**/*
8+
.yarn/**/*
9+
710
# Originates from https://github.com/exercism/org-wide-files
811
CODE_OF_CONDUCT.md
912
LICENSE

.prettierrc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@
55
"singleQuote": true,
66
"arrowParens": "always",
77
"printWidth": 80,
8-
"endOfLine": "lf",
9-
"overrides": [
10-
{
11-
"files": "*.ts",
12-
"options": { "parser": "typescript" }
13-
}
14-
]
8+
"endOfLine": "lf"
159
}

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"arcanis.vscode-zipfs",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode"
6+
]
7+
}

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
{
2-
"cSpell.words": ["exercism"]
2+
"cSpell.words": [
3+
"exercism"
4+
],
5+
"search.exclude": {
6+
"**/.yarn": true,
7+
"**/.pnp.*": true
8+
},
9+
"eslint.nodePath": ".yarn/sdks",
10+
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
11+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
12+
"typescript.enablePromptUseWorkspaceTsdk": true
313
}

0 commit comments

Comments
 (0)