Skip to content

Prettier設定

17.2.1. .prettierrc 全体例

json
{
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "printWidth": 100,
  "bracketSpacing": true,
  "arrowParens": "always",
  "endOfLine": "lf",
  "vueIndentScriptAndStyle": false,
  "singleAttributePerLine": true
}

17.2.2. .prettierignore

dist/
node_modules/
*.min.js
coverage/

17.2.3. 設定原則

項目理由
semifalseセミコロン不要
singleQuotetrue文字列にシングルクォートを統一
trailingCommaalldiff最小化
printWidth100可読性と画面活用のバランス
endOfLinelfクロスプラットフォームの一貫性
singleAttributePerLinetrueVueテンプレートの可読性向上

17.2.4. ESLintとの役割分担

領域担当ツール
コードフォーマット(インデント、クォート、改行)Prettier
コード品質(未使用変数、any型、console)ESLint
Vue SFCルール(ブロック順序、APIスタイル)ESLint
  • Prettierはコードスタイルのみを担当します。
  • ESLintはコード品質とVue関連ルールを担当します。
  • eslint-config-prettierで両ツール間の競合を防止します。

TIENIPIA QUALIFIED STANDARD