From 6355c5262bd85586cd862b61c1bdad68649975f9 Mon Sep 17 00:00:00 2001 From: Boris K Date: Thu, 31 Aug 2023 11:37:04 +0200 Subject: [PATCH] Update lint-staged instructions --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c052ce7..ab47506 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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" + } +```