Registry / testing / eslint-plugin-valtio

eslint-plugin-valtio

JSON →
library0.8.0jsnpmunverified

ESLint plugin for Valtio that helps catch common mistakes when using proxy-based state management. Current version 0.8.0 supports both ESLint v8 (legacy config) and v9 (flat config). Key differentiators: specifically targets Valtio anti-patterns like stale snapshots in callbacks, mutating snapshots, using proxies in render phase, incorrect computed dependency order, and `this` usage in snapshots. Maintained by pmndrs. Release cadence: irregular updates with breaking changes in minor versions.

npm install eslint-plugin-valtio
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-VALT
E
eslint-plugin-valtio
testingjavascriptv0.8.0
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.

plugin default
const valtio = require('eslint-plugin-valtio')
import valtio from 'eslint-plugin-valtio'
This plugin is CommonJS-only. ESM import will fail.
flat/recommended config (eslint v9)
valtio.configs['flat/recommended']
valtio.configs.recommended
ESLint v9 uses flat config; the config key is 'flat/recommended' not 'recommended'.
recommended config (eslint v8)
plugin:valtio/recommended
valtio/recommended
Legacy config uses extends string with 'plugin:' prefix.

Setup for ESLint v9 flat config and v8 legacy config with recommended rules.

// Install: npm install --save-dev eslint eslint-plugin-valtio // For ESLint v9 (flat config) - eslint.config.js const valtio = require('eslint-plugin-valtio'); module.exports = [ valtio.configs['flat/recommended'], { rules: { 'valtio/state-snapshot-rule': 'warn', 'valtio/avoid-this-in-proxy': 'error', }, }, ]; // For ESLint v8 - .eslintrc.json // { "extends": ["plugin:valtio/recommended"], "rules": { "valtio/state-snapshot-rule": "warn" } }
Debug
Known issues
breakingv0.8.0: recommended config split into 'flat/recommended' (ESLint v9) and plugin:valtio/recommended (ESLint v8). Existing flat configs using valtio.configs['recommended'] will break.
fix
Use valtio.configs['flat/recommended'] with ESLint v9, or plugin:valtio/recommended with ESLint v8.
affects: =0.8.0
breakingv0.7.0: Added ESLint v9 flat config support with breaking changes in API exposure. Older configs may need migration.
fix
If using ESLint v9, use flat config pattern; for v8, stay on v0.6.x or use legacy extends string.
affects: >=0.7.0
gotchaPlugin is CommonJS-only; attempting ESM import will fail with SyntaxError or import not found.
fix
Use require('eslint-plugin-valtio') instead of import.
affects: all
Errors
Common errors & fixes
Cannot find module 'eslint-plugin-valtio' or 'valtio' module not found in extends
Missing plugin installation or incorrect config path in .eslintrc.
fix
Run `npm install --save-dev eslint-plugin-valtio`. Ensure extends uses 'plugin:valtio/recommended'.
ESLint: Invalid config: 'valtio/recommended' is not valid.
Using the config string without 'plugin:' prefix in legacy config.
fix
Change to 'plugin:valtio/recommended' in extends array.
TypeError: Cannot read properties of undefined (reading 'recommended')
Using valtio.configs.recommended instead of valtio.configs['flat/recommended'] in flat config (v0.8.0+).
fix
Use valtio.configs['flat/recommended'] for ESLint v9 flat config.
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-valtio — npm install eslint-plugin-valtio · libregistry