Skip to content
πŸ› οΈToolsShed

Prettier Config Generator

Generate a .prettierrc configuration file by selecting your preferred code formatting options.

{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": false,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "arrowParens": "always",
  "proseWrap": "preserve",
  "endOfLine": "lf"
}

About this tool

The Prettier Config Generator helps you create a .prettierrc file without memorizing every formatting option Prettier supports. It solves a common pain point: setting up consistent, automated code formatting for your JavaScript and TypeScript projects so you never argue about style again.

Toggle the options that matter to you such as semicolons, single or double quotes, tab width, trailing commas, and print width, then copy the generated .prettierrc straight into your project root. It is ideal for starting new projects, aligning a team around a shared style, or smoothing the onboarding of new contributors.

Tip: commit the config file to your repository so everyone on the team formats their code identically and diffs stay clean. Everything runs locally in your browser, so your preferences and code never leave your machine.

Frequently Asked Questions

Code Implementation

import json

# Generate .prettierrc configuration
config = {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": False,
    "semi": True,
    "singleQuote": False,
    "trailingComma": "es5",
    "bracketSpacing": True,
    "arrowParens": "always",
    "endOfLine": "lf"
}

with open(".prettierrc", "w") as f:
    json.dump(config, f, indent=2)

print("Generated .prettierrc:")
print(json.dumps(config, indent=2))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.