Skip to content

Commit

Permalink
fix(eslint-plugin): cache access to NODE_ENV (#2693)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Sep 21, 2023
1 parent b231d45 commit a442ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit a442ffd

Please sign in to comment.