ESLint precommit hook
https://gitlab.com/powr/powr/merge_requests/3174/diffs
Please rebase your branch from master and run npm install for hook to start working. You will also need Node version 8.12 or above, but not more than 10 because our webpack won’t work with node 12.
Precommit hook is a script which runs before you commit something. This particular hook will count amount of ESLint warnings in staged files and prevent commit if warning amount is increasing. For example you start working on formBuilder.js which has 300 warnings. You add some code and now it’s 305 warnings. This hook won’t let you commit: But if you reduce warning amount to 295 warnings this amount will be saved to .esplint.rec.json and your commit will work. List of some files which require your attention: 1) .esplint.rec.json stores amount of warnings per each file - don’t modify this file. 2) .eslintrc.js - config file for ESLint. 3) .eslintrc-for-esplint.js - config file where all errors are marked as warnings for esplint to work. 4) .esplintrc.js - this file has rules section which esplint is tracking. It’s recommended to install ESLint plugin for your code editor to see all the warnings during development and prevent them:
Atom https://atom.io/packages/linter-eslint VSCode: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint JetBrains: https://plugins.jetbrains.com/plugin/7494-eslint Some ESLint rules might be stupid and we can remove them from tracking. Please let me know if you have any problems with them.