Skip to content

Conversation

@matheusmorett2
Copy link

Closes #197

Add codemod recipe process-assert-to-assert to handle deprecation DEP0100.

Before

const { assert: nodeAssert, env } = require("process");
nodeAssert(condition, "Assertion valid");

After

const assert = require("node:assert");
const { env } = require("process");
assert(condition, "Assertion valid");

Fix: remove-binding.ts

handle scenario where have alias in require

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

I didn't see any test for that kind cases

import process from "node:process"

But good first pr

Copy link
Member

@brunocroh brunocroh left a comment

Choose a reason for hiding this comment

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

Awesome first contribution 🎉, Thank you @matheusmorett2 !

Just small fixes needed

Copy link
Member

@brunocroh brunocroh left a comment

Choose a reason for hiding this comment

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

Please fix the conflict in the remove-binding file

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

For require call not in cjs context the transformed code may be wrong.

For example this before

import { createRequire} from 'node:module';
const require = createRequire(import.meta.dirname)

process.assert(true);

Broken after with the current implementation

const assert = require('node:assert');
import { createRequire} from 'node:module';
const require = createRequire(import.meta.dirname)

assert(true);

In this case I expect that require is undefined.

Solutions:

  1. Try to found a logic that handle that.
  2. Add it at inline comment so we know for the future

@JakobJingleheimer JakobJingleheimer added the awaiting author Reviewer has requested something from the author label Sep 23, 2025
@AugustinMauroy
Copy link
Member

hey @matheusmorett2 any news on this pr ?

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

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

I think this could use some refactoring. There's a lot of nesting, among other things.

Can you break it up, and look at the other mods for inspiration?

@JakobJingleheimer JakobJingleheimer added the dep:v23 Migration handles deprecation introduced in node v23 label Oct 16, 2025
@AugustinMauroy
Copy link
Member

bump @matheusmorett2

@AugustinMauroy AugustinMauroy added awaiting reviewer Author has responded and needs action from the reviewer and removed awaiting author Reviewer has requested something from the author labels Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewer Author has responded and needs action from the reviewer dep:v23 Migration handles deprecation introduced in node v23

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: handle DEP0100 by replacing process.assert() with the assert module

5 participants