Skip to content

Instantly share code, notes, and snippets.

@simaodeveloper
Last active July 27, 2020 12:45
Show Gist options
  • Save simaodeveloper/834f175ce7b03e07df532ece85b5b814 to your computer and use it in GitHub Desktop.
Save simaodeveloper/834f175ce7b03e07df532ece85b5b814 to your computer and use it in GitHub Desktop.
# Front-end
npm i -D jest husky lint-staged standard rollup babel-jest @babel/core @babel/preset-env @commitlint/config-conventional @commitlint/cli
# babel.config.js
```
module.exports = {
presets: [
[
'@babel/preset-env'
],
],
};
```
# .huskyrc
```
{
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
```
# commitlint.config.js
```
module.exports = {
parserPreset: 'conventional-changelog-conventionalcommits',
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
'footer-leading-blank': [1, 'always'],
'footer-max-line-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
],
],
},
};
```
# .lintstagedrc
```
{
"*.js": ["standard --fix", "git add ."]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment