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

@checkdigit/prettier-config

v6.0.0

Published

Check Digit code formatting configuration

Downloads

6,673

Readme

MIT License

prettier-config

Check Digit Prettier configuration

Usage

Install

$ npm add -D -E @checkdigit/prettier-config

Important note from Prettier installation documentation:

Install an exact version of Prettier locally in your project. This makes sure that everyone in the project gets the exact same version of Prettier. Even a patch release of Prettier can result in slightly different formatting, so you wouldn’t want different team members using different versions and formatting each other’s changes back and forth.

To make this easier, just install @checkdigit/prettier-config as above, it will be locked to a specific version of prettier which will automatically be installed via its peerDependencies. Do not specifically install prettier itself as a dependency.

Edit package.json

{
  // ...
  "prettier": "@checkdigit/prettier-config"
  // ...
  scripts: {
    // ...
    "prettier": "prettier --ignore-path .gitignore --list-different .",
    "prettier:fix": "prettier --ignore-path .gitignore --write .",
    // ...
    "test": "... && npm run prettier"
    // ...
  }
}

In addition to running tests and linting, prettier should also be used by npm test to validate formatting.

If there are issues, npm run prettier:fix will re-format the entire project to the required style.

Note: using .gitignore as the ignore path will ensure that Prettier will ignore files that are ignored by Git. In most cases this is the desired behavior, otherwise you can use a custom .pretterignore file.

Add .prettierignore file (optional)

If you have generated TypeScript files you can have Prettier ignore them by creating a .prettierignore file like so:

src/api/*/swagger.ts

WebStorm

WebStorm supports Prettier, turn on within the preferences at: Languages and Frameworks | JavaScript | Prettier.

You can use ⌥⇧⌘P to format a block with Prettier. WebStorm should also ask if you want to apply Prettier code style rules across the project. (say yes)

License

MIT