Skip to content

Convert to ESLint 9 flat config and move to pnpm, use .mjs and new jest types #2548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 0 additions & 16 deletions .eslintignore

This file was deleted.

14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

12 changes: 9 additions & 3 deletions .github/workflows/action-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ jobs:
git clone $HEAD_REPO .
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"

- name: Use Node.js LTS (18.x)
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable pnpm

- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: '18'
node-version: 20.x
cache: 'pnpm'

- name: Install project development dependencies
run: npm install --no-save
run: corepack pnpm install --no-save

- name: 'Format code'
run: ./bin/format.sh

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/action-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ jobs:
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"

- name: 'Install dependencies'
run: yarn install
run: |
corepack enable pnpm
corepack pnpm install
- name: 'Sync exercises'
run: npx babel-node scripts/sync
run: corepack pnpm node scripts/sync.mjs

- name: 'Commit changes'
run: |
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,41 @@ jobs:

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Use Node.js LTS (18.x)
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable pnpm

- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: '18'
node-version: 20.x
cache: 'pnpm'

- name: Install project dependencies
run: npm ci
run: corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript ci precheck (checks config, lint code, and runs tests) for all exercises
run: npx babel-node scripts/ci-check
run: corepack pnpm node scripts/ci-check.mjs

ci:
runs-on: ubuntu-22.04

strategy:
matrix:
node-version: ['18', '20']
node-version: [20.x, 22.x]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable pnpm

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install project dependencies
run: npm ci
run: corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript ci (checks config, lint code, and runs tests) for all exercises
run: npx babel-node scripts/ci
run: corepack pnpm node scripts/ci.mjs
52 changes: 37 additions & 15 deletions .github/workflows/pr.ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,66 @@ jobs:
steps:
- name: Checkout PR
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi

- name: Use Node.js LTS (18.x)
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable pnpm

- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: '18'
node-version: 20.x
cache: 'pnpm'

- name: Install project dependencies
run: npm ci
run: corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript ci precheck (stub files, config integrity) for changed exercises
run: |
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|md|json)$")) | .filename' | \
xargs -r npx babel-node scripts/pr-check
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}

ci:
runs-on: ubuntu-22.04

strategy:
matrix:
node-version: ['18', '20']
node-version: [20.x, 22.x]

steps:
- name: Checkout PR
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi

- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable pnpm

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install project dependencies
run: npm ci
run: corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript ci (runs tests) for changed/added exercises
run: |
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|md|json)$")) | .filename' | \
xargs -r npx babel-node scripts/pr
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}
7 changes: 1 addition & 6 deletions .github/workflows/verify-code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ jobs:
steps:
- name: 'Checkout code'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: '18'
- name: Install project development dependencies
run: npm i

- name: 'Verify formatting of all files'
run: ./bin/check-formatting.sh
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules
/bin/configlet
/bin/configlet.exe
/pnpm-lock.yaml
/package-lock.json
/yarn.lock
Loading