npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prettier-config-common

v1.5.0

Published

适合中国人使用习惯的 prettier 配置

Readme

prettier-config-common

适合中国人使用习惯的 prettier 配置

NPM version Codacy Badge License

Sonar

请在使用前确保您本地安装了 prettier

安装

# 使用pnpm安装
pnpm install -D prettier-config-common

# 使用yarn安装
yarn add prettier-config-common --dev

# 使用npm安装
npm install prettier-config-common -D

使用方法

方法 1. 修改 package.json(推荐)

编辑您项目 package.json 加上下面这一行

{
  "prettier": "prettier-config-common"
}

方法 2. 创建/修改本地 .prettierrc.js 文件

// 编辑 .prettierrc.js
module.exports = require('prettier-config-common')

方法 3. 使用完整配置

如需使用包含所有配置项的完整版本:

// 编辑 .prettierrc.js
module.exports = require('prettier-config-common/prettier.all.json')

配置文件说明

本包提供两个配置文件:

| 文件 | 说明 | | --- | --- | | prettier.json | 精简版配置,仅包含常用配置项(默认) | | prettier.all.json | 完整版配置,包含所有可配置项 |

配置详情

基础配置

| 配置项 | 值 | 说明 | | --- | --- | --- | | printWidth | 100 | 每行最大字符数 | | tabWidth | 4 | 缩进空格数 | | useTabs | true | 使用 Tab 缩进 | | semi | false | 不使用分号 | | singleQuote | true | 使用单引号 | | jsxSingleQuote | false | JSX 中使用双引号 | | trailingComma | "es5" | 尾随逗号,ES5 标准 | | bracketSpacing | true | 对象字面量大括号内加空格 | | bracketSameLine | false | JSX 标签的 > 不单独一行 | | arrowParens | "avoid" | 箭头函数单参数省略括号 | | endOfLine | "auto" | 换行符自动检测 |

文件类型覆盖配置

| 文件类型 | 特殊配置 | | --- | --- | | *.json5 | singleQuote: false, quoteProps: "preserve" | | *.yml, *.yaml, *.toml | useTabs: false, singleQuote: false, tabWidth: 2 | | *.md | useTabs: false, singleQuote: true, tabWidth: 2 | | .prettierrc | parser: "json" |

扩展配置

如需在现有配置基础上进行扩展:

// .prettierrc.js
const baseConfig = require('prettier-config-common')

module.exports = {
  ...baseConfig,
  // 自定义配置覆盖
  printWidth: 120,
  // 添加更多 overrides
  overrides: [
    ...baseConfig.overrides,
    {
      files: '*.vue',
      options: {
        singleQuote: false
      }
    }
  ]
}

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

相关链接

License

MIT