Registry / testing / eslint-plugin-eslint-env

eslint-plugin-eslint-env

JSON →
library0.6.0jsnpmunverified

An ESLint plugin that provides a processor to lint files using eslint-env comments in an ESLint flat config. Version 0.6.0 requires ESLint >=8.21 and ships TypeScript types. It allows developers to specify environments per file via /* eslint-env */ comments, including plugin-defined environments like cypress/globals or react-native/react-native. Key differentiator: integrates eslint-env comment functionality into the flat config system, which is not natively supported by ESLint's flat config.

npm install eslint-plugin-eslint-env
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-ESLI
E
eslint-plugin-eslint-env
testingjavascriptv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EslintEnvProcessor
✓ import { EslintEnvProcessor } from 'eslint-plugin-eslint-env';
✗ import EslintEnvProcessor from 'eslint-plugin-eslint-env';
Default export is not available; must use a named import. ESM-only package.
require/CommonJS
✓ const { EslintEnvProcessor } = require('eslint-plugin-eslint-env');
✗ const EslintEnvProcessor = require('eslint-plugin-eslint-env');
CommonJS destructuring is needed; the package does not export a function directly.
Plugin object use (legacy config)
✓ import plugin from 'eslint-plugin-eslint-env';
✗ import { plugin } from 'eslint-plugin-eslint-env';
For legacy eslintrc configs, import default as a plugin object. For flat config, use the named EslintEnvProcessor.

Shows how to use the EslintEnvProcessor in an ESLint flat config file (eslint.config.js with ESM imports).

import { EslintEnvProcessor } from 'eslint-plugin-eslint-env'; export default [ { files: ['**/*.js'], processor: new EslintEnvProcessor(), }, ];
Debug
Known issues
breakingFlat config required: This plugin only works with ESLint's flat config system (eslint.config.js). Do not use with legacy .eslintrc files.
fix
Switch to flat config by using eslint.config.js and ensure ESLint version >=8.21.
affects: >=0.0.0
gotchaThe EslintEnvProcessor must be instantiated (new EslintEnvProcessor()) and passed as the processor option; using the string 'EslintEnvProcessor' will not work.
fix
Use processor: new EslintEnvProcessor() in your config object.
affects: >=0.0.0
gotchaPlugin-defined environments require passing plugins into the processor constructor's options object. Simply adding plugins to the config is not enough.
fix
Pass plugins to the processor: new EslintEnvProcessor({ plugins: { 'cypress': eslintPluginCypress } }).
affects: >=0.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'eslint-plugin-eslint-env' declared in 'eslint.config.js': Cannot find module 'eslint-plugin-eslint-env'
The package is not installed or is installed as a dev dependency but not resolved correctly.
fix
Run npm install -D eslint-plugin-eslint-env and ensure node_modules is present.
TypeError: (intermediate value) is not a constructor
Using EslintEnvProcessor without the 'new' keyword or wrong import (e.g., default import instead of named).
fix
Ensure you use import { EslintEnvProcessor } from 'eslint-plugin-eslint-env' and instantiate: new EslintEnvProcessor().
Error: Configuration for rule 'undefined' is not found
Missing or incorrectly structured flat config; processor not applied correctly.
fix
Verify your eslint.config.js exports an array with an object containing 'files' and 'processor' properties.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
@eslint/eslintrcoptionalpeer dependency required for ESLint configuration handling
@types/eslintoptionalpeer dependency required for TypeScript type definitions
eslintrequiredpeer dependency: required version >=8.21
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-eslint-env — npm install eslint-plugin-eslint-env · libregistry