JamieMason / eslint-plugin-prefer-arrow-functions

Auto-fix plain Functions into Arrow Functions, in all cases where conversion would result in the same behaviour
https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions
MIT License
43 stars 11 forks source link

TypeScript return types go missing with --fix #2

Closed zEh- closed 2 years ago

zEh- commented 4 years ago

Description

TypeScript return types go missing with --fix.

Original:

function main(): void {
  console.log('main')
}
function notVoid(): number {
  const a = 3
  return a * 2
}

Expected:

const main = (): void => {
  console.log('main')
}
const notVoid = (): number => {
  const a = 3
  return a * 2
}

Actual:

const main = () => {
  console.log('main')
};
const notVoid = () => {
  const a = 3
  return a * 2
};
JamieMason commented 2 years ago

This was fixed by @harelmo in #14, released in 3.1.4