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

Refactored html-tools and htmljs to move ES6 version #385

Open
wants to merge 21 commits into
base: release-3.0
Choose a base branch
from

Conversation

guncebektas
Copy link

As requested on #367, I started to migrate code to ES6.
All tests are passing, please review and let me know for required changes.

@guncebektas
Copy link
Author

Besides the pr, I found some exported function has no usage in the blaze like isNully, isTagEnsured, etc... should we stop exporting them.

@jankapunkt
Copy link
Collaborator

Thank you @guncebektas for this PR. Please note, that we first need to merge #382 before we can continue to work on the actual migrations. Once it's done I will review this one.

@jankapunkt jankapunkt mentioned this pull request Jul 25, 2022
14 tasks
@jankapunkt
Copy link
Collaborator

@guncebektas I merged #382 to the master branch so you should pull it in to use it to lint your package. Please make sure there are no remaining lint errors. You can read in the CONTRIBUTING file how to use the linter.

@guncebektas
Copy link
Author

This will be hard to achieve :)

@jankapunkt
Copy link
Collaborator

Hey @guncebektas sorry that was a bit fast from my side. Of course there may be design decisions from back then that will conflict with the linter. For now please only to non-breaking migrations. All other issues will be discussed during review.

@jankapunkt
Copy link
Collaborator

Another thing is, which I mentioned in #385 is that you should please only do one package per PR. Otherwise this gets easily out of hand and becomes impossible to review. For now please keep the scope only to the two packages you worked on.

@guncebektas
Copy link
Author

no problem. I will try to do my best.

@guncebektas
Copy link
Author

It wasn't possible to fulfill all linting rules but I tried to minimize errors. I think a review at this point will be good.
All tests of the project are passing.

In addition to this, I used my version as local packages in my project and all of my e2e tests are passing.

I can trust myself and move faster after reviews. @jankapunkt

@jankapunkt jankapunkt added this to the Blaze 3.0 milestone Jul 26, 2022
@jankapunkt jankapunkt changed the title Refactored to move ES6 version Refactored html-tools and htmljs to move ES6 version Jul 26, 2022
packages/htmljs/html.js Show resolved Hide resolved
packages/htmljs/html.js Outdated Show resolved Hide resolved
packages/htmljs/html.js Outdated Show resolved Hide resolved
packages/htmljs/html.js Outdated Show resolved Hide resolved
packages/htmljs/html.js Outdated Show resolved Hide resolved
packages/htmljs/visitors.js Outdated Show resolved Hide resolved
packages/htmljs/visitors.js Show resolved Hide resolved
packages/htmljs/visitors.js Outdated Show resolved Hide resolved
packages/htmljs/visitors.js Outdated Show resolved Hide resolved
packages/htmljs/visitors.js Outdated Show resolved Hide resolved
@jankapunkt
Copy link
Collaborator

I just focused on htmljs package for now. My most comments focus on using ES6 builtin functions and syntax in favour of old or depracated syntaxes. Please let's focus first only on htmljs before we continue to html-tools package.

@StorytellerCZ StorytellerCZ changed the base branch from master to release-3.0 August 3, 2022 06:45
packages/html-tools/package.js Outdated Show resolved Hide resolved
@jankapunkt
Copy link
Collaborator

We are getting closer :-)

@guncebektas
Copy link
Author

Are we ok with htmljs @jankapunkt

@StorytellerCZ
Copy link
Collaborator

Once @jankapunkt approves, I will merge this.

@guncebektas
Copy link
Author

Is there a prefered package for the next pr?

@jankapunkt
Copy link
Collaborator

hey @guncebektas @StorytellerCZ this is quite a bit to review (which is why in the future there should be only one package per PR) I try to get it done asap the next days!

Copy link
Collaborator

@jankapunkt jankapunkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally approved, waiting for the comment on the package version bumps, otherwise this is a great step in the right direction

Package.describe({
name: 'html-tools',
summary: "Standards-compliant HTML tools",
version: '1.1.3',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StorytellerCZ @denihs should PRs to 3.0 include version bumps? I'd rather keep them and at release bump them to whatever is suitable but that's not my call.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @Grubba27

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think PRs probably shouldn't include individual version bumps, it feels like this way lie merge conflicts & conflicting version number schemes for sure :D

Copy link

@DanielDornhardt DanielDornhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.

I've reviewed this, unfortunately it's hard to review because of the amount of stylistic changes. Which is unfortunate, because this has been recommended in the past.

We added some feedback, but basically I think we're gonna start over with the refactoring and potentially pick out the good parts from this PR as inspiration.

Thank you @guncebektas for your work! If you wanna continue to help out feel free to reach out!

// Note that some entities don't have a final semicolon! These are used to
// make `&lt` (for example) with no semicolon a parse error but `&abcde` not.

var ENTITIES = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit / Question:

These ENTITIES seem to have been pasted in from http://www.whatwg.org/specs/web-apps/current-work/multipage/entities.json a long time ago.

Converting the quotes to another format would make it difficult to update this in the future by just pasting the most recent JSON from https://www.whatwg.org and checking the diff on what has changed.

So I'd recommend NOT doing this for this file, at least not for the object contents.

Also: While checking this I noticed that there have been lots of updates & changes to the entities.json file of the Whatwg but I don't know what all of this does right now in the greater Blaze context?

-> Nit: Code Quality: File could use a file level comment about what it's used for, then we could reason about this more easily. But that's not for you @guncebektas just a general observation :D

@@ -1,56 +1,55 @@
/* eslint-env meteor */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question @jankapunkt @guncebektas : Does this have to be included in different files? Isn't there a default .eslintrc or something for blaze which should contain this?

import { HTMLTools } from 'meteor/html-tools';

var Scanner = HTMLTools.Scanner;
var getCharacterReference = HTMLTools.Parse.getCharacterReference;
const { Scanner } = HTMLTools;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think the old way was more straightforward to read - const is fine but in general? Do we need this everywhere?

Package.describe({
name: 'html-tools',
summary: "Standards-compliant HTML tools",
version: '1.1.3',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think PRs probably shouldn't include individual version bumps, it feels like this way lie merge conflicts & conflicting version number schemes for sure :D

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 OK... I think this is a blocker - re-sorting / rearranging all the functions makes this one really hard to review... why has this been rearranged @guncebektas ?

}

_assign(TemplateTag.prototype, {
Object.assign(TemplateTag.prototype, {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of like this one, if it does the same thing indeed :D

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// consumes characters and emits nothing (e.g. in the case of template
// comments), we may go from not-at-EOF to at-EOF and return `null`,
// while otherwise we always find some token to return.
export function getHTMLToken (scanner, dataMode) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again... moving things around makes it difficult to judge the changes.

var getDoctype = HTMLTools.Parse.getDoctype;
var getHTMLToken = HTMLTools.Parse.getHTMLToken;
const { Scanner } = HTMLTools;
const { getComment } = HTMLTools.Parse;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above :)

packages/htmljs/html.js Show resolved Hide resolved

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, hard to parse changes

@StorytellerCZ
Copy link
Collaborator

@guncebektas can you please take a look on @DanielDornhardt comments?

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

5 participants