Skip to content

Commit 8dddfd0

Browse files
authored
Merge pull request #1143 from wantedly/chloe463/change/husky-and-lint-staged
2 parents a79246f + 4aa564c commit 8dddfd0

File tree

5 files changed

+317
-11
lines changed

5 files changed

+317
-11
lines changed

.github/workflows/nodejs.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v4.1.1
15+
with:
16+
fetch-depth: 0
1517

1618
- name: Use Node.js ${{ matrix.node-version }}
1719
uses: actions/setup-node@v4.0.0
@@ -40,8 +42,11 @@ jobs:
4042
- name: Build
4143
run: yarn build
4244

43-
- name: Lint
44-
run: yarn lint:ci
45+
- name: Run ESLint
46+
run: |
47+
BASE_BRANCH=${GITHUB_BASE_REF:-master}
48+
BASE_COMMIT=$(git merge-base HEAD origin/${BASE_BRANCH})
49+
yarn lint-staged --concurrent=false --diff="${BASE_COMMIT}..HEAD" --verbose
4550
4651
- name: Test
4752
run: yarn test

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged --concurrent=false

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default [
66
...eslintConfigWantedly,
77
...eslintConfigWantedlyTs,
88
{
9-
ignores: ["packages/**/lib/*.js"],
9+
ignores: ["packages/**/lib/**/*.js"],
1010
},
1111
{
1212
name: "overrides",

package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"@types/estree": "^1.0.6",
1010
"@types/graphql": "^14.5.0",
1111
"@types/jest": "^27.4.0",
12+
"husky": "^9.1.7",
1213
"jest": "^29.7.0",
1314
"lerna": "^4.0.0",
15+
"lint-staged": "^15.2.10",
1416
"mock-fs": "^5.0.0",
1517
"pacote": "^11.3.4",
1618
"scaffdog": "^1.0.1",
@@ -20,23 +22,26 @@
2022
"workspaces": [
2123
"packages/*"
2224
],
23-
"frolint": {
24-
"prettier": {
25-
"config": "./.prettierrc"
26-
}
25+
"lint-staged": {
26+
"*.{ts,tsx,js,mjs}": [
27+
"yarn format",
28+
"yarn lint"
29+
],
30+
"*.json": "yarn format"
2731
},
2832
"scripts": {
2933
"postinstall": "lerna bootstrap",
3034
"test": "FORCE_COLOR=1 lerna run --stream test",
3135
"test:watch": "FORCE_COLOR=1 lerna exec --stream --ignore prettier-config-wantedly -- npm run test -- --watch",
3236
"test:watch:frolint": "lerna exec \"npm run test -- --watch\" --scope frolint",
3337
"test:update": "lerna run --stream test -- -u",
34-
"lint": "frolint --branch master",
35-
"lint:ci": "frolint --expect-no-errors",
38+
"format": "prettier --write",
39+
"lint": "eslint --cache",
3640
"build": "lerna run build",
3741
"build:watch": "lerna run --parallel build:watch",
3842
"prerelease": "yarn install --force && yarn run build",
3943
"release": "yarn changeset publish",
40-
"clean": "yarn lerna clean -y && rm -r packages/*/lib"
44+
"clean": "yarn lerna clean -y && rm -r packages/*/lib",
45+
"prepare": "husky"
4146
}
4247
}

0 commit comments

Comments
 (0)