Skip to content

Commit

Permalink
Run npm lint tasks on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Dec 20, 2023
1 parent af4aba5 commit 926f8e5
Show file tree
Hide file tree
Showing 4 changed files with 698 additions and 0 deletions.
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"

npx --no-install lint-staged
12 changes: 12 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const commands = {
eslint: 'npm run lint:js:cli -- --fix',
prettier: 'npm run lint:prettier:cli -- --write',
stylelint: 'npm run lint:scss:cli -- --fix --allow-empty-input'
}

module.exports = {
'*.{cjs,js,mjs}': [commands.eslint, commands.prettier],
'*.{json,yaml,yml}': commands.prettier,
'*.md': [commands.eslint, commands.stylelint, commands.prettier],
'*.scss': [commands.stylelint, commands.prettier]
}
Loading

0 comments on commit 926f8e5

Please sign in to comment.