Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

87 lines (52 sloc) 2.818 kb

fixmyjs || jshint-autofix

Build Status

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

For the nodejs package see https://github.com/goatslacker/node-fixmyjs

For the website see https://github.com/goatslacker/fixmyjs.com

How to Install CLI

npm install fixmyjs -g

Website

http://fixmyjs.com allows you to use this tool on the web.

Currently supports

  • Missing semicolon. var a = 1 -> var a = 1;

  • Missing spaces. white

  • Multiple definitions of a variable in scope.

  • Statements written better in dot notation vs square bracket notation. foo['hello'] -> foo.hello

  • Mixed spaces/tabs

  • Unnecessary semicolons if (1) { }; -> if (1) { }

  • Removes confusing trailing decimal points 4. -> 4

  • Obj & Array literals instead of new Array | new Object var arr = new Array(); -> var arr = [];

  • Adds 0 to leading decimals .2 -> 0.2

  • Adds parenthesis when invoking a constructor without them var a = new Foo; -> var a = new Foo();

  • Removes undefined when assigning to variables

  • Removes debugger statements

  • Uses isNaN function rather than comparing to NaN a === NaN -> isNaN(a)

  • Moves the invocation of a function within it's parenthesis (function () { })() -> (function () { }())

  • Extra comma var a = [1,,2]; -> var a = [1,2];

Developing on fixmyjs

Fork the repo. I welcome contributions.

git clone git://github.com/jshint/fixmyjs.git && cd fixmyjs
git submodule init && git submodule update
npm install

Coding style

  • Indent 2 spaces
  • Single quotes > Double quotes
  • Write tests
  • Code must pass npm test

License

Copyright (C) 2011 by Josh Perez josh@goatslacker.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to Line
Something went wrong with that request. Please try again.