Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking the time to clean up the codebase #75

Merged
merged 1 commit into from
Jun 13, 2016
Merged

Conversation

tbranyen
Copy link
Owner

@tbranyen tbranyen commented Jun 11, 2016

I've wanted to take the time to clean up the codebase and ensure
everything is consistent. Right now my refactor efforts are to use
common nomenclature when talking about Virtual Tree Elements and DOM
Nodes. This distinction is important in the codebase, and is currently
different depending on the file you're in. Sometimes they're called
entry, sometimes tree, descriptor, etc. I'm consolidating all the
variable names to vTree and node.

Another important refactor is to provide clean and consistent JSDoc
comments above all functions public/private.

I'm attempting to use const wherever possible to denote that a
variable is never re-assigned. I'm refactoring branched code that
required using var or let into functions. I will still use let for
loops, since we are tight-loop critical and I don't like the overhead of
functional looping here.

There are parts of the codebase that are highly duplicative and I'm
leveraging the createElement/createAttribute functions, exposed for the
Babel transform, internally.

@tbranyen
Copy link
Owner Author

The backwards breaking changes here are the removal of custom errors.

@tbranyen tbranyen force-pushed the general-cleanup branch 4 times, most recently from 974ffc1 to 49293c2 Compare June 13, 2016 20:32
I've wanted to take the time to clean up the codebase and ensure
everything is consistent. Right now my refactor efforts are to use
common nomenclature when talking about Virtual Tree Elements and DOM
Nodes. This distinction is important in the codebase, and is currently
different depending on the file you're in. Sometimes they're called
entry, sometimes tree, descriptor, etc. I'm consolidating all the
variable names to vTree and node.

Another important refactor is to provide clean and consistent JSDoc
comments above all functions public/private.

I'm attempting to use `const` wherever possible to denote that a
variable is never re-assigned. I'm refactoring branched code that
required using `var` or `let` into functions. I will still use `let` for
loops, since we are tight-loop critical and I don't like the overhead of
functional looping here.

There are parts of the codebase that are highly duplicative and I'm
leveraging the createElement/createAttribute functions, exposed for the
Babel transform, internally.

In preparation for a 1.0 release, I want to make sure all the code makes
sense and references variables consistently. This furthers that push by
making it explicit that an object is either a DOM Node or a Virtual Tree
Element/Attribute. This made it easier to re-arrange the file structure
to better match what they do. For instance, before makeElement made a
DOM Node and makeNode made a Virtual Tree Element.

This didn't affect tests other than for import paths in the internal
unit tests.
@tbranyen
Copy link
Owner Author

Since this PR is fairly significant, I'm going to merge as-is and continue refactoring each specific module individually.

@tbranyen tbranyen merged commit 1a67748 into master Jun 13, 2016
@tbranyen tbranyen deleted the general-cleanup branch June 13, 2016 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant