2.0.1 • Published 9 months ago

@lcbase/prettier-config v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Prettier Config

This package provides Prettier's Config.

Usage

1. Install package

pnpm add -D prettier @lcbase/prettier-config

2. Add "prettier": "@lcbase/prettier-config" to your package.json.

{
  "prettier": "@lcbase/prettier-config"
}

3. Add script to your package.json.

{
  "scripts": {
    "prettify": "prettier src --check",
    "prettify:fix": "pnpm prettify --write"
  }
}

4. Combine with @lcbase/eslint-config-* packages

pnpm add -D eslint @lcbase/eslint-config-*
{
  "scripts": {
    "lint": "eslint src",
    "lint:fix": "pnpm lint --fix",
    "prettify": "prettier src --check",
    "prettify:fix": "prettier src --write",
    "format": "pnpm prettify:fix && pnpm lint:fix"
  }
}

5. Configuration your VScode.

In root your project's folder. Create .vscode folder with structure:

.vscode
  - settings.json
{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}

6. Setup git hooks

  • Install packages and global setup husky, lint-staged.
pnpm add -D husky lint-staged
npx husky install
npm pkg set scripts.prepare="husky install"
npx husky add .husky/pre-commit "npx lint-staged"
  • Add the following to your package.json:
{
  "scripts": {
    "prepare": "husky install"
  },
  "lint-staged": {
    "*.{js,cjs,mjs,jsx,cjsx,mjsx,ts,mts,cts,tsx,mtsx,ctsx}": ["pnpm format"],
    "*.{json,css,md,html}": ["pnpm prettify:fix"]
  }
}
1.9.0

9 months ago

1.8.0

9 months ago

1.7.0

9 months ago

1.6.0

9 months ago

1.2.4

11 months ago

1.5.0

9 months ago

1.4.0

10 months ago

1.3.0

10 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

12 months ago

1.2.0

12 months ago

1.1.0

12 months ago

1.0.0

12 months ago