Skip to content

Commit

Permalink
chore: add pre-commit hook for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackySoul committed Aug 23, 2023
1 parent a7d68eb commit 1773dea
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Assigning new version
run: npm version prerelease --commit-hooks=false --git-tag-version=false --preid=dev-${GITHUB_SHA:0:6}
- name: Publishing release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm run build

- name: Prepare tokens data
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_from_git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Publishing release
run: npm run publish:dist
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version: 18
cache: 'npm'
registry-url: https://registry.npmjs.org/
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm run publish:latest
if: '!github.event.release.prerelease'
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm run lint
test:
runs-on: ubuntu-latest
Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm run test:ci
build:
runs-on: ubuntu-latest
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: npm run build
- run: npm run docs:prepare-data
- run: npm run docs:build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ junit.xml
docs/src/**/*.d.ts
docs/public/**/*.json
docs/dist/
!.husky
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn pre-commit
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@
"styleguide": "sh ./tasks/styleguide.sh",
"docs:dev": "cd docs/webpack && webpack-dev-server --config webpack.client.js --mode development",
"docs:build": "cd docs/webpack && webpack --config webpack.client.js --mode production",
"docs:prepare-data": "ts-node tasks/docs/prepareTokensData.ts"
"docs:prepare-data": "ts-node tasks/docs/prepareTokensData.ts",
"prepare": "husky install",
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"prettier --write",
"eslint"
],
"*.{json,md}": [
"prettier --write"
]
},
"repository": "https://github.com/VKCOM/vkui-tokens.git",
"dependencies": {
Expand All @@ -39,8 +50,8 @@
"@types/common-tags": "1.8.1",
"@types/fs-extra": "11.0.1",
"@types/node": "18.11.10",
"@types/react-dom": "18.2.1",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.1",
"@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"@vkontakte/appearance": "https://github.com/VKCOM/Appearance#v10.1.4",
Expand Down Expand Up @@ -70,8 +81,10 @@
"eslint-plugin-sonarjs": "0.19.0",
"fs-extra": "11.1.1",
"html-webpack-plugin": "5.5.1",
"husky": "8.0.3",
"jest": "29.5.0",
"jest-junit": "16.0.0",
"lint-staged": "14.0.1",
"lodash": "4.17.21",
"prettier": "2.8.8",
"react": "18.2.0",
Expand Down
Loading

0 comments on commit 1773dea

Please sign in to comment.