Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
aa89e40
commitlint init
jaredvu Mar 1, 2024
d310c05
chore(husky): initialize husky pre-commit and enforce commit-msg
jaredvu Mar 1, 2024
3935ad8
chore(contributions): add commit lint information on contributions.md
jaredvu Mar 1, 2024
37ee873
chore(contributing): update md
jaredvu Mar 1, 2024
bd1ab83
chore(workflow): add commitlint github workflow
jaredvu Mar 1, 2024
a8df4d9
chore(commitlint): init
jaredvu Mar 1, 2024
095055f
chore(husky): initialize husky pre-commit and enforce commit-msg
jaredvu Mar 1, 2024
7ceaf81
chore(contributions): add commit lint information on contributions.md
jaredvu Mar 1, 2024
03c5f47
chore(contributing): update md
jaredvu Mar 1, 2024
0c35d49
chore(workflow): add commitlint github workflow
jaredvu Mar 1, 2024
7972660
Merge branch 'commitlint' of github.com:jaredvu/v4-web-test-commitlin…
jaredvu Mar 1, 2024
8e5cfd2
chore(commitlint): lint pr title
jaredvu Mar 1, 2024
16d1977
fix(action): new action
jaredvu Mar 1, 2024
3d0d30e
fix(action): new commitlint action
jaredvu Mar 1, 2024
20b8a7e
fix(action): remove npm install
jaredvu Mar 1, 2024
473063c
chore(commitlint): change ts to js
jaredvu Mar 1, 2024
ad98e06
fix(action): new workflow
jaredvu Mar 1, 2024
858065f
fix(commitlint): use pnpm
jaredvu Mar 1, 2024
018db98
fix(commitlint): custom workflow
jaredvu Mar 2, 2024
f072549
fix(config): change config back to ts
jaredvu Mar 2, 2024
543368a
fix(commitlint): remove --yes flag
jaredvu Mar 2, 2024
e536ceb
fix(commitlint): add --config flag
jaredvu Mar 2, 2024
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
vite-env.d.ts
polyfills.ts
vite.config.ts
commitlint.config.js

# Temporarily ignore, we will slowly remove each directory as we fix files to follow ESLint rules
/src/components
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: pr-name-linter
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up pnpm
uses: dydxprotocol/setup-pnpm@v1

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm install @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional'], rules: { 'subject-case': [0,'always',['sentence-case']],'header-max-length': [2, 'always', 120], 'body-max-line-length': [0, 'always', 120] }};" > commitlint.config.js

- name: Lint the PR Title
run: |
echo "${PR_TITLE}" | pnpx commitlint --config commitlint.config.ts
env:
PR_TITLE: '${{ github.event.pull_request.title }}'
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run commitlint ${1}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm test
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu
3. Make sure your code lints.
4. Issue that pull request!

## We use [Conventional Commits](https://github.com/conventional-changelog/commitlint)
We use a commit-msg hook to check if your commit messages meet the conventional commit format.

In general the pattern mostly looks like this:

`type(scope?): subject` #scope is optional; multiple scopes are supported (current delimiter options: "/", "\" and ",")

### Real world examples can look like this:
`chore: run tests on travis ci`
`fix(server): send cors headers`
`feat(blog): add comment section`

Common types according to commitlint-config-conventional can be:

build
chore
ci
docs
feat
fix
perf
refactor
revert
style
test

## Any contributions you make will be under the same License
When you submit code changes, your submissions are understood to be under the same [License](https://github.com/dydxprotocol/v4-web/blob/master/LICENSE) that covers the project.

Expand Down
1 change: 1 addition & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ['@commitlint/config-conventional'] };
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
"ladle-p": "ladle preview",
"lint": "eslint --ext .ts,.tsx src/",
"fix-lint": "eslint --fix --ext .ts,.tsx src/",
"test": "vitest",
"test": "vitest run",
"tsc": "tsc",
"postinstall": "tar -xzC public -f tradingview/tradingview.tgz"
"postinstall": "tar -xzC public -f tradingview/tradingview.tgz",
"prepare": "husky",
"commitlint": "commitlint --edit"
},
"packageManager": "[email protected]",
"dependencies": {
Expand Down Expand Up @@ -118,6 +120,8 @@
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@dydxprotocol/v4-proto": "^3.0.0",
"@ladle/react": "^4.0.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Expand Down Expand Up @@ -149,6 +153,7 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11",
"minimist": "^1.2.8",
"node-fetch": "^3.3.1",
"pnpm": "^8.6.6",
Expand Down
Loading