Skip to content

Commit

Permalink
[#3] Install & configure lint-staged
Browse files Browse the repository at this point in the history
This runs our linters & formatters on just the files that have changed.
  • Loading branch information
joshuapease committed May 21, 2024
1 parent 56b978d commit bdfc227
Show file tree
Hide file tree
Showing 4 changed files with 550 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run format
ddev exec npx lint-staged
14 changes: 14 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This runs within the DDEV container
* We have access to the appropriate PHP & Composer versions
*/
export default {
'**/*.php': [
'./vendor/bin/ecs check --ansi --fix',
'./vendor/bin/phpstan analyse --memory-limit=1G',
],
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --ignore-unknown --write'],
// Negate the JS files above so there isn't a race condition
// https://github.com/lint-staged/lint-staged?tab=readme-ov-file#task-concurrency
'!(*.js|*.jsx|*.ts|*.tsx)': 'prettier --ignore-unknown --write',
}
Loading

0 comments on commit bdfc227

Please sign in to comment.