Skip to content

Commit

Permalink
Convert to ESLint 9 flat config and move to pnpm, use .mjs and new je…
Browse files Browse the repository at this point in the history
…st types (#2548)

* Initial work to mjs, ESLint 9, and newwer jest

* Start switching workflows to pnpm

* Update docs for corepack and pnpm

* Add missing step for changed files

* Add jest imports

* Fix test configuration

* Fix texts

* Fix linting issues, update CONTRIBUTING

* Update configurations

* Update latent references

* Fix cleanups
  • Loading branch information
SleeplessByte authored Jan 2, 2025
1 parent d0324d5 commit 90e1f86
Show file tree
Hide file tree
Showing 1,148 changed files with 20,094 additions and 17,564 deletions.
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

0 comments on commit 90e1f86

Please sign in to comment.