Add linting, code formatting and precommit checks to an existing project.
yarn global add checkpoints
Adding linting, prettier and precommit checks multiple times a day to new/existing repos is no fun and often it can be difficult to recall the correct dependencies to install. This project aims to mitigate those problems.
Note: There are plans to add a
checkpoints configaction, which would allow users to specify their ownxoandprettierconfigurations. For now though the project is limited to the configs specified below.
This project uses yarn to install dependencies. There are plans in place to add the option to use NPM but for now it's limited to Yarn.
yarn global add checkpointscheckpointsXO is a linter which sits on top of ESLint and abstracts much of the configuration.
The following is the default config that will be added to your package.json file:
"xo": {
"parser": "babel-eslint",
"envs": ["browser", "node"],
"prettier": true,
"space": true,
"rules": {
"camelcase": [
2,
{
"properties": "never"
}
]
}
}xo
babel-eslint
eslint-config-xo
The xo-react action adds everything from the xo action but configures it for React.
The following is added to the above xo configuration:
"extends": ["react"],
"plugins": ["react"]
eslint-config-xo-react
eslint-plugin-react
{
"prettier": {
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true
}
}prettier
prettier-eslint
eslint-config-prettier
The precommit action uses pre-commit and lint-staged to lint your repo prior to git commits.
{
"scripts": {
"lint-staged": "lint-staged"
},
"lint-staged": {
"**/*.js": [
"prettier --write",
"git add",
"xo"
]
},
"precommit": {
"run": [
"lint-staged"
]
}
}lint-staged
pre-commit
