Skip to content

Commit 57cd4fd

Browse files
committed
Refactor the use of actions/setup-node
- Set `.nvmrc` value to `with.node-version` See <actions/setup-node#32 (comment)> - Add `npm run lint-ci` to use "Problem Matchers" of actions/setup-node
1 parent f0e5eb3 commit 57cd4fd

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.github/workflows/eslint.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15+
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
16+
id: nvm
1517
- uses: actions/setup-node@v2
1618
with:
17-
node-version: "16.x"
19+
node-version: "${{ steps.nvm.outputs.nvmrc }}"
1820
- run: npm install eslint-config-ybiquitous @typescript-eslint/eslint-plugin
1921
- run: npx eslint .

.github/workflows/stylelint.yml

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15+
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
16+
id: nvm
1517
- uses: actions/setup-node@v2
18+
with:
19+
node-version: "${{ steps.nvm.outputs.nvmrc }}"
1620
# https://github.com/actions/toolkit/blob/2f164000dcd42fb08287824a3bc3030dbed33687/docs/commands.md#problem-matchers
1721
# https://gist.github.com/ybiquitous/184a337662bfcafdd3d227253f9401ff
1822
- name: Set up Problem Matchers for stylelint

.github/workflows/test.yml

+6-11
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- run: |
15-
nvm install --latest-npm --no-progress
16-
echo "PATH=${NVM_BIN}:${PATH}" >> $GITHUB_ENV
17-
shell: bash --login {0}
14+
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
15+
id: nvm
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version: "${{ steps.nvm.outputs.nvmrc }}"
1819
- run: npm ci
19-
- name: Set up Problem Matchers for tsc
20-
run: |
21-
curl -fLO "https://raw.githubusercontent.com/actions/setup-node/5c355be17065acf11598c7a9bb47112fbcf2bbdc/.github/tsc.json"
22-
mv tsc.json "${HOME}/tsc.json"
23-
echo "::add-matcher::${HOME}/tsc.json"
24-
- run: npm run lint:types
25-
- run: npm run lint
20+
- run: npm run lint-ci
2621
- run: npm run build

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"postbuild": "cp -v _redirects dist/",
99
"static": "npm run build && npx http-server ./dist",
1010
"format": "npm-run-all --print-label --parallel lint:*:fix prettier:write",
11+
"lint-ci": "npm-run-all --silent --parallel lint:* prettier:check",
1112
"lint": "npm-run-all --print-label --parallel lint:* prettier:check",
1213
"lint:md": "remark .",
1314
"lint:md:fix": "remark . --output",

src/Link.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback } from "react";
1+
import { useCallback, useState } from "react";
22

33
/**
44
* @typedef {Object} Props

0 commit comments

Comments
 (0)