noProcessEnv
Este conteúdo não está disponível em sua língua ainda.
Diagnostic Category: lint/nursery/noProcessEnv
Since: v1.9.1
Sources:
- Same as:
n/no-process-env
Disallow the use of process.env
.
The process.env
object in Node.js stores configuration settings. Using it directly throughout a project can cause problems:
- It’s harder to maintain
- It can lead to conflicts in team development
- It complicates deployment across multiple servers
A better practice is to keep all settings in one configuration file and reference it throughout the project.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:1:5 lint/nursery/noProcessEnv ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Don’t use process.env.
> 1 │ if (process.env.NODE_ENV === ‘development’) {
│ ^^^^^^^^^^^
2 │ // …
3 │ }
ℹ Use a centralized configuration file instead for better maintainability and deployment consistency.