Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

code style: prettier

milkee-plugin-prettier

A Milkee plugin for working with Prettier for CoffeeScript without version conflicts.

Tip

Uses Optimized-Prettier (by helixbass) and prettier-plugin-coffeescript (by helixbass) to format CoffeeScript files.

Features

  • Recursively finds .coffee files in the build entry directory and formats them with Prettier.
  • Supports a prettierrc (object or a path to a config file) and .prettierignore to exclude files.
  • Automatically resolves config via prettier.resolveConfig() or package.json#prettier when prettierrc is not provided.

Usage

As a Milkee Plugin (coffee.config.cjs)

const prettierPlugin = require('milkee-plugin-prettier');

module.exports = {
  entry: 'src',
  output: 'dist',
  milkee: {
    plugins: [
      // Pass options (optional)
      prettierPlugin({
        prettierrc: { tabWidth: 2 },        // or a path to a config file
        prettierignore: '.prettierignore'   // optional, resolved from cwd
      })
    ]
  }
};

As a CLI Tool

You can also use this package as a standalone CLI tool to format CoffeeScript files:

# Format files in the current directory
npx cprettier

# Format files in a specific directory
npx cprettier src

The CLI will:

  • Recursively find all .coffee files in the target directory
  • Respect .prettierignore and prettier config files (.prettierrc, prettier.config.js, or package.json#prettier)
  • Format files in place

Notes

  • .prettierignore is resolved relative to process.cwd() by default. You can pass an absolute or relative path via the prettierignore option.
  • When config.options.join is used and a single entry file is emitted, the plugin will use the directory of the entry file as the search root for .coffee files.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages