[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Implement polyfills option in CLI #86

Closed

Conversation

NoelDeMartin
Copy link

This should make it possible to use the functionality introduced in #50 with the CLI.

I'm aware that this implementation is a bit naive in the parsing and such, but I thought it would be overkill to add a new dependency to convert this simple script into a "proper CLI" (something like minimist for example).

@NoelDeMartin NoelDeMartin force-pushed the cli-polyfills branch 2 times, most recently from 6e1de62 to 8d0affa Compare November 30, 2023 12:21
NoelDeMartin added a commit to NoelDeMartin/moodleapp that referenced this pull request Nov 30, 2023
The check-es-compat patch can be removed if the following PR is resolved: robatwilliams/es-compat#86
NoelDeMartin added a commit to NoelDeMartin/moodleapp that referenced this pull request Nov 30, 2023
The check-es-compat patch can be removed if the following PR is resolved: robatwilliams/es-compat#86
@robatwilliams
Copy link
Owner

Hi, thanks for this. Just to say I've seen it and I will get round to taking a proper look.

Copy link
Owner

Choose a reason for hiding this comment

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

There are prettier formatting issues in this file - see CI

Copy link
Owner

Choose a reason for hiding this comment

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

I've updated ESLint recently and it's now picked up some new issues. They seem reasonably, at a first glance.

packages/check-es-compat/bin/cli.mjs Show resolved Hide resolved
@@ -46,3 +47,41 @@ async function execute(files) {

return { hasErrors: results.some((result) => result.errorCount > 0) };
}

function parseArguments(args) {
Copy link
Owner

Choose a reason for hiding this comment

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

I'm hesitant to put this code in - there are a few different branches and checks so it's not straightforward to have confidence whether it covers everything it needs to.

I think it should use minimist.

Also there are likely to be many polyfills so perhaps it would be better instead to take a --polyfills-file that is a path to a file with one polyfill on each line.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, ideally it should use minimist, but I decided not to do it because that would likely be a lot more work. And I'm not sure you'd like the idea to add new dependencies, etc.

In any case, I implemented this for our project and I thought I'd contribute it rather than just opening an issue. If you think this is not the right direction for the library, I think it's better if you close this PR and work on this yourself (or I can open a normal issue to keep track of the missing feature). But I don't think I'll take it further, because this simple approach is enough for our use-case and we're using the patch with patch-package.

Copy link
Owner

Choose a reason for hiding this comment

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

Fair, thanks. I've created issue #93 for it, but am not planning to work on it.

return { files, polyfills };
}

function splitPolyfillsArgument(polyfills) {
Copy link
Owner

Choose a reason for hiding this comment

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

This is very specific, and in future (in #90 for ES2023 actually) would need updating if we add similar polyfills.

Another reason to use a file for passing in the polyfills list?

jerico-castillo pushed a commit to jerico-castillo/my-moodleapp that referenced this pull request Apr 2, 2024
The check-es-compat patch can be removed if the following PR is resolved: robatwilliams/es-compat#86
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.

2 participants