eslint-plugin-hooks icon indicating copy to clipboard operation
eslint-plugin-hooks copied to clipboard

Add autofix

Open pawk3k opened this issue 2 years ago • 7 comments

Thanks for your eslint plugin , i was inspired by import order Also when building this PR , i thought it could be just a part of regular eslint , it's only function call order and nothing else, but since i was working on this project as starting point ,i thought it would be easier to get through.

  • [x] updated tests
  • [x] add fix option for hooks

pawk3k avatar Mar 13 '22 16:03 pawk3k

Great idea @pawk3k , autoFix will be very useful as I tried adding this library to an existing project but it will take too long to manually go through and fix everything

walterholohan avatar Mar 15 '22 14:03 walterholohan

@hiukky Thanks for your review, when i have time i will update typing and will try to simplify some code , thanks for your time.

pawk3k avatar Mar 18 '22 07:03 pawk3k

About this feature, I'm working on it at https://github.com/hiukky/eslint-plugin-hooks/tree/feature/autofix for anyone who wants to test or work on it.

The feature itself already works in a real application by the tests I did, but I still have some problems with Eslint's test feature because the feature is functional but some cases are breaking tests.

So far I've done tests with line comments and blocks before the function declaration and inside the function itself, but we still have some cases like comments at the end of the block (same line).

// IT WORKS
function foo() {
   // IT WORKS
} // STILL DOES NOT WORK

/**
  * IT WORKS
  */
function bar() {
   /**
    * IT WORKS
    */
} // STILL DOES NOT WORK

@pawk3k if you're still willing to work on it, you can track this branch, this implementation is simpler.

This feature will be released in version 0.5.0!

hiukky avatar Apr 05 '22 12:04 hiukky

@hiukky Thank you very much for your work. I'm looking forward to the automatic repair function online. Please tell me how long can you complete it?

OBKoro1 avatar Apr 14 '22 12:04 OBKoro1

Thank you @OBKoro1 ! I can't tell you when this will be released due to my time limitation and involvement with other projects, but I'll try to give a little more attention to this feature and release an alpha version later this week, for those who want and testing, even because I already receive some bug feedbacks.

hiukky avatar Apr 14 '22 16:04 hiukky

Hi @hiukky Is it possible to merge this feature to new version? Thank you.

rozekfr avatar Jun 29 '23 11:06 rozekfr

@hiukky Is development going to resume anytime? Because if not I think it's better someone else forks the repo and continues development, maybe @pawk3k :)

EliasVal avatar Apr 14 '24 13:04 EliasVal