Skip to content

Repository files navigation

@eng618/prettier-config

A highly opinionated, yet sensible Prettier configuration with built-in support for imports organization, package.json sorting, and JSDoc formatting.

CI npm version license code style: prettier

✨ Features

  • Built-in Plugins:
  • Sensible Defaults:
    • printWidth: 120 for modern screens.
    • singleQuote: true for clean JavaScript/TypeScript.
    • trailingComma: 'all' for cleaner git diffs.
    • Standardized indentation (2 spaces) and line endings (LF).
  • TypeScript Ready: Includes full type definitions for IntelliSense.
  • Hybrid Support: Works with both ESM and CommonJS.

🚀 Installation

# Using npm
npm install --save-dev @eng618/prettier-config prettier

# Using yarn
yarn add --dev @eng618/prettier-config prettier

# Using pnpm
pnpm add --save-dev @eng618/prettier-config prettier

Tip

All plugins (organize-imports, packagejson, jsdoc) are included as dependencies, so you don't need to install them manually!

🛠 Usage

Simple Setup (package.json)

The easiest way to use this config is by referencing it in your package.json:

{
  "name": "my-cool-project",
  "prettier": "@eng618/prettier-config"
}

Built-in .prettierignore

This package ships with a comprehensive .prettierignore file that ignores common non-project directories and build artifacts:

  • Build and dist directories (.next, dist, build, coverage)
  • Dependency directories (node_modules, .yarn)
  • Tooling and cache (.git, .github, .husky, .cache, .turbo, .eslintcache, .nycrc)
  • Environment files (.env*)
  • OS files (.DS_Store, Thumbs.db)

Simply copy the .prettierignore file from this package into your project root, or create your own if you need custom patterns.

Advanced Setup (prettier.config.js)

If you need to override or extend the config, create a prettier.config.js (or .prettierrc.js) file:

ES Modules (Recommended)

import eng618Config from '@eng618/prettier-config';

/** @type {import('prettier').Config} */
export default {
  ...eng618Config,
  // Your overrides here
  semi: false,
};

CommonJS

const eng618Config = require('@eng618/prettier-config');

/** @type {import('prettier').Config} */
module.exports = {
  ...eng618Config,
  // Your overrides here
  semi: false,
};

📝 Scripts

Add these to your package.json for easy formatting:

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

📄 License

MIT © Eric N. Garcia


Contributors ✨

Thanks goes to these wonderful people (emoji key):


Eric Garcia

📖 💻 🚇

About

My configuration file for prettier

Resources

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

Generated from eng618/template