Review an Environment Name Before Renaming It
Admin ·
Renaming a variable can affect several services that read the same file. Check the current names and any proposed spelling collisions before updating their references.
Environment Variable Naming Linter
Find the REDIS_HOST suggestion collision
Choose Load names sample with UPPER_SNAKE_CASE and leave Required prefix blank. Lint variable names. The workspace checks eight names and reports eight findings.
Both redis-host on line 3 and redisHost on line 7 get the suggestion REDIS_HOST. The collision is recorded on line 7 and points back to line 3. Download env-name-findings.json and compare suggestedKey and firstLine for that finding.
| Source line | Name | What to review |
|---|---|---|
| 3 | redis-host | Identifier and style |
| 4 | 1INVALID_KEY | Leading digit and style |
| 5 | PATH | Common runtime or shell name |
| 6 | API_URL | Duplicate of line 2 |
| 7 | redisHost | Style and suggested name collision |
Open the environment names linter and load the names sampleNode.js dotenv variable name syntax
Check a clean list against the project prefix
Choose Load clean examples. The three names follow UPPER_SNAKE_CASE and begin with APP_. Enter APP_ as Required prefix and run the lint check. The result is 3 checked and 0 findings.
Change the prefix to WEB_ and run it again. The report flags all three lines. Separately, changing the casing convention affects the style finding regardless of the prefix.
Check the loader and the name’s references
Choose kebab-case when reviewing a naming style that uses hyphens. A matching kebab-case name still gets a portability finding for its hyphen. Node.js documents letters, digits and underscores for dotenv names, with no leading digit.
Check build configuration, scripts and application lookups before replacing a key. The report includes names and locations. Assignments inside a multiline quoted value stay part of the value and do not appear as candidate keys.
Common questions
Does a PATH warning mean it must be removed?
PATH is a common shell key. Review whether the project intends to supply that value before making a change.
Does linting rename repeated keys automatically?
The report proposes a spelling and identifies collisions or duplicate lines. Review their meanings and existing references before editing the key.