prettier-plugin-ignored
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

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:

{
  "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.

Package Sidebar

Install

npm i prettier-plugin-ignored

Weekly Downloads

895

Version

1.0.0

License

ISC

Unpacked Size

5.51 kB

Total Files

6

Last publish

Collaborators

  • tobysmith568