Registry / devtools / coffee-fmt

coffee-fmt

JSON →
library0.12.0jsnpmunverified

CoffeeScript formatter/beautifier inspired by gofmt, version 0.12.0 (last released 2018, no recent updates). It formats CoffeeScript code with options for indent style and size. Differentiates via golang-like philosophy but limited adoption and potential bugs in edge cases. Supports CLI and JS API. Note: CoffeeScript itself is deprecated.

npm install coffee-fmt
INSTALL
IMPORT
SIG · COFFEE-FMT
C
coffee-fmt
devtoolsjavascriptv0.12.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import fmt from 'coffee-fmt'
const fmt = require('coffee-fmt')
Package supports CJS require; there is no default export for ESM.
format
const { format } = require('coffee-fmt')
import { format } from 'coffee-fmt'
No named export for ESM; use default import or CJS destructuring.
format
const fmt = require('coffee-fmt'); fmt.format(code, opts)
const format = require('coffee-fmt/format')
Wrong path; format is a method on the default export.

Reads CoffeeScript file, formats with 2-space indent, outputs to stdout.

const fmt = require('coffee-fmt'); const fs = require('fs'); const coffee = fs.readFileSync('example.coffee', 'utf8'); try { const formatted = fmt.format(coffee, { tab: ' ', newLine: '\n' }); console.log(formatted); } catch (e) { console.error('Formatting failed:', e.message); }
Debug
Known issues
gotchaParsing may throw unhandled errors on malformed CoffeeScript; always wrap in try-catch.
fix
Use try-catch block as shown in the API example.
affects: *
deprecatedCoffeeScript language is deprecated; consider migrating to JavaScript/TypeScript.
fix
Use a modern language instead.
affects: *
gotchaIndent_size option is ignored when using tab indent_style.
fix
Set indent_size only with space indent_style.
affects: >=0.1.0
gotchaDebug output goes to stdout, not stderr; may interfere with output redirection.
fix
Set --debug=false or redirect stderr separately.
affects: *
Errors
Common errors & fixes
TypeError: fmt.format is not a function
Incorrect import: using default import from ESM expecting named export.
fix
Use const fmt = require('coffee-fmt'); then fmt.format(...)
Cannot find module 'coffee-fmt'
Package not installed globally or locally.
fix
Run 'npm install coffee-fmt' in your project.
SyntaxError: Unexpected token ILLEGAL
Input contains invalid CoffeeScript syntax (e.g., stray characters).
fix
Validate your CoffeeScript code before formatting.
Upgrade
Version history
0.12.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
22
OpenAI (training)
1
Resources
coffee-fmt — npm install coffee-fmt · libregistry