https://github.com/markmur/checkpoints
A CLI tool to easily add linting, code formatting and precommit checks to new or existing JavaScript projects
https://github.com/markmur/checkpoints
cli linter precommit prettier
Last synced: 11 months ago
JSON representation
A CLI tool to easily add linting, code formatting and precommit checks to new or existing JavaScript projects
- Host: GitHub
- URL: https://github.com/markmur/checkpoints
- Owner: markmur
- License: mit
- Created: 2018-06-26T08:31:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-12T13:41:02.000Z (about 7 years ago)
- Last Synced: 2025-02-15T12:07:49.654Z (11 months ago)
- Topics: cli, linter, precommit, prettier
- Language: JavaScript
- Homepage:
- Size: 158 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 👮🏻 Checkpoints 👮🏻
Add linting, code formatting and precommit checks to an existing project.
```
yarn global add checkpoints
```
## Why?
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 config` action, which would allow users to specify their own `xo` and `prettier` configurations. For now though the project is limited to the configs specified below.
## Things to Note
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.
## Installation
```sh
yarn global add checkpoints
```
## Usage
```sh
checkpoints
```
## Options
- [xo](#xo)
- [xo-react](#xo-react)
- [prettier](#prettier)
- [precommit](#precommit)
### xo
[XO](https://github.com/xojs/xo) is a linter which sits on top of ESLint and abstracts much of the configuration.
##### Config
The following is the default config that will be added to your `package.json` file:
```json
"xo": {
"parser": "babel-eslint",
"envs": ["browser", "node"],
"prettier": true,
"space": true,
"rules": {
"camelcase": [
2,
{
"properties": "never"
}
]
}
}
```
##### Dependencies
```
xo
babel-eslint
eslint-config-xo
```
---
### xo-react
The `xo-react` action adds everything from the `xo` action but configures it for React.
##### Config
The following is added to the above `xo` configuration:
```
"extends": ["react"],
"plugins": ["react"]
```
##### Dependencies
```
eslint-config-xo-react
eslint-plugin-react
```
---
### Prettier
##### Config
```json
{
"prettier": {
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true
}
}
```
##### Dependencies
```
prettier
prettier-eslint
eslint-config-prettier
```
---
### Precommit
The `precommit` action uses `pre-commit` and `lint-staged` to lint your repo prior to git commits.
##### Config
```json
{
"scripts": {
"lint-staged": "lint-staged"
},
"lint-staged": {
"**/*.js": [
"prettier --write",
"git add",
"xo"
]
},
"precommit": {
"run": [
"lint-staged"
]
}
}
```
##### Dependencies
```
lint-staged
pre-commit
```