fixmyjs
v2.0.0
Published
Automatically fixes your JavaScript based on lint rules
Maintainers
Readme
fixmyjs
Meant to automatically fix your JavaScript errors in a non-destructive way.
Installing
npm install fixmyjs -gUsage
fixmyjs your_file.jsProgramatically
var fixmyjs = require('fixmyjs')
var stringFixedCode = fixmyjs.fix(stringOfCode, objectOfOptions)Tools
Options
When the options are set to true they are enabled. To get a breakdown of what is enabled by default check out package.json
camelcase- Converts all identifiers to camelCasecurly- Adds curly braces to all statements that don't have themcurlyfor- Adds curly braces only to for statementscurlyif- Adds curly braces only to if/if-else statementscurlywhile- Adds curly braces only to while statementsdebug- Removes debugger statementsdecimals- Adds a leading0for decimals or removes trailing zero if decimal is wholedelete- Removes deletion of variablesemptyStatement- Removes empty statementseqeqeq- Enforce strict equalityes3- EnforcesparseIntRadixas well asno-comma-danglehoist- Hoists all your vars to the top of the functioninitUndefined- Rewrites variable initializations to undefinedinvalidConstructor- Does not allow you to initialize built-in primitive constructorsinvokeConstructors- Adds()to any new expressionsisNan- Replaces equality to NaN with isNaNmultivar- Replace single var with multi line varno-comma-dangle- Removes trailing commasnonew- Removes new when using it for side effectsonevar- Make multi var into one varparseIntRadix- Adds a radix parameter to parseIntplusplus- Converts++and--to+= 1||-= 1rmdelete- Removes the deletion of variablesrmempty- Removes empty statementssnakecase- Convert all identifiers to snake_casesub- Dot notation conversionuseLiteral- Rewrites your primitives to use their literal form
Breaking Changes in 2.0
- Legacy mode has been removed.
- You now put your config inside package.json. You can check out an example in this project.
- All rules have been made truthy because having some rules be truthy and others falsy is weird.
- Option
es3now enablesno-comma-dangleas well as new optionparseIntRadix.
