Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ProfessorManhattan/prettier-config-sexy-mode

Simplifies configuring Prettier by bundling plugins and configuring them in a single shareable configuration
https://github.com/ProfessorManhattan/prettier-config-sexy-mode

Last synced: 3 months ago
JSON representation

Simplifies configuring Prettier by bundling plugins and configuring them in a single shareable configuration

Awesome Lists containing this project

README

        




Prettier Config Sexy Mode logo





A Prettier Config That Makes Files Sexy


A configuration managed by Megabyte Labs





Homepage


Contributing


Slack


Gitter


GitHub


GitLab






Version: 1.1.4


Build status


Dependency status reported by Depfu


Zip file size


Total downloads of prettier-config-sexy-mode on npmjs.org


Number of vulnerabilities from Snyk scan on prettier-config-sexy-mode


Documentation


License: MIT

>

**Simplifies configuring Prettier by bundling plugins and configuring them in a single shareable configuration**

## Table of Contents

- [Overview](#overview)
- [Requirements](#requirements)
- [Developer Requirements](#developer-requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Plugins](#plugins)
- [Contributing](#contributing)
- [Affiliates](#affiliates)
- [License](#license)

## Overview

[Prettier](https://prettier.io/) is the defacto standard for formatting JavaScript, TypeScript, JSON, and YML. It rarely, if ever, causes any issues and it makes keeping your code base neater much easier. On top of that, through the use of plugins, you can also use Prettier to format PHP, Pug, Ruby, XML, Go HTML templates, `.ini` files, Java, `.properties` files, shell scripts, Solidity files, and more (listed in the [Plugins section below](#Plugins)). This configuration includes all known, well-tested Prettier plugins as well as **[prettier-plugin-package-perfection](https://github.com/ProfessorManhattan/prettier-plugin-package-perfection)** which is arguably the ultimate formatter for `package.json` files.

## Requirements

If you are simply including this library in your project, all you need is a recent version of Node.js. **[Node.js >14.18.0](repository.project.node)** is sometimes required and is the only version range we actively support. Albeit, it is highly probable that lower versions will work as well depending on the requirements that this project imports.

### Developer Requirements

The following versions of Node.js and Python are required for development:

- **[Node.js >14.18.0](repository.project.node)**
- **[Python >3.10.0](repository.project.python)**

Other versions may work, but only the above versions are supported. Most development dependencies are installed automatically by our `Taskfile.yml` set-up (even Node.js and Python). Run `bash start.sh` to install **[Bodega](https://github.com/ProfessorManhattan/Bodega)** (an improved fork of [go-task](https://github.com/go-task/task)) and run the initialization sequence. The taskfiles will automatically install dependencies as they are needed, based on what development tasks you are running. For more information, check out the [CONTRIBUTING.md](https://github.com/megabyte-labs/prettier-config-sexy-mode/blob/main/docs/CONTRIBUTING.md) or simply run:

```shell
npm run help
```

`npm run help` will ensure Bodega is installed and then open an interactive dialog where you can explore and learn about various developer commands.

## Installation

To install this shareable configuration, you should start by adding the project to your `devDependencies` by running:

```shell
npm install --save-dev prettier-plugin-sexy-mode
```

After that, you need to add the configuration to your `package.json` file under the `prettier` key. Your `package.json` might look something like this:

```json
{
"name": "mypackage",
"version": "1.0.4",
...
"devDependencies": {
"prettier-plugin-sexy-mode": "^1.0.0"
},
"prettier": "prettier-plugin-sexy-mode"
}
```

For more information on shareable configurations, check out [Prettier's guide](https://prettier.io/docs/en/configuration.html#sharing-configurations).

## Usage

After installing the package, you can simply run Prettier and it will determine which plugin to use based on the file extension. This logic is mostly baked into each plugin. For example:

```shell
npm install -g prettier
prettier --list-different .
```

The command above will scan through your entire project (if run in the root of the project) and list the files that Prettier has changes for.

## Plugins

This configuration attempts to include all the best, well-known Prettier plugins that have lots of stars on GitHub. For your reference, the chart below details which plugins are included:

| Prettier Plugin | Description | File Types |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [`@prettier/plugin-php`](https://npmjs.com/package/@prettier/plugin-php) | Adds support for PHP | `*.php` |
| [`@prettier/plugin-pug`](https://npmjs.com/package/@prettier/plugin-pug) | Adds support for Pug templates | `*.jade`, `*.pug` |
| [`@prettier/plugin-ruby`](https://npmjs.com/package/@prettier/plugin-ruby) | Adds support for Ruby | `*.rb` and [many more](https://github.com/prettier/plugin-ruby/blob/main/src/plugin.ts#L20) |
| [`@prettier/plugin-xml`](https://npmjs.com/package/@prettier/plugin-xml) | A prettier plugin for XML | `*.xml` and [many more](https://github.com/prettier/plugin-xml/blob/main/src/plugin.ts#L59) |
| [`prettier-plugin-go-template`](https://npmjs.com/package/prettier-plugin-go-template) | Adds support for Go templates | `*.gohtml`, `*.gotmpl`, `*.go.tmpl`, `*.tmpl`, `*.tpl`, `*.html.tmpl`, `*.go.html` |
| [`prettier-plugin-csharp`](https://npmjs.com/package/prettier-plugin-csharp) | Adds support for C# | `*.cs`, `*.cake`, `*.cshtml`, `*.csx` |
| [`prettier-plugin-ini`](https://npmjs.com/package/prettier-plugin-ini) | Adds support for INI files | `*.ini` |
| [`prettier-plugin-java`](https://npmjs.com/package/prettier-plugin-java) | Adds support for Java | `*.java` |
| [`prettier-plugin-jsdoc`](https://npmjs.com/package/prettier-plugin-jsdoc) | Adds support for JSDoc comments in TypeScript/JavaScript files | `*.js`, `*.ts`, `*.jsx`, `*.tsx`, `*.mdx`, possibly others |
| [`prettier-plugin-organize-imports`](https://npmjs.com/package/prettier-plugin-organize-imports) | Makes Prettier organize your TypeScript imports using the `organizeImports` feature of the TypeScript language service API | `*.js`, `*.jsx`, `*.ts`, `*.tsx`, `*.vue` |
| [`prettier-plugin-package-perfection`](https://npmjs.com/package/prettier-plugin-package-perfection) | Sorts the keys and does some auto-formatting of the `package.json` file (uses [prettier-package-json](https://www.npmjs.com/package/prettier-package-json) for the logic) | `package.json` |
| [`prettier-plugin-properties`](https://npmjs.com/package/prettier-plugin-properties) | Adds support for `properties` files | `*.properties` |
| [`prettier-plugin-sh`](https://npmjs.com/package/prettier-plugin-sh) | Adds support for running Prettier on shell scripts | `*.sh`, `Dockerfile`, `.gitignore`, `.dotenv`, possibly more |
| [`prettier-plugin-solidity`](https://npmjs.com/package/prettier-plugin-solidity) | Adds support for Solidity code | `*.sol` |
| [`prettier-plugin-sql`](https://npmjs.com/package/prettier-plugin-sql) | Adds support for SQL | `*.sql` |
| [`prettier-plugin-toml`](https://npmjs.com/package/prettier-plugin-toml) | Adds support for TOML | `*.toml` |

It might be important to note that although [@prettier/plugin-python](https://github.com/prettier/plugin-python) is popular on GitHub, we did not include it because the project's README.md suggests using [Black](https://github.com/psf/black) (a Python CLI) instead.

## Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/megabyte-labs/prettier-config-sexy-mode/issues). If you would like to contribute, please take a look at the [contributing guide](https://github.com/megabyte-labs/prettier-config-sexy-mode/blob/master/docs/CONTRIBUTING.md).

Sponsorship





Dear Awesome Person,


I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.


Sincerely,

**_Brian Zalewski_**


Open Collective sponsors


GitHub sponsors


Patreon

### Affiliates

Below you will find a list of services we leverage that offer special incentives for signing up for their services through our special links:


MailChimp


DigitalOcean Referral Badge

## License

Copyright © 2020-2021 [Megabyte LLC](https://megabyte.space). This project is [MIT](https://gitlab.com/megabyte-labs/npm/configs/prettier-config-sexy-mode/-/blob/master/LICENSE) licensed.