Closed
Description
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. 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 tofalse
. Probably a bit simpler to implement and covers the majority of cases. - Add
allowlist
, defaulting to[]
.NODE_ENV
is the behemoth, but there's a long tail of other variables.
Participation
- I am willing to submit a pull request for this change.
Additional comments
No response