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

chore: remove dependency shelljs #83

Closed
wants to merge 1 commit into from
Closed

chore: remove dependency shelljs #83

wants to merge 1 commit into from

Conversation

fasttime
Copy link
Member

This PR removes the dependency shelljs and replaces its usages with native Node.js API calls in unit tests.

ShellJS in versions prior to 0.8.5 has a high rated vulnerability: https://nvd.nist.gov/vuln/detail/CVE-2022-0144.

Most Shelljs functions are synchronous, but for Node.js I/O operations it is recommended to use asynchronous functions, so I decided to use fs/promises. We could also switch to the synchronous versions of those functions to stay in line with the usage in other parts of this repo.

@fasttime fasttime marked this pull request as ready for review February 23, 2024 05:49
after(() => {
sh.rm("-r", fixtureDir);
after(async () => {
await fsp.rm(path.join(fixtureDir, "../../.."), { recursive: true });
Copy link
Member Author

Choose a reason for hiding this comment

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

This should also remove "tmp" in the current directory, not just "tmp/eslint/fixtures/config-initializer".

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Would like @aladdin-add to review before merging.

@@ -8,11 +8,11 @@
// Requirements
//------------------------------------------------------------------------------

import fsp from "node:fs/promises";
Copy link
Member

Choose a reason for hiding this comment

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

We're rewriting it in another PR, and this file will be removed.

I can remove shelljs in that PR, thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good 👍🏻 It looks like shelljs isn't used at all in that branch, so you could simply remove the package.json dependency.

Copy link
Member

Choose a reason for hiding this comment

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

done in 4602713.

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

Successfully merging this pull request may close these issues.

3 participants