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

@6river/prettier-config

v1.2.28

Published

6 River Systems Prettier configuration.

Downloads

4,555

Readme

@6river/prettier-config

6 River Systems Prettier configuration.

Installation

npm install --save-dev @6river/prettier-config

The simplest way to use it is package.json:

"prettier": "@6river/prettier-config"

You can also use a standalone file like .prettierrc.json:

"@6river/prettier-config"

To extend the configuration, use .prettierrc.js:

module.exports = {
	...require('@6river/prettier-config'),
	semi: false,
};

For more information, see the Prettier documentation.

With ESLint

npm install --save-dev eslint-config-prettier

In your ESLint configuration, add "prettier" to extends. For example, with .eslintrc.json and the 6 River ESLint configuration:

{
	"extends": ["6river", "prettier"]
}

If you are using Typescript and the ESLint plugin @typescript-eslint/eslint-plugin, add "prettier/@typescript-eslint" to extends as well. For example, with .eslintrc.json and the 6 River ESLint configuration:

{
	"extends": ["6river/typescript", "prettier", "prettier/@typescript-eslint"]
}

For more information, see the eslint-config-prettier documentation.

Usage

Editor Plugins

The most common way to use Prettier is through an editor plugin that automatically formats files on every save. If you use VS Code, the most popular Prettier plugin is esbenp.prettier-vscode.

There are Prettier plugins for most editors. See the full list on prettier.io.

Commit Hooks

In projects that use Prettier, it can be useful to set up a commit hook to ensure that no new code is committed without being formatted. This can also be used for a gradual migration to Prettier.

To format staged files with Prettier before each commit, you can use pretty-quick with husky.

npm install --save-dev pretty-quick husky

Add the following to package.json:

"husky": {
	"hooks": {
		"pre-commit": "pretty-quick --staged"
	}
}

Continuous Integration

To ensure that code is formatted as part of the continuous integration (CI) process, you can use pretty-quick. Since pretty-quick only looks at changed files, it will only fail CI when there are unformatted files in the current branch.

Add the following to your CI configuration:

npx pretty-quick --check

Optionally, use the --branch flag to set the base branch to something other than master.

Converting an Entire Project

To convert an entire project to Prettier format:

  1. Add ignored directories and files to .prettierignore. Most of the time, this can be done with cp .gitignore .prettierignore.
  2. Run the following command, adding or removing file extensions from the list to meet your needs:
npx prettier --write '**/*.{js,ts,md,json,yml,yaml,css,scss,less,graphql,mdx,jsx,tsx}'