3 ms·
You can create a class or something that reads it in at application startup and throws up if something you expect isn't there. You can't really enforce a rule t
by lghh 3y ago
You can create a class or something that reads it in at application startup and throws up if something you expect isn't there. You can't really enforce a rule to not access `process.env` directly, but it at leasts gives you types to access the env should you choose to use the wrapper.
- evilduck 3y agoI have utilized this to decent effect: https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md https://github.com/eslint-community/eslint-plugin-n/blob/mas... and then just had agreement/dictator state that the environment loader module was the only place in code that was allowed to disable that rule.