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

fix: pass yarn PnP experimental loader to worker if it exists #103

Merged
merged 4 commits into from Aug 10, 2022
Merged

fix: pass yarn PnP experimental loader to worker if it exists #103

merged 4 commits into from Aug 10, 2022

Conversation

noahnu
Copy link
Contributor

@noahnu noahnu commented Aug 10, 2022

This does what @lachlanhunt calls out in #98 (comment).

The reason the existing test doesn't cover this is because the existing test imports a worker.js file rather than a worker.mjs file, while the eslint resolver references a worker.mjs file.

Also digging into the tests added in the previous PR, we need a test case where -r pnp is not added via NODE_OPTIONS, but rather added via a "proxy" script that calls require('pnpapi').setup() -- this emulates the yarn eslint sdk patch from https://github.com/yarnpkg/berry/tree/master/packages/yarnpkg-sdks.

References

@changeset-bot
Copy link

changeset-bot bot commented Aug 10, 2022

🦋 Changeset detected

Latest commit: 6b48492

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
synckit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 10, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 10, 2022

📊 Package size report   No changes

File Before After
Total (Includes all files) 42.9 kB 42.9 kB
Tarball size 11.8 kB 11.8 kB
Unchanged files
File Size
lib/index.cjs 9.0 kB
lib/index.d.ts 1.2 kB
lib/index.js 10.3 kB
lib/index.js.map 8.6 kB
lib/types.d.ts 936 B
lib/types.js 44 B
lib/types.js.map 102 B
LICENSE 1.1 kB
package.json 4.0 kB
README.md 7.6 kB

🤖 This report was automatically generated by pkg-size-action

@JounQin
Copy link
Member

JounQin commented Aug 10, 2022

@noahnu Can you link some references?

@codecov
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Merging #103 (6b48492) into main (59af559) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #103   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          121       126    +5     
  Branches        55        55           
=========================================
+ Hits           121       126    +5     
Impacted Files Coverage Δ
src/index.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@noahnu noahnu marked this pull request as ready for review August 10, 2022 15:20
@noahnu
Copy link
Contributor Author

noahnu commented Aug 10, 2022

@noahnu Can you link some references?

Updated PR description.

@JounQin
Copy link
Member

JounQin commented Aug 10, 2022

The reason the existing test doesn't cover this is because the existing test imports a worker.js file rather than a worker.mjs file, while the eslint resolver references a worker.mjs file.

type: 'module' is enabled in the yarn-pnp test case, so worker.js is the same as worker.mjs.

How can I generate a `.pnp.loader.mjs` file?

pnpEnableEsmLoader: true

@JounQin
Copy link
Member

JounQin commented Aug 10, 2022

Also digging into the tests added in the previous PR, we need a test case where -r pnp is not added via NODE_OPTIONS, but rather added via a "proxy" script that calls require('pnpapi').setup() -- this emulates the yarn eslint sdk patch from yarnpkg/berry@master/packages/yarnpkg-sdks.

That would be appreciated! But it could be another PR for test cases, it is not related to this PR, right?

@noahnu
Copy link
Contributor Author

noahnu commented Aug 10, 2022

It can definitely be added in a follow up. I'll QA this PR right now

@noahnu
Copy link
Contributor Author

noahnu commented Aug 10, 2022

Yep, this PR seems to do the trick. ✅

@JounQin JounQin changed the title fix: pass pnp experimental loader to worker if it exists fix: pass yarn PnP experimental loader to worker if it exists Aug 10, 2022
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

2 participants