Menu
restrict-use-of-process-env#
For the centralized manage the env.
Rule Options#
1{
2 rules: {
3 "sc-js/restrict-use-of-process-env": [<enabled>],
4 },
5}
Example of invalid ❌ code:
1const env = process.env;
1const { env: variableName } = process;
Example of valid ⭕ code:
1// const file
2/* eslint-disable sc-js/restrict-use-of-process-env */
3export const Environment = {
4 NODE_ENV: process.env.NODE_ENV || "development",
5 PORT: process.env.PORT || 3000,
6}
7
8// side to use
9import { Environment } from "../const";
10
11const { NODE_ENV, PORT } = Environment;