Registry / testing / eslint-config-vitest-globals

eslint-config-vitest-globals

JSON →
library2.0.2jsnpmunverified

ESLint configuration package that defines globals for Vitest test files, eliminating false no-undef errors for Vitest globals like vi, describe, it, expect, beforeEach, etc. Version 2.0.2 is current, with support for both ESLint v9 flat config and ESLint v8 traditional config. Ships TypeScript types. Differentiators: tiny focused package, no extra rules, just globals; explicit flat config path import for ESLint v9; actively maintained with recent updates.

npm install eslint-config-vitest-globals
INSTALL
IMPORT
SIG · ESLINT-CONFIG-VITE
E
eslint-config-vitest-globals
testingjavascriptv2.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

vitestGlobals
import vitestGlobals from 'eslint-config-vitest-globals/flat'
import vitestGlobals from 'eslint-config-vitest-globals'
For eslint flat config (v9+), you must import from the 'flat' subpath. The default export is the traditional legacy config.
default import (traditional)
"extends": ["eslint-config-vitest-globals"]
"extends": ["vitest-globals"]
For ESLint v8 legacy config, extend the package by its full name or use 'eslint-config-vitest-globals'. Shorthand names may not resolve.
type import (flat config)
import type VitestGlobals from 'eslint-config-vitest-globals/flat'
TypeScript types are provided; you can import the type if needed.
flat config with function call
vitestGlobals()
vitestGlobals
The flat config export is a function that must be called; it returns the config object.

Shows how to set up eslint-config-vitest-globals with ESLint v9 flat config, calling vitestGlobals() to register Vitest globals.

// Install: npm install --dev eslint eslint-config-vitest-globals // eslint.config.js (ESLint v9+) import vitestGlobals from 'eslint-config-vitest-globals/flat'; export default [ vitestGlobals(), { files: ['**/*.test.js', '**/*.spec.js'], rules: { // your custom rules for test files } }, // other configs ];
Debug
Known issues
breakingv2.0.0 changed export structure: flat config must be imported from subpath 'eslint-config-vitest-globals/flat' instead of default import.
fix
Update import path from 'eslint-config-vitest-globals' to 'eslint-config-vitest-globals/flat' for flat config usage.
affects: >=2.0.0
gotchaFlat config export is a function, not a plain object; must be invoked as vitestGlobals().
fix
Use vitestGlobals() instead of vitestGlobals.
affects: >=2.0.0
deprecatedESLint v8 traditional config (.eslintrc) is deprecated; future updates may only support flat config.
fix
Migrate to ESLint v9 flat config using 'eslint-config-vitest-globals/flat'.
affects: >=2.0.0
gotchaPackage only provides globals, not rules. You still need to configure 'no-undef' rule correctly; globals will suppress false positives.
fix
Ensure 'no-undef' is enabled in your ESLint config. The globals set by this package will be recognized.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'eslint-config-vitest-globals/flat'
Using flat config import but package version is <2.0.0 (old version) or import path is wrong.
fix
Update package to v2.0.0+ and ensure import path is 'eslint-config-vitest-globals/flat'.
ESLint: TypeError: vitestGlobals is not a function
Importing default from 'eslint-config-vitest-globals/flat' but not calling it (using as object instead of function).
fix
Use vitestGlobals() in your config array.
Parsing error: The keyword 'import' is reserved
Using 'import' in a CommonJS file without ESM support.
fix
Change file extension to .mjs or set "type": "module" in package.json, or use require() if available.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
eslintrequiredpeer dependency for ESLint configuration
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-config-vitest-globals — npm install eslint-config-vitest-globals · libregistry