Skip to content
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

style: Use husky and lint-staged #1143

Merged
merged 8 commits into from
Dec 12, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

steps:
- uses: actions/[email protected]
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
Expand Down Expand Up @@ -40,8 +42,11 @@ jobs:
- name: Build
run: yarn build

- name: Lint
run: yarn lint:ci
- name: Run ESLint
run: |
BASE_BRANCH=${GITHUB_BASE_REF:-master}
BASE_COMMIT=$(git merge-base HEAD origin/${BASE_BRANCH})
yarn lint-staged --concurrent=false --diff="${BASE_COMMIT}..HEAD" --verbose

- name: Test
run: yarn test
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn lint-staged --concurrent=false
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default [
...eslintConfigWantedly,
...eslintConfigWantedlyTs,
{
ignores: ["packages/**/lib/*.js"],
ignores: ["packages/**/lib/**/*.js"],
},
{
name: "overrides",
Expand Down
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"@types/estree": "^1.0.6",
"@types/graphql": "^14.5.0",
"@types/jest": "^27.4.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lerna": "^4.0.0",
"lint-staged": "^15.2.10",
"mock-fs": "^5.0.0",
"pacote": "^11.3.4",
"scaffdog": "^1.0.1",
Expand All @@ -20,23 +22,26 @@
"workspaces": [
"packages/*"
],
"frolint": {
"prettier": {
"config": "./.prettierrc"
}
"lint-staged": {
"*.{ts,tsx,js,mjs}": [
"yarn format",
"yarn lint"
],
"*.json": "yarn format"
},
"scripts": {
"postinstall": "lerna bootstrap",
"test": "FORCE_COLOR=1 lerna run --stream test",
"test:watch": "FORCE_COLOR=1 lerna exec --stream --ignore prettier-config-wantedly -- npm run test -- --watch",
"test:watch:frolint": "lerna exec \"npm run test -- --watch\" --scope frolint",
"test:update": "lerna run --stream test -- -u",
"lint": "frolint --branch master",
"lint:ci": "frolint --expect-no-errors",
"format": "prettier --write",
"lint": "eslint --cache",
"build": "lerna run build",
"build:watch": "lerna run --parallel build:watch",
"prerelease": "yarn install --force && yarn run build",
"release": "yarn changeset publish",
"clean": "yarn lerna clean -y && rm -r packages/*/lib"
"clean": "yarn lerna clean -y && rm -r packages/*/lib",
"prepare": "husky"
}
}
Loading
Loading