Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

💜 My personal Prettier config & workflow

NotificationsYou must be signed in to change notification settings

bokub/prettier-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

@bokub/prettier-config

My personalPrettier config & workflow

Code styleDownloadsVersion

Base setup

Install required packages:

# With npmnpm i -D prettier @bokub/prettier-config# With yarnyarn add -D prettier @bokub/prettier-config

Add the config to yourpackage.json:

npm pkgset prettier="@bokub/prettier-config"

Optional: Setup pre-commit hook with husky & lint-staged

Install husky & lint-staged:

# With npmnpm i -D husky lint-staged# With yarnyarn add -D husky lint-staged

Setup git hook:

npx husky initecho"npx lint-staged --concurrent false"> .husky/pre-commitnpm pkgset"lint-staged.*"="prettier --write --ignore-unknown"

Optional: Run prettier on existing code

npx prettier --write.

Optional: Setup with ESLint

# With npmnpm i -D eslint-config-prettier eslint-plugin-prettier eslint# With yarnyarn add -D eslint-config-prettier eslint-plugin-prettier eslint

Then, edit your ESLint configuration file:

{"plugins": ["prettier"],"extends": ["<some-config>","plugin:prettier/recommended"],// Add to the end of the array"rules": {"prettier/prettier":"warn",// Optionally, you can set the error level to warn  },}

If you have alint-staged configuration, add an ESLint task :

npm pkgset"lint-staged[*.{js,ts,vue}]"="eslint --fix"

[8]ページ先頭

©2009-2025 Movatter.jp