Skip to content

chris-susantooo/eslint-plugin-no-destructure-process-env

Repository files navigation

eslint-plugin-no-destructure-process-env

Plugin to disallow destructuring from process.env. process.env.* could be statically replaced at build time, such as in Next.js or Vite.js projects, which means process.env is not a standard JavaScript object. In that case, it is equivalent to trying to destructuring from undefined.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-no-destructure-process-env:

npm install eslint-plugin-no-destructure-process-env --save-dev

Usage

Add no-destructure-process-env to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["no-destructure-process-env"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "no-destructure-process-env/no-destructure-process-env": 2
  }
}

Supported Rules

  • Fill in provided rules here

About

Plugin to disallow destructuring from process.env

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published