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: add node: prefix and import instead of using globals #12641

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Sep 2, 2024

see denoland/deno#17248 (comment)

Specifically imports node:process instead of relying on the process global.

TODO:

  • add node: prefix to polka imports
  • add imports to polka instead of relying on globals
  • add eslint rule to explicitly import node globals

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Sep 2, 2024

🦋 Changeset detected

Latest commit: 0e37d0a

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

This PR includes changesets to release 8 packages
Name Type
@sveltejs/adapter-auto Patch
@sveltejs/adapter-netlify Patch
@sveltejs/adapter-node Patch
@sveltejs/adapter-static Patch
@sveltejs/adapter-vercel Patch
create-svelte Patch
@sveltejs/enhanced-img Patch
@sveltejs/kit 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

@benmccann
Copy link
Member

We've got an eslint rule to enforce node: prefix on imports: https://github.com/sveltejs/eslint-config/blob/c91e102547e2c05e05e6927c9a4b16314bdf2dbd/index.js#L60

I wonder if there's also one to ensure globals like that are imported. It could be worth requesting with eslint-plugin-n if it doesn't already exist

@benmccann
Copy link
Member

Here it is: https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/process.md

We could turn it on in the common eslint config

@eltigerchino
Copy link
Member Author

Ben has opened a PR with the node prefix changes for Polka lukeed/polka#212

@benmccann
Copy link
Member

I think we could merge this without the polka piece. Assuming the polka part is in a patch release then users can get it without any need for us to bump the version here. It'd be nice to do the eslint part though

@eltigerchino
Copy link
Member Author

eltigerchino commented Sep 4, 2024

Not sure if I made the right changes here in regards to the extent of the new eslint rule. Do we only want it for adapter-node and then generate a fix: changeset for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants