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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vscode-prettier-config

v1.0.0

Published

vscode-prettier-config

Downloads

2

Readme

vscode-prettier-config

前端 prettier 配置

任何团队,规范都是怎么也绕不开的话题,我们有太多的理由去做规范。代码规范是软件开发领域经久不衰的话题,几乎所有工程师在开发过程中都会遇到,并或多或少会思考过这一问题。 无规矩不成方圆,无规范难以协同,适当的规范和标准绝不是消灭代码内容的创造性、优雅性,而是限制过度个性化,以一种普遍认可的统一方式一起做事,提升协作效率,降低沟通成本。

安装

# yarn 安装
yarn add vscode-prettier-config --dev

# 或 mpm 安装
npm install vscode-prettier-config --dev

配置

在项目跟目录下创建 .prettierrc.js 配置文件,并设置内容如下

// 默认配置
const defaultConfit = require('prettier-config');

module.exports = {
  ...defaultConfit,

  // 如果需要覆盖某个配置,则在下面配置
  // printWidth: 140,
}

options

// 全部默认配置项
module.exports = {
    enable: true, // default: true,是否开启 prettier
    requireConfig: false, // default: false 需要prettier配置文件来格式化文件,如果在setting.json中设置 "prettier.requireConfig": true,则必须创建一个prettier配置文件【.prettier 或 .prettier.js 等】才能格式化代码
    resolveGlobalModules: false, // default: false 全局匹配,此设置可能会对性能产生负面影响
    packageManager: 'npm', // default: 'npm' 用于安装节点模块的包管理器
    useEditorConfig: true, // default: true 解析配置时是否考虑 .editorconfig
    ignorePath: '.prettierignore', // default: '.prettierignore',不使用prettier格式化的文件填写在项目的.prettierignore文件中
    prettierPath: '', // 提供自定义模块的prettier路径。
    configPath: '', // 为prettier的配置文件提供自定义路径,全局默认值在主目录中放置一个~/.prettierrc文件。需要在 setting.json 中配置
    withNodeModules: false, // default: false,是否处理node_modules文件夹中的文件
    enableDebugLogs: false, // default: false,false: 禁用,true:启用 调试日志以进行故障排除
    printWidth: 140, // default: 80 超出140换行
    tabWidth: 4, // default: 2 tab 缩进4个空格
    singleQuote: true, // default: false 采用单引号
    trailingComma: 'all', // default: 'es5' 尾随逗号
    bracketSpacing: true, // default: true 在对象,数组括号与文字之间加空格 "{ foo: bar }"
    jsxBracketSameLine: false, // default false 在jsx中把'>' 单独放一行,true 接在末尾
    semi: true, // default: true 封号结尾
    requirePragma: false, // default: false
    insertPragma: false, // default: false 件顶部插入一个特殊的 @format 标记
    useTabs: false, // default: false 使用tab缩进
    proseWrap: 'preserve', // default: preserve 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
    arrowParens: 'always', // default: 'always' (x) => {} 箭头函数参数只有一个时是否要有小括号
    jsxSingleQuote: true, // default: false // 在jsx中使用单引号代替双引号
    htmlWhitespaceSensitivity: 'css', // default: 'css' 指定 HTML 文件的全局空白敏感度
    vueIndentScriptAndStyle: false, // default: false 是否缩进 Vue 文件中 <script> 和 <style> 标签内的代码
    endOfLine: 'lf', // default: 'lf' 结尾是 \n \r \n\r auto
    quoteProps: 'as-needed', // default: 'as-needed' 对象key仅在需要时用引号
    embeddedLanguageFormatting: 'auto', // default: 'auto' 控制 Prettier 是否格式化文件中嵌入的引用代码
}