Registry / devops / grunt-tsfmt

grunt-tsfmt

JSON →
library2.0.0jsnpmunverified

Grunt plugin for formatting TypeScript files using typescript-formatter. Current version 2.0.0 works with Grunt ~0.4.1 and typescript-formatter ~3.0.1. Provides a tsfmt task with options for configuration. Suitable for legacy Grunt-based build pipelines; not actively maintained. Compared to direct use of tsfmt or prettier, this integrates into Grunt workflows.

npm install grunt-tsfmt
INSTALL
IMPORT
SIG · GRUNT-TSFMT
G
grunt-tsfmt
devopsjavascriptv2.0.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.

grunt-tsfmt task
grunt.loadNpmTasks('grunt-tsfmt');
require('grunt-tsfmt')
Grunt plugins are loaded via grunt.loadNpmTasks, not require.
tsfmt config
grunt.initConfig({ tsfmt: { ... } });
grunt.config.set('tsfmt', ...) without task registration
The task is named 'tsfmt' and is configured under grunt.initConfig.

Basic Gruntfile setup for formatting TypeScript files using grunt-tsfmt task.

module.exports = function(grunt) { grunt.initConfig({ tsfmt: { options: { configuration: { indentSize: 4, insertSpaces: true } }, files: { src: ['src/**/*.ts'] } } }); grunt.loadNpmTasks('grunt-tsfmt'); grunt.registerTask('default', ['tsfmt']); };
Debug
Known issues
deprecatedPackage is no longer actively maintained; use tsfmt directly or prettier.
fix
Use 'tsfmt' or 'prettier' directly if not tied to Grunt.
affects: >=0.0.0
breakingRequires Grunt ~0.4.1, incompatible with Grunt 1.x.
fix
Use Grunt 0.4.x or update to Grunt 1.x compatible alternative.
affects: >=0.0.0
gotchaOptions are passed as JSON object to typescript-formatter; invalid options may silently fail.
fix
Check typescript-formatter documentation for valid options.
affects: >=0.0.0
deprecatedtypescript-formatter ~3.0.1 may be outdated; newer TypeScript versions require newer tsfmt.
fix
Update typescript-formatter to latest or use alternative formatter.
affects: >=0.0.0
gotchaNo TypeScript version specified; files must be compatible with tsfmt's supported TypeScript version.
fix
Ensure TypeScript version matches tsfmt's expected version (typically 2.x).
affects: >=0.0.0
Errors
Common errors & fixes
Warning: Task "tsfmt" not found. Use --force to continue.
grunt.loadNpmTasks('grunt-tsfmt') not called or plugin not installed.
fix
Install plugin: npm install grunt-tsfmt --save-dev and add grunt.loadNpmTasks('grunt-tsfmt') to Gruntfile.
Aborted due to warnings. (node:1234) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tsfmt' of undefined
Missing or misconfigured tsfmt section in grunt.initConfig.
fix
Add a tsfmt configuration to grunt.initConfig, e.g., tsfmt: { files: { src: ['src/**/*.ts'] } }.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency: requires Grunt ~0.4.1
typescript-formatterrequiredPeer dependency: requires typescript-formatter ~3.0.1 for actual formatting
Agent activity
4 hits · last 30 days
node
4
Resources
grunt-tsfmt — npm install grunt-tsfmt · libregistry