Skip to content
Automatically fix silly lint errors.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Prepares for legacy combination Jul 20, 2013
lib quickfix Aug 19, 2015
test Fixes #132 Feb 12, 2015
.jshintignore Adds coverage information Dec 30, 2014
.travis.yml Adds coverage information Dec 30, 2014 Changes Jan 16, 2015


Join the chat at

Meant to automatically fix your JavaScript errors in a non-destructive way.

Build Status Coverage Status NPM version Dependency Status devDependency Status Download Count


npm install fixmyjs -g


fixmyjs your_file.js


var fixmyjs = require('fixmyjs')
var stringFixedCode = fixmyjs.fix(stringOfCode, objectOfOptions)



These options are mostly named after their JSHINT counterparts.

Built in

  • delete - Removes deletion of variables
  • emptyStatement - Removes empty statements
  • initUndefined - Rewrites variable initializations to undefined
  • invalidConstructor - Does not allow you to initialize built-in primitive constructors
  • isNaN - Replaces equality to NaN with isNaN
  • useLiteral - Rewrites your primitives to use their literal form


When these are set to true the options apply.

  • camelcase - Converts all identifiers to camelCase
  • curly - Adds curly braces to all statements that don't have them
  • es3 - Adds a radix parameter to parseInt
  • nonew - Removes new when using it for side effects
  • snakecase - Convert all identifiers to snake_case
  • multivar - Replace single var with multi line var
  • plusplus - Converts ++ and -- to += 1 || -= 1
  • eqeqeq - Enforce strict equality


When these are set to false the options apply.

  • debug - Removes debugger statements
  • sub - Dot notation conversion

Legacy Mode

fixmyjs supports a legacy mode which can be used via the CLI and programatically.


fixmyjs --legacy your_file.js


var jshint = require('jshint').JSHINT
var fixmyjs = require('fixmyjs')
jshint(stringOfCode, objectOfOptions)
var stringFixedCode = fixmyjs(, stringOfCode, objectOfOptions).run()

Legacy uses JSHINT to determine what needs to be fixed and then uses a combination of regular expressions and string replacements to non-destructively fix any errors. While non-legacy supports more options, it is more prone to being destructive since the JavaScript is rewritten by the program.

Why is it legacy?

We're planning on moving away from code string transformations and into transforming the AST directly because these rules are easier to write, maintain, and offers flexibility in terms of what can be supported. 2.0 release will have fixmyjs using recast which will make fixmyjs more performant and less destructive, esformatter will also be included to perform any style changes.



You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.