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

fix: don't erase static modifier when auto-fixing static methods #30

Closed mitchell-merry closed 4 months ago

mitchell-merry commented 4 months ago

Description (What)

Added a check to see if the the function we are changing has the static modifier, and if so, retain it.

Before, it would try to fix methods like:

class MyClass {
  static async someFunc() {
    return something;
  }
}

by doing:

class MyClass {
  someFunc = async () => something;
}

Now it does:

class MyClass {
  static someFunc = async () => something;
}

Justification (Why)

This is broken, now this is fixed

How Can This Be Tested?

Unit tests.