https://github.com/dadi/code-standards
Configs for linters and formatters used in DADI projects.
https://github.com/dadi/code-standards
Last synced: 10 months ago
JSON representation
Configs for linters and formatters used in DADI projects.
- Host: GitHub
- URL: https://github.com/dadi/code-standards
- Owner: dadi
- Created: 2019-06-19T20:12:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T12:56:30.000Z (almost 7 years ago)
- Last Synced: 2024-04-26T03:21:20.351Z (about 2 years ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DADI code standards
Configs for linters and formatters used in DADI projects.
## Setting up
1. Copy `.editorconfig`, `.eslintrc` and `.prettierrc` to the root of the repository
1. Install the required dependencies
```
npm i @dadi/eslint-config @dadi/prettier-config eslint husky lint-staged prettier --save-dev
```
1. Add the following blocks to `package.json`:
```
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx,md,html,css}": [
"prettier --write",
"git add"
]
}
```
1. Add the following to your `test` npm script:
```
eslint --ext js,jsx . && prettier --check '**/*.{js,jsx,md,html,css}'
```
1. If you want to reformat an existing repository, run:
```
./node_modules/.bin/eslint --fix --ext js,jsx . && ./node_modules/.bin/prettier --write '**/*.{js,jsx,md,html,css}'
```