You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's common for bundlers to inline process.env.NODE_ENV and such, so that minifiers can do their job and eliminate dead code. Currently n/no-process-env takes issue with every use of process.env.NODE_ENV and I have to disable it manually. I don't want to disable it completely as I still want to encourage configuration validation. I can't import nodeEnv from ./config.js or something because some (all?) minifiers don't dig that far and will not eliminate any code wrapped in if (nodeEnv === "production") ....
What do you think is the correct solution?
Options:
Add allowNodeEnv, defaulting to false. Probably a bit simpler to implement and covers the majority of cases.
I personally don't have a long list, just NODE_ENV 😄 So would be happy with allowNodeEnv. I mention other variables because who knows what others might want to allow.
eslint-plugin-n version
17.7.0
What problem do you want to solve?
It's common for bundlers to inline
process.env.NODE_ENV
and such, so that minifiers can do their job and eliminate dead code. Currentlyn/no-process-env
takes issue with every use ofprocess.env.NODE_ENV
and I have to disable it manually. I don't want to disable it completely as I still want to encourage configuration validation. I can't importnodeEnv
from./config.js
or something because some (all?) minifiers don't dig that far and will not eliminate any code wrapped inif (nodeEnv === "production") ...
.What do you think is the correct solution?
Options:
allowNodeEnv
, defaulting tofalse
. Probably a bit simpler to implement and covers the majority of cases.allowlist
, defaulting to[]
.NODE_ENV
is the behemoth, but there's a long tail of other variables.Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: