Skip to content

Commit

Permalink
add reducer file commit hook warning
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed Feb 20, 2019
1 parent 33f2248 commit 36cb4dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"redux-saga-test-plan": "3.7.0",
"release-it": "8.2.0",
"rimraf": "2.6.3",
"staged-git-files": "1.1.2",
"standard": "12.0.1",
"style-loader": "0.23.1",
"thread-loader": "2.1.1",
Expand Down
20 changes: 20 additions & 0 deletions scripts/commitHook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable */
const chalk = require('chalk')
const sgf = require('staged-git-files')

// checks current files in commit for reducer files. Warning user if any are found
sgf((error, files) => {
if (error) return
if (
files
.map(file => file.filename)
.filter(filename => filename.includes('reducer')).length
) {
console.log(
chalk.red.bold('.: Warning :.\n') +
chalk.yellow(
"You've modified a reducer file. Please verify the Redux state import/export feature still works before creating PR."
)
)
}
})

0 comments on commit 36cb4dc

Please sign in to comment.