Skip to content

Commit

Permalink
feat: format files and prettier check
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Jun 17, 2024
1 parent 160149b commit c1b8edd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Formatting

on:
pull_request:
branches:
- main

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
run: yarn --frozen-lockfile

- name: Check formatting with Prettier
run: npx prettier --check .
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
npx --no-install lint-staged --allow-empty

node tools/pre-commit.js

9 changes: 9 additions & 0 deletions tools/pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ try {
);
}

execSync(`npm run format`, {
stdio: ['pipe', 'pipe', 'pipe'],
env: {
...process.env,
FORCE_COLOR: 'true',
},
});
console.log(` ✔ Formatted files`);

console.log(`\n${chalk.bold(' Commit successful ')}\n`);
process.exit(0);
} catch (error) {
Expand Down

0 comments on commit c1b8edd

Please sign in to comment.