coderaiser / putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
https://putout.cloudcmd.io/
MIT License
698 stars 40 forks source link

[eslint-plugin-putout]: `--fix` breaks enums. #169

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

Every time this eslint plugin fixes a rule, it formats the file. This formatting breaks enums:

export const enum ABC {
  A,
  B,
  C,
  D,
  E
}

const x = typeof 5 === 'number' // example rule to trigger the putout formatter

turns into:

const isNumber = (a): a is number => typeof a === 'number'
export const enum ABC {
  A =,
  B =,
  C =,
  D =,
  E =
}

const x = isNumber(5) // example rule to trigger the putout formatter
coderaiser commented 1 year ago

Fixed in @putout/printer@2.87 🎉. Please re-install 🐊.

Is it works for you?

ElPrudi commented 1 year ago

Yes, now it doesn't try to change it anymore. Thank you very much :)