grunt-fixmyjs

raw JSON →
0.3.0 verified Fri May 01 auth: no javascript deprecated

Grunt plugin to automatically fix silly JavaScript lint errors by running fixmyjs. Version 0.3.0 (latest) wraps fixmyjs as a Grunt task to fix lint issues like missing semicolons, curly braces, variable naming conventions, and more. Works with Grunt >=0.4.x and Node >=0.8.0. Supports configuration via .jshintrc, dry-run mode, diff/patch output. No longer actively maintained; prefer modern tools like ESLint with --fix.

error Warning: Task "fixmyjs" not found.
cause Plugin not loaded or not installed correctly.
fix
Ensure grunt.loadNpmTasks('grunt-fixmyjs') is in Gruntfile and package is in devDependencies.
error ReferenceError: fixmyjs is not defined
cause Trying to use 'fixmyjs' as a standalone function instead of Grunt task.
fix
Use grunt.initConfig with task 'fixmyjs' and run via grunt command.
error Cannot find module 'fixmyjs'
cause fixmyjs dependency missing or not installed.
fix
Run 'npm install fixmyjs --save-dev' (or ensure it's listed in package.json).
deprecated Package is no longer maintained. fixmyjs itself is deprecated; use ESLint's --fix instead.
fix Migrate to ESLint or Prettier for automated lint fixes.
breaking Grunt v0.4.x only. Does not work with Grunt v1.x automatically; may need peer dependency adjustment.
fix Pin grunt to version 0.4.x or adapt plugin for Grunt 1.x.
gotcha The fixmyjs version bundled may be outdated and produce incorrect fixes or miss modern JS features.
fix Use a newer standalone fixmyjs version if needed, but prefer ESLint.
gotcha Option 'diff' and 'patch' output to stdout; if used in automation, ensure output is captured or suppressed.
fix Set 'silent: true' to suppress output, or redirect stderr/stdout as needed.
npm install grunt-fixmyjs
yarn add grunt-fixmyjs
pnpm add grunt-fixmyjs

Install the plugin, configure fixmyjs task to read .jshintrc and fix all JS files in src/ outputting to fixed/.

npm install grunt-fixmyjs --save-dev
// Gruntfile.js
module.exports = function(grunt) {
  grunt.initConfig({
    fixmyjs: {
      options: {
        config: '.jshintrc',
        indentpref: 'spaces'
      },
      target: {
        files: [{ expand: true, cwd: 'src/', src: ['**/*.js'], dest: 'fixed/' }]
      }
    }
  });
  grunt.loadNpmTasks('grunt-fixmyjs');
};
// Run: grunt fixmyjs