Skip to content

Commit

Permalink
Update lint-staged instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
bokub authored Aug 31, 2023
1 parent 1c6f077 commit 6355c52
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ yarn add -D prettier @bokub/prettier-config

```bash
npx mrm@2 lint-staged
npx husky set .husky/pre-commit "npx lint-staged --concurrent false"
```

Then, in `package.json`, replace the `lint-staged` config with:

```json
"lint-staged": {
"*": "prettier --write --ignore-unknown"
}
```

#### _Optional:_ Run prettier on existing code
Expand All @@ -45,10 +54,10 @@ npx prettier --write .

```bash
# With npm
npm i -D eslint-config-prettier eslint-plugin-prettier eslint@^7.0.0
npm i -D eslint-config-prettier eslint-plugin-prettier eslint

# With yarn
yarn add -D eslint-config-prettier eslint-plugin-prettier eslint@^7.0.0
yarn add -D eslint-config-prettier eslint-plugin-prettier eslint
```

Then, edit your ESLint configuration file:
Expand All @@ -62,3 +71,12 @@ Then, edit your ESLint configuration file:
}
}
```

Then, in `package.json`, replace the `lint-staged` config (if it exists) with:

```json
"lint-staged": {
"*": "prettier --write --ignore-unknown",
"*.{js,ts,vue}": "eslint --fix"
}
```

0 comments on commit 6355c52

Please sign in to comment.