Creating a tool to rewrite jQuery to vanilla Javascript? Something like rector from PHP. - eviltoast

In PHP ecosystem there is a tool called Rector. It helps a lot in automated refactoring. It helps a lot in updating from a bad design pattern to another, update code to match a given framework updates, etc.

Maybe we could create a similar tool for client side Javascript to migrate away from jQuery to vanilla Javascript. Websites youmightnotneedjquery.com have a good collections of vanilla JS alternatives to jQuery.

While one could do it manually, on larger code bases, it is extremely tedious.

Maybe such tool exists and I am unaware of it?

At first, I thought about having such transformation as an optimization step in the bundler, but this is unnecessarily redundant and might cause a lot of troubles.

      • lemmeBe@sh.itjust.works
        link
        fedilink
        arrow-up
        7
        ·
        edit-2
        18 days ago

        HTML, CSS, Javascript. Works like a charm for simple sites, and it’s very lightweight. Things’ve progressed a long way in these vanilla’s. 😉

      • Giloron@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        18 days ago

        A lot of what jQuery provided is built in now. Selectors, AJAX, JSON conversion.

        Version 4 is removing those redundant functions to streamline it to just the unique functionality.

    • dragnucs@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      17 days ago

      Good for you. However many many people are still stuck with ugly ass slow poorly written jQuery code.

    • dragnucs@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      17 days ago

      This is awesome. Lookalike would enable code refactoring from jQuery to vanilla.

      Thanks a lot!