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

https://github.com/tobysmith568/prettier-plugin-ignored

A Prettier plugin that adds an 'ignored' language, allowing you to ignore files without listing them in a .prettierignore file.
https://github.com/tobysmith568/prettier-plugin-ignored

formatter formatting npm-package prettier prettier-plugin

Last synced: 10 months ago
JSON representation

A Prettier plugin that adds an 'ignored' language, allowing you to ignore files without listing them in a .prettierignore file.

Awesome Lists containing this project

README

          

# prettier-plugin-ignored

A Prettier plugin that adds an 'ignored' language, allowing you to ignore files without listing them in a `.prettierignore` file.


npm


Protected by: License-Cop

## Why is this useful?

While Prettier configs can be shared across multiple repositories via npm packages, `.prettierignore` files cannot. This plugin solves that limitation by allowing you to configure which files should be ignored directly in the Prettier config. As a result, you can share ignored files across multiple repositories.

The plugin extends Prettier with a new language called 'ignored'. When Prettier encounters a file with this language, it formats it to be exactly as it was found, effectively ignoring it.

## Installation

```pwsh
npm install --save-dev prettier-plugin-ignored
```

## Usage

Add the plugin to your Prettier config and override specific files to use the 'ignored' parser.

For example, here I'm using it to always ignore `pnpm-lock.yaml` files and json files in `public` directories:

```jsonc
{
"plugins": ["prettier-plugin-ignored"],

// Other config options...

"overrides": [
{
"files": ["pnpm-lock.yaml", "public/**.json"],
"options": {
"parser": "ignored"
}
}
]
}
```

## License

prettier-plugin-ignored is licensed under the [ISC license](./LICENSE.md).