prefer-destructuring
conflicts with Webpack replacements of process.env
#14918
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
enhancement
This change enhances an existing feature of ESLint
rule
Relates to ESLint's core rules
triage
An ESLint team member will look at this issue soon
Projects
Webpack can replace Node-like
process.env.ENV_STUFF
with the actual environment variable provided at build time: https://webpack.js.org/plugins/environment-plugin/This process is pretty "dumb" as it's a simple search and replace of exactly
process.env.${variableName}
and nothing else. This means destructuring isn't possible withprocess.env
.More context found in: vercel/next.js#19420
What rule do you want to change?
prefer-destructuring
Does this change cause the rule to produce more or fewer warnings?
Fewer warnings
How will the change be implemented? (New option, new default behavior, etc.)?
New default I'd assume
Please provide some example code that this change will affect:
What does the rule currently do for this code?
It suggests fixing it to this, breaking webpack’s replacement.
What will the rule do after it's changed?
Ignore
process.env
destructuring. It'd be great to even suggest the opposite (Avoid destructuring ofprocess.env
), but maybe that's asking too much.The text was updated successfully, but these errors were encountered: