{"id":19988,"library":"eslint-plugin-xstate","title":"eslint-plugin-xstate","description":"ESLint plugin providing lint rules for XState state machine definitions. Current stable version is 3.2.1 (Dec 2023). Actively maintained, regular releases. Key differentiators: supports both XState v4 and v5 via configuration; includes shareable recommended and all rule sets; catches common mistakes like infinite loops, invalid state/transition props, misplaced onDone, and more. Requires ESLint ^8.40.0.","status":"active","version":"3.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/rlaffers/eslint-plugin-xstate","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-xstate","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-xstate","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-xstate","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for ESLint plugin functionality","package":"eslint","optional":false}],"imports":[{"note":"ESLint plugin registration in config file; prefix 'eslint-plugin-' is omitted.","wrong":"// Wrong: { \"plugins\": [\"eslint-plugin-xstate\"] }","symbol":"plugin","correct":"// In .eslintrc: { \"plugins\": [\"xstate\"] }"},{"note":"Uses plugin:xstate/recommended; for XState v4 use plugin:xstate/recommended_v4.","wrong":"// Wrong: { \"extends\": \"plugin:xstate/recommended\" } (must be array)","symbol":"recommended config","correct":"// In .eslintrc: { \"extends\": [\"plugin:xstate/recommended\"] }"},{"note":"All rule names must be prefixed with 'xstate/'.","wrong":"// Wrong: { \"rules\": { \"spawn-usage\": \"error\" } }","symbol":"rules","correct":"// In .eslintrc: { \"rules\": { \"xstate/spawn-usage\": \"error\" } }"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"xstate\"],\n  \"extends\": [\"plugin:xstate/recommended\"],\n  \"rules\": {\n    \"xstate/event-names\": [\"warn\", \"camelCase\"],\n    \"xstate/state-names\": [\"warn\", \"camelCase\"]\n  },\n  \"settings\": {\n    \"xstate\": {\n      \"version\": 5\n    }\n  }\n}\n\n// Install:\n// npm install eslint-plugin-xstate --save-dev\n// npm install eslint --save-dev","lang":"json","description":"ESLint config to enable xstate plugin, use recommended rules (XState v5), and customize event/state naming conventions."},"warnings":[{"fix":"Update ESLint to >=8.40.0: npm install eslint@^8.40.0 --save-dev","message":"Version 3.0.0 requires ESLint >= 8.40.0. Older ESLint versions will cause errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If using XState v4, change extends to 'plugin:xstate/recommended_v4' or set version in settings.","message":"Version 3.0.0 drops support for shareable configurations without version suffix. Now default is XState v5; use 'recommended_v4' for v4.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Review XState v5 migration; use 'recommended_v4' config or set version:4 in settings.","message":"Version 2.0.0 added support for XState v5 but may break existing rules due to new v5 syntax.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Set \"settings\": { \"xstate\": { \"version\": 4 } } or use 'recommended_v4' config.","message":"Shareable configurations default to XState v5. If you use XState v4 without specifying, you may get false positives.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Disable spawn-usage if using XState v5, or use version-specific config.","message":"Rule 'spawn-usage' is only applicable for XState v4; using it with v5 may report errors incorrectly.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Remove autoForward from XState v5 definitions.","message":"Rule 'no-auto-forward' reports error if autoForward is found in XState v5, as it is deprecated in v5.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-plugin-xstate --save-dev","cause":"Missing installation of eslint-plugin-xstate.","error":"Error: Failed to load plugin 'xstate' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-xstate'"},{"fix":"npm install eslint-plugin-xstate@latest --save-dev","cause":"eslint-plugin-xstate not installed or version too old.","error":"Error: Failed to load config \"plugin:xstate/recommended\" to extend from."},{"fix":"Add \"plugins\": [\"xstate\"] to your ESLint config.","cause":"Plugin not registered in plugins section or rule name misspelled.","error":"Definition for rule 'xstate/spawn-usage' was not found."},{"fix":"Ensure eslint-plugin-xstate is in devDependencies and installed.","cause":"Plugin installed but not declared in package.json dependencies while using local ESLint.","error":"ESLint couldn't find the plugin \"eslint-plugin-xstate\". This is most likely an issue with the plugin resolution."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}