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

Adds support for ESM loaders to the SDKs #6278

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented May 6, 2024

What's the problem this PR addresses?

ESM loaders aren't supported by the sdks because we only require().setup() but we don't register() the ESM loader hook.

Fixes #6219

How did you fix it?

  • Add support for ESM loaders to the SDK.

  • Check whether the findPnpApi function could be found in the module builtin. If not, tries to setup the environment accordingly. This is because in the case of the SDK, the subprocesses have been created without the --require .pnp.loader.mjs flag, so the PnP runtime won't be setup.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis changed the base branch from master to mael/eslint-flat-config May 6, 2024 16:47
@macalinao
Copy link

What's blocking this from being merged?

@n0099
Copy link
Contributor

n0099 commented Jun 5, 2024

What's blocking this from being merged?

#6219 (comment)

For those can't wait just resolve package @yarnpkg/sdks to the branch of this pr: https://stackoverflow.com/questions/43411864/how-to-install-package-from-github-repo-in-yarn/67779901#67779901

yarn dlx -p '@yarnpkg/sdks@https://github.com/yarnpkg/berry#head=mael/eslint-flat-config-sdk&workspace=@yarnpkg/sdks' @yarnpkg/sdks vscode

wait for it to completely git clone this LARGE repo.

not working, ignore

Or manually git clone --filter+git sparse-checkout but also for /*

git clone https://github.com/yarnpkg/berry --branch mael/eslint-flat-config-sdk --depth 1 --filter=blob:none --sparse berry
cd berry
git sparse-checkout add packages/yarnpkg-{sdks,core}
cd packages/yarnpkg-sdks
touch yarn.lock
yarn install

Or download online archive packages/yarnpkg-sdks

then resolve it with file: protocol

yarn dlx -p '@yarnpkg/sdks@./berry/packages/yarnpkg-sdks' @yarnpkg/sdks vscode

instead.

  1. let vscode extension dbaeumer.vscode-eslint>=3.0.5 run with Node >v20.6.0, v18.19.0 by setting eslint.runtime in settings.json: https://stackoverflow.com/questions/69179099/enforcing-node-version-on-eslint-server
node --version
  "eslint.runtime": "node",

n0099 added a commit to n0099/open-tbm that referenced this pull request Jun 5, 2024
n0099 added a commit to n0099/open-tbm that referenced this pull request Jun 5, 2024
@arcanis arcanis merged commit 772056e into mael/eslint-flat-config Jun 6, 2024
21 of 26 checks passed
@arcanis arcanis deleted the mael/eslint-flat-config-sdk branch June 6, 2024 15:11
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

3 participants