Home

Awesome

fixmyjs

Join the chat at https://gitter.im/jshint/fixmyjs

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

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

Installing

npm install fixmyjs -g

Usage

fixmyjs your_file.js

Programatically

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

Tools

Options

These options are mostly named after their JSHINT counterparts.

Built in

Truthy

When these are set to true the options apply.

Falsy

When these are set to false the options apply.

Legacy Mode

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

CLI

fixmyjs --legacy your_file.js

Programatically

var jshint = require('jshint').JSHINT
var fixmyjs = require('fixmyjs')
jshint(stringOfCode, objectOfOptions)
var stringFixedCode = fixmyjs(jshint.data(), 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.

License

MIT