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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jabworks/prettier-config

v0.1.3

Published

[![NPM Version](https://img.shields.io/npm/v/%40jabworks%2Fprettier-config?style=flat-square&logo=npm)](https://www.npmjs.com/package/@jabworks/prettier-config)

Readme

@jabworks/prettier-config

NPM Version

Opinionated Prettier configuration with essential plugins for modern JavaScript, TypeScript, and JSON formatting.

Features

  • Modern formatting rules optimized for readability and consistency
  • Plugin integration for enhanced formatting capabilities:
    • 🎨 Tailwind CSS - Automatic class sorting and optimization
    • 📦 Package.json - Consistent package.json formatting
    • 🔤 JSON sorting - Alphabetical key sorting for better diffs
  • TypeScript support with proper import/export handling
  • Configurable overrides for different file types

Installation

# npm
npm install -D @jabworks/prettier-config

# pnpm
pnpm add -D @jabworks/prettier-config

# yarn
yarn add -D @jabworks/prettier-config

Peer Dependencies

This package requires the following peer dependencies to be installed:

npm install -D prettier prettier-plugin-packagejson prettier-plugin-sort-json prettier-plugin-tailwindcss

Usage

Method 1: Prettier Configuration File (Recommended)

Create a prettier.config.js file in your project root:

import { config } from '@jabworks/prettier-config';

export default config;

Or using CommonJS:

const { config } = require('@jabworks/prettier-config');

module.exports = config;

Method 2: Package.json

Add to your package.json:

{
	"prettier": "@jabworks/prettier-config"
}

Note: This method doesn't support extending or customizing the configuration.

Method 3: Custom Configuration

Extend the base configuration with your own rules:

import { config } from '@jabworks/prettier-config';

export default {
	...config,
	// Your custom overrides
	printWidth: 100,
	semi: false,
};

Configuration Details

This configuration includes the following settings:

Formatting Rules

{
  arrowParens: 'avoid',           // (a) => a instead of (a) => a
  bracketSameLine: false,         // Closing > on new line
  bracketSpacing: true,           // { foo } instead of {foo}
  endOfLine: 'lf',               // Unix line endings
  jsxSingleQuote: true,          // Single quotes in JSX
  printWidth: 120,               // Line length limit
  quoteProps: 'as-needed',       // Quote object properties only when needed
  semi: true,                    // Always add semicolons
  singleAttributePerLine: true,  // Each JSX attribute on its own line
  singleQuote: true,             // Single quotes for strings
  tabWidth: 2,                   // 2 spaces for indentation
  trailingComma: 'all',          // Trailing commas everywhere
  useTabs: false,                // Use spaces instead of tabs
}

Plugins

  • prettier-plugin-tailwindcss: Automatically sorts Tailwind CSS classes
  • prettier-plugin-sort-json: Sorts JSON object keys alphabetically (except package.json)
  • prettier-plugin-packagejson: Formats package.json with standard key order

File-Specific Overrides

  • JSON files (excluding package.json): Uses prettier-plugin-sort-json for key sorting
  • Package.json files: Uses prettier-plugin-packagejson for standard formatting

Examples

Before/After Formatting

JavaScript/TypeScript:

// Before
const example = { c: 1, a: 2, b: 3 };
function test(a, b, c) {
	return a + b + c;
}

// After
const example = { a: 2, b: 3, c: 1 };
function test(a, b, c) {
	return a + b + c;
}

JSON:

// Before
{
  "version": "1.0.0",
  "name": "my-package",
  "dependencies": {
    "z-lib": "1.0.0",
    "a-lib": "2.0.0"
  }
}

// After
{
  "name": "my-package",
  "version": "1.0.0",
  "dependencies": {
    "a-lib": "2.0.0",
    "z-lib": "1.0.0"
  }
}

Tailwind CSS:

// Before
<div className="text-red-500 p-4 bg-blue-100 hover:bg-blue-200 flex items-center">

// After
<div className="flex items-center bg-blue-100 p-4 text-red-500 hover:bg-blue-200">

IDE Integration

VS Code

  1. Install the Prettier extension
  2. Add to your VS Code settings:
{
	"[javascript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[json]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[typescript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	"editor.formatOnSave": true
}

Scripts

Add these scripts to your package.json:

{
	"scripts": {
		"format": "prettier --write .",
		"format:check": "prettier --check ."
	}
}

Compatibility

  • Prettier: >=3.6.2
  • Node.js: >=18.0.0
  • TypeScript: >=5.0.0

License

ISC

Contributing

This package is part of the @jabworks style guide monorepo. Please refer to the main repository for contribution guidelines.