fixmyjs

raw JSON →
2.0.0 verified Fri May 01 auth: no javascript maintenance

fixmyjs automatically fixes JavaScript code based on lint rules from JSHint/JSLint. Version 2.0.0 is latest stable, with no active development since 2016. It applies transformations like adding curly braces, converting to strict equality, hoisting vars, and more. Unlike ESLint's --fix, it works as a separate CLI tool or library. Maintenance mode: critically depends on unmaintained JSHint.

error Cannot find module 'fixmyjs'
cause Package not installed or not in node_modules
fix
Run npm install fixmyjs.
error TypeError: fixmyjs.fix is not a function
cause Used CommonJS require instead of ESM import (fixmyjs v2+ is ESM-only).
fix
Use import { fix } from 'fixmyjs' or import fixmyjs from 'fixmyjs' then fixmyjs.fix(...).
error fixmyjs: command not found
cause CLI not installed globally or not in PATH
fix
Run npm install -g fixmyjs.
breaking Legacy mode removed in v2.0
fix Use config in package.json instead of legacy options.
breaking All rules now truthy in v2.0
fix Set rules to true instead of false to enable; check default config in package.json.
deprecated Package is unmaintained since 2016
fix Consider using ESLint --fix or prettier instead.
gotcha CLI tool requires global install
fix Run `npm install -g fixmyjs` before using `fixmyjs your_file.js`.
gotcha fix function mutates input options object
fix Clone options before passing: fix(code, {...options}).
npm install fixmyjs
yarn add fixmyjs
pnpm add fixmyjs

Demonstrates programmatic usage: fixes code by converting == to === and ++ to +=1.

import { fix } from 'fixmyjs';
const code = 'var x = 1; if (x == 1) { x++; }';
const options = { eqeqeq: true, plusplus: true };
const fixed = fix(code, options);
console.log(fixed); // 'var x = 1; if (x === 1) { x += 1; }'