Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Decaffeinate #236

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open

Decaffeinate #236

wants to merge 49 commits into from

Conversation

aminya
Copy link

@aminya aminya commented Apr 12, 2020

Ready

Description of the Change

Decaffeination: rewrites the codebase in JavaScript

  • tile
  • cursor-position-view
  • file-info-view
  • launch-mode-view
  • selection-count-view
  • status-bar-view
  • git-view
  • main

Rollup: bundle the package using rollup Moved to separate PR

How to review?

Tests are untouched to show full functionality and backward compatibility. ✔️

If you wanna check commit history:

  • Remove guard: using if checks instead of optional chaining in CoffeeScript =-> now we use optional chaining using babel
  • Remove implicit returns: remove unnecessary return in functions because of CoffeeScript
  • Remove inline assignment: move assignment out of if the head
  • Shorter null check: using if (variable) instead of if (variable != null) whenever it is safe
  • Remove IIFE: unnecessary returns because of CoffeeScript

Alternate Designs

Benefits

- Faster loading time because of using JavaScript and Rollup.

  • More flexibility
  • CoffeeScript isn't attractive to developers. The base isn't updated for 3 years now other than the minor edits in v1.8.17 and v1.18.16

Possible Drawbacks

  • Open PRs (if relevant) should be converted too
  • Optional chaining isn't as compact as CoffeeScript in JavaScript. I rewrote them using if checks. By switching to TypeScript/or a new Babel version we can write them more compact. => Now use optional chaining using babel

Applicable Issues

Updates the package to make it ready for atom/atom#18282
Closes the old PR: #215

@aminya aminya force-pushed the decaffeinate branch 4 times, most recently from 5a17396 to b8ee62d Compare April 12, 2020 11:48
@lkashef
Copy link

lkashef commented Jul 17, 2020

@aminya thanks for the contribution, however to make the review process more effective and minimize risks I would ask you to follow the advice shared on this PR.

In general decaffeination would best happen on stages, to let the users harshly test it out and make sure there are no regressions, another approach if you want to keep things organized is to create an issue tracking your progress for a certain package or code base.

an example for a tracking issue, first let everyone know that this issue is to track x goals for y package/repo, phases could be:

  1. decaffeinate to vanilla javascript (would be best to break up to separate PRs if possible for the review to be feasible, reviewing a 1K LOC is not)
  2. decaffeinate tests
  3. improve code using Rollup, babel, Typescript, etc (divide into separate PRs when applicable)
  4. performance improvements

I hope that helps

@lkashef lkashef removed the triaged label Jul 17, 2020
@aminya aminya force-pushed the decaffeinate branch 2 times, most recently from be21b5d to fab8f99 Compare July 17, 2020 17:42
@aminya aminya changed the title Decaffeinate and Rollup Decaffeinate Jul 17, 2020
@aminya aminya mentioned this pull request Jul 17, 2020
@aminya
Copy link
Author

aminya commented Jul 17, 2020

@lkashef This is now changed to be only decaffeination. I cannot remove babel since optional chaining relies on that. Now, I used babel-preset-atomic to simplify everything.

  1. I suggest you to follow my commits instead of going through the source code. The changes are trivial, and I went very verbose. Every change is in a separate commit. Other than the automatic commits (decaffeinate and prettier), I only fixed one change.

Note only related to status-bar PR:
This pull request is a little different from underscore-plus. Since at the time I made this I had not added optional chaining support to decaffeinate tool, so I had to convert those manually by hand.
If you see that I write remove guard remember this is due to optional chaining. By babel, I brought back the CoffeeScript syntax to decrease the difference between CoffeeScript and javascript. So you'd better skip "removing guard" commits and only check their respective optional chaining commit.

  1. Another method for reviewing is to open two tabs and see the code by your eyes. The final version is now very similar to the original code.

With that being said, I want to state that there should be some level of trust between us. If for some reason there was a regression, we could fix it quickly. If we want to stay conservative, these pull requests will not go anywhere.

@lkashef
Copy link

lkashef commented Jul 17, 2020

@aminya Thanks for sharing these insights and alternative approaches, I like the first approach you suggested also updating the description about the content, these are certainly helpful to proceed with this PR


With that being said, I want to state that there should be some level of trust between us. If for some reason there was a regression, we could fix it quickly. If we want to stay conservative, these pull requests will not go anywhere.

Regarding the above two lines and other PRs in general, there is indeed a level of trust, otherwise we won’t be investing the time to review the PR; we hold the responsibility of 3M+ active users that depend on us to do our job without breaking their workflows, so I hope you can understand why we might want to be somewhat conservative in our processes here and it’s a process we adapted and improved over time that brought Atom to what it is today.

One perspective I would like to share with you, we prioritize bug fixes and stabilizing Atom, as it’s a core that the community can build on top of it, so decaffeination, performance enhancements and features that could be implemented in it’s own community package, such PRs could go behind in line before many bug fixes PRs, things like electron upgrades, and open issues.

We are open to improve things, use modern code, approaches, improve performances, etc and we try to find the balance between allowing passionate contributors to get some what non-high priority PR reviewed and merged to show some appreciating and respect for the time they invested, but the priority will always go to make things stable so both Atom team and the community can build on top of something stable and trusted

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants