Skip to content

Commit 9f5c241

Browse files
feat:Add pre-commit check (#684)
feat: pre-commit ESLint
1 parent a78af6b commit 9f5c241

32 files changed

+10918
-12486
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @LeoHChen @DonFungible @jacob-tucker @allenchuang @limengformal @lucas2brh @yingyangxu2026 @chao-peng-story @roycezhaoca
1+
* @LeoHChen @DonFungible @jacob-tucker @allenchuang @limengformal @lucas2brh @yingyangxu2026 @bonnie57

.github/workflows/pr-internal.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,9 @@ on:
44
pull_request:
55
branches:
66
- main
7-
paths-ignore:
8-
- '.github/**'
9-
- '.github/CODEOWNERS'
10-
- '**/*.md'
11-
- 'docs/**'
12-
- '.gitignore'
13-
- 'LICENSE'
14-
157
push:
168
branches:
179
- main
18-
paths-ignore:
19-
- '.github/**'
20-
- '.github/CODEOWNERS'
21-
- '**/*.md'
22-
- 'docs/**'
23-
- '.gitignore'
24-
- 'LICENSE'
2510

2611
jobs:
2712
Timestamp:
@@ -34,4 +19,6 @@ jobs:
3419
with:
3520
sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
3621
ENVIRONMENT: "odyssey"
37-
secrets: inherit
22+
secrets:
23+
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
24+
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
node_modules
66
.pnp
77
.pnp.js
8+
.pnpm-store
89

910
# testing
1011
coverage

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec lint-staged

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ repos:
44
hooks:
55
- id: gitleaks
66
args: ['--verbose', '--redact']
7+
- repo: local
8+
hooks:
9+
- id: lint-staged
10+
name: lint-staged (ESLint)
11+
entry: pnpm run lint-staged
12+
language: system
13+
pass_filenames: false

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This section provides the instructions on how to build Story Protocol SDK from s
2121
- Install PNPM: Execute `npm install -g pnpm`
2222
- Install TypeScript: Run `pnpm add typescript -D`
2323
- Install Yalc: Use `npm install -g yalc`
24+
- Install dependencies: `pnpm install` (this automatically sets up Husky git hooks for ESLint checks on commit)
2425

2526
#### Steps for Using Yalc for Local Testing of Core-SDK
2627

docs/v1.4.4-release.md

Lines changed: 0 additions & 160 deletions
This file was deleted.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@
88
"scripts": {
99
"build": "turbo run build",
1010
"lint": "turbo run lint",
11+
"lint-staged": "node scripts/precommit-run-eslint.mjs",
1112
"fix": "turbo run fix",
1213
"test": "turbo run test --no-cache --concurrency=1",
13-
"test:integration": "turbo run test:integration --no-cache"
14+
"test:integration": "turbo run test:integration --no-cache",
15+
"prepare": "husky"
1416
},
1517
"devDependencies": {
1618
"@changesets/cli": "2.29.6",
19+
"eslint": "^9.26.0",
20+
"husky": "^9.1.7",
21+
"lint-staged": "^15.2.1",
1722
"turbo": "^1.10.13"
1823
},
24+
"lint-staged": {
25+
"packages/core-sdk/**/*.{ts,tsx,js,jsx,mjs,cjs}": "node scripts/precommit-eslint-core-sdk.mjs"
26+
},
1927
"engines": {
2028
"node": "^20.0.0"
2129
},

packages/core-sdk/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
"@types/mocha": "^10.0.2",
5151
"@types/node": "^20.8.2",
5252
"@types/sinon": "^10.0.18",
53-
"@zerodev/ecdsa-validator": "^5.4.9",
54-
"@zerodev/sdk": "^5.5.7",
5553
"c8": "^8.0.1",
5654
"chai": "^4.3.10",
5755
"chai-as-promised": "^7.1.1",

0 commit comments

Comments
 (0)