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(eslint-plugin): cache access to NODE_ENV #2693

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tasty-stingrays-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/eslint-plugin": patch
---

Cache access to `NODE_ENV`
4 changes: 3 additions & 1 deletion packages/eslint-plugin/src/rules/no-export-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const DEFAULT_CONFIG = {
eslintScopeManager: true,
};

const NODE_ENV = process.env.NODE_ENV;

/**
* Returns whether there are any named exports.
* @param {NamedExports?} namedExports
Expand Down Expand Up @@ -93,7 +95,7 @@ const resolveFrom =
/** @type {() => (fromDir: string, moduleId: string) => string} */
(
() => {
if (process.env.NODE_ENV === "test") {
if (NODE_ENV === "test") {
return (_, moduleId) => moduleId;
}

Expand Down