GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: show type on invalid semver error by tjenkinson · Pull Request #559 · npm/node-semver

Conversation

@tjenkinson

@tjenkinson tjenkinson commented May 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Based on this comment from @wraithgar

If we want to revert this, it needs to be done in a way that also sets up some sort of linting or other testing so that "does not use x internals from node" is part of the contract, which it wasn't before.

This configures some eslint plugins to prevent importing node builtins or dev dependencies.

It also removes the dependency on node util and updates the error message slightly.

References

Fixes #554

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jonrouleau reacted with thumbs up emoji batur reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction
tjenkinson
tjenkinson commented May 5, 2023
View reviewed changes
Comment thread .gitignore Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tjenkinson
tjenkinson force-pushed the ensure-no-externals branch from 24e6cf2 to e18d94d Compare May 5, 2023 13:47
tjenkinson added 2 commits May 5, 2023 14:47
@tjenkinson
chore: add test step that makes sure no external/builtin dependencies
7328e66
@tjenkinson
fix: remove dependency on node builtin
d0a105e
@tjenkinson
tjenkinson force-pushed the ensure-no-externals branch from e18d94d to d0a105e Compare May 5, 2023 13:48
@tjenkinson
tjenkinson marked this pull request as ready for review May 5, 2023 13:48
@tjenkinson
tjenkinson requested a review from a team as a code owner May 5, 2023 13:48
@tjenkinson tjenkinson mentioned this pull request May 5, 2023
[BUG] Webpack builds are failing as new release 7.5.0 requiers node.js util #554
Closed
1 task done
@wraithgar

wraithgar commented May 5, 2023

Copy link
Copy Markdown
Contributor

Is there really no eslint rule for this? I find that amazing if so.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tjenkinson

tjenkinson commented May 5, 2023

Copy link
Copy Markdown
Contributor Author

Hmm actually didn't think about that. https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md looks like it may work will give it a go

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wraithgar
wraithgar reviewed May 5, 2023
View reviewed changes
Comment thread classes/semver.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@wraithgar

wraithgar commented May 5, 2023

Copy link
Copy Markdown
Contributor

Is there something special about rollup or is it a coincidence that it also only supports the same subset of node internals that webpack does?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wraithgar

wraithgar commented May 5, 2023

Copy link
Copy Markdown
Contributor

https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-nodejs-modules.md Is probably our rule. You'll need to override it in tests and map.js.

eslint rules can be extended by adding a .eslintrc.local.js file.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tjenkinson
tjenkinson commented May 5, 2023
View reviewed changes
Comment thread .eslintrc.local.js Outdated
module.exports = {
plugins: ['import'],
rules: {
'import/no-extraneous-dependencies': [

@tjenkinson tjenkinson May 5, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

this may not be required. checking

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wraithgar wraithgar May 5, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It's already in the base ruleset https://github.com/npm/eslint-config/blob/9e87b58d9e049004c802239cab1fabbca67caf74/lib/index.js#L213

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tjenkinson tjenkinson May 5, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ah yep. I think this config is useful though? The default would allow importing from devDependencies

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wraithgar wraithgar May 5, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The file is already imported as a plugin, so the extra dependency isn't needed. I think a single new rule is all we need here with an allow of ./test and map.js.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wraithgar wraithgar May 5, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

cf https://github.com/npm/cli/blob/3d5bbcc86c484ef0b6c04ee0236c1072d36915d6/.eslintrc.local.json#L3 or https://github.com/npm/cacache/blob/de12400af2ab452f1e75a15edaf7ea51b294667b/.eslintrc.local.js#L4

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wraithgar wraithgar May 5, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Then this needs to be addressed in template-oss, that's not a rule that we'd want to only apply to a single one of our over 80 repos.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tjenkinson tjenkinson May 6, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Opened npm/template-oss#316

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tjenkinson tjenkinson May 12, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@wraithgar so given this doesn't follow the standard structure npm/eslint-config#67 doesn't have any effect here, so is the custom config in this PR good to go?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wraithgar wraithgar May 12, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah we'll need a custom config but this one looks to be a bit different in approach than the one we landed on in eslint-config. We should pattern it after the one there but instead of lib and bin it should be bin, classes, functions, internal, and ranges (and now we begin to see why we standardized on lib).

The way this PR currently does it is by completely bypassing the no-extraneous-dependencies rule for the test files, which is a regression.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tjenkinson tjenkinson May 12, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yep. done!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tjenkinson
tjenkinson force-pushed the ensure-no-externals branch 5 times, most recently from b185f4d to 199419d Compare May 5, 2023 14:23
tjenkinson added 2 commits May 5, 2023 15:38
@tjenkinson
chore: use eslint plugin for preventing externals/builtins
3cfdf1e
@tjenkinson
fix: tweak error message when input is wrong type
5019bc5
@tjenkinson
tjenkinson force-pushed the ensure-no-externals branch from 199419d to 5019bc5 Compare May 5, 2023 14:39
@tjenkinson

tjenkinson commented May 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Is there something special about rollup or is it a coincidence that it also only supports the same subset of node internals that webpack does?

By default rollup doesn't understand any node_module dependencies. There is a node-resolve plugin that adds that support for those to be found.

It also doesn't pollyfill any node builtins out of the box.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tjenkinson
fix: don't specify eslint plugin in config because already there from…
7acab34
… base config
@tjenkinson tjenkinson changed the title Check that no externals/builtins are used, and remove dependency on node util fix: check that no externals/builtins are used, and remove dependency on node util May 5, 2023
@tjenkinson tjenkinson changed the title fix: check that no externals/builtins are used, and remove dependency on node util fix: check no externals/builtins are used, and remove dependency on node util May 5, 2023
ljharb
ljharb reviewed May 5, 2023
View reviewed changes
Comment thread test/classes/semver.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tjenkinson
chore: undo unneeded formatting changes
6f3bfbf
ljharb
ljharb reviewed May 5, 2023
View reviewed changes

@ljharb ljharb left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

An alternative would be to use the "browser" field to specify an alternative for util.inspect outside of node, which could be typeof, but then node usage would still get the nice util.inspect experience.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tjenkinson

tjenkinson commented May 5, 2023

Copy link
Copy Markdown
Contributor Author

Yeh I'm not sure if the benefit of inspect is really worth it for this case though?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jul 16, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 Exhorder6/addons-linter#31
Closed
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 terrorizer1980/addons-linter#35
Closed
@Z-byte-prog Z-byte-prog mentioned this pull request Jul 17, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 Z-byte-prog/docs#1243
Closed
@safiaminnn safiaminnn mentioned this pull request Jul 21, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 safiaminnn/juice-shop#5
Open
@YoYBaBy YoYBaBy mentioned this pull request Jul 23, 2024
[Snyk] Upgrade semver from 7.3.2 to 7.6.2 YoYBaBy/nodejs.org#274
Open
@koishichito koishichito mentioned this pull request Jul 24, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 koishichito/juice-shop#5
Open
@KobayashiMasaomi KobayashiMasaomi mentioned this pull request Jul 25, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 KobayashiMasaomi/juice-shop#10
Open
@q1blue q1blue mentioned this pull request Jul 28, 2024
[Snyk] Upgrade semver from 5.7.2 to 7.6.2 https-quantumblockchainai-atlassian-net/botframework-sdk#1
Open
@otmaneEH otmaneEH mentioned this pull request Jul 30, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 otmaneEH/docs#4
Open
@annkornienko annkornienko mentioned this pull request Jul 30, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.2 Simpplr/serverless-plugin-include-dependencies#12
Closed
@Mhmonicox Mhmonicox mentioned this pull request Aug 7, 2024
[Snyk] Upgrade semver from 7.3.6 to 7.6.3 Mhmonicox/actions-setup-cmake#36
Open
@devcurt696 devcurt696 mentioned this pull request Aug 7, 2024
[Snyk] Upgrade semver from 7.0.0 to 7.6.3 devcurt696/resume-builder#81
Open
@fanibahar fanibahar mentioned this pull request Aug 7, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 fanibahar/juice-shop1#85
Open
@Ramyromel Ramyromel mentioned this pull request Aug 10, 2024
[Snyk] Upgrade semver from 6.3.1 to 7.6.3 Ramyromel/eslint-plugin-react#2
Merged
@KarthikSNYK KarthikSNYK mentioned this pull request Aug 10, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 KarthikSNYK/juice-shop#9
Open
@mikebessuille mikebessuille mentioned this pull request Aug 11, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 mikebessuille/juice-shop#9
Open
This was referenced Aug 17, 2024
[Snyk] Upgrade semver from 7.3.7 to 7.6.3 NOUIY/npm-groovy-lint#83
Closed
[Snyk] Upgrade semver from 7.3.8 to 7.6.3 NOUIY/security-wg#56
Closed
@rickybright rickybright mentioned this pull request Aug 29, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 rickybright/juice-shop#6
Open
@NickyMartinez NickyMartinez mentioned this pull request Aug 30, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 NickyMartinez/juice-shop#5
Open
@Mhmonicox Mhmonicox mentioned this pull request Sep 7, 2024
[Snyk] Upgrade: , , semver, typed-rest-client Mhmonicox/actions-setup-cmake#37
Open
@NOUIY NOUIY mentioned this pull request Sep 7, 2024
[Snyk] Upgrade: , , react, react-dom, semver, , , clsx, , , cross-fetch, file-loader, lunr, next, raw-loader, react-syntax-highlighter, url-loader NOUIY/layer0-docs#478
Open
@YoYBaBy YoYBaBy mentioned this pull request Sep 9, 2024
[Snyk] Upgrade semver from 7.3.2 to 7.6.3 YoYBaBy/nodejs.org#282
Open
@phoebeyusnyk phoebeyusnyk mentioned this pull request Sep 29, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 phoebeyusnyk/juice-shop#4
Open
@tahmid198 tahmid198 mentioned this pull request Sep 30, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 tahmid198/juice-shop#4
Open
@AeonArriving AeonArriving mentioned this pull request Sep 30, 2024
[Snyk] Upgrade semver from 7.3.8 to 7.6.3 AeonArriving/audit-ci#2
Open
@InfiniteLove2020 InfiniteLove2020 mentioned this pull request Oct 3, 2024
[Snyk] Upgrade semver from 7.3.2 to 7.6.3 InfiniteLove2020/nodejs.org#6
Open
@nerdy-tech-com-gitub nerdy-tech-com-gitub mentioned this pull request Oct 24, 2024
[Snyk] Upgrade semver from 6.3.1 to 7.6.3 nerdy-tech-com-gitub/toolkit#6
Open
@doperiddle doperiddle mentioned this pull request Nov 10, 2024
[Snyk] Upgrade semver from 7.3.2 to 7.6.3 doperiddle/paystring#6
Merged
@nickvadala-snyk nickvadala-snyk mentioned this pull request Nov 11, 2024
[Snyk] Upgrade semver from 7.3.5 to 7.6.3 nickvadala-snyk/juice-shop#4
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

3 more reviewers
@ljharb ljharb ljharb left review comments
@mbtools mbtools mbtools left review comments
@wraithgar wraithgar wraithgar approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@wraithgar wraithgar

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] Webpack builds are failing as new release 7.5.0 requiers node.js util

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tjenkinson @wraithgar @ljharb @mbtools
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.