Skip to content

Commit

Permalink
feat: add lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
capitnflam committed Mar 15, 2024
1 parent 65bfb19 commit 04e3f56
Show file tree
Hide file tree
Showing 5 changed files with 521 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
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"

npm run pre-commit
24 changes: 24 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function buildPrettierCommand(filenames) {
return [`prettier --write ${filenames.join(' ')}`]
}

/** @type {import('lint-staged').Config} */
module.exports = {
'package.json': (filenames) => [
`syncpack format ${filenames.map((filename) => `--source '${filename}'`).join(' ')}`,
'syncpack lint',
],
'*.js': (filenames) => [
// `eslint --fix ${filenames.join(' ')}`,
`prettier --write ${filenames.join(' ')}`,
],
'*.ts': (filenames) => [
// `eslint --fix ${filenames.join(' ')}`,
`prettier --write ${filenames.join(' ')}`,
`tsc --pretty --noEmit`,
],
'*.yml': buildPrettierCommand,
'*.yaml': buildPrettierCommand,
'*.md': buildPrettierCommand,
'*.{html,css}': buildPrettierCommand,
}
Loading

0 comments on commit 04e3f56

Please sign in to comment.