New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@ghlandy/prettier-config

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ghlandy/prettier-config

prettier-config

latest
Source
npmnpm
Version
0.7.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

@ghlandy/prettier-config

使用

pnpm i -D @ghlandy/prettier-config prettier
pnpm i -D prettier-plugin-organize-imports typescript prettier-plugin-packagejson
pnpm i -D @volar/vue-typescript # 格式化 .vue 文件内的 import 时需要

在 prettier 配置文件 (.prettierrc.cjs 或 .prettierrc.js) 中引入使用

const config = require('@ghlandy/prettier-config');

module.exports = {
  ...config,
};

配置详细

module.exports = {
  printWidth: 100,
  tabWidth: 2,
  useTabs: false,
  semi: true,
  singleQuote: true,
  quoteProps: 'as-needed',
  jsxSingleQuote: false,
  trailingComma: 'all',
  bracketSpacing: true,
  bracketSameLine: false,
  arrowParens: 'always',
  htmlWhitespaceSensitivity: 'ignore',
  vueIndentScriptAndStyle: false,
  endOfLine: 'lf',
  plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-packagejson'],
};

prettier-plugin-organize-imports 自动排序 import (需要 typescript 依赖包)

.vue 文件里边的自动排序 import,还需要按 @volar/vue-typescript

prettier-plugin-packagejson 自动排序 JSON

License

MIT

Keywords

prettier

FAQs

Package last updated on 07 Jan 2024

Related posts