{"id":36746840,"url":"https://github.com/rlaffers/eslint-plugin-xstate","last_synced_at":"2026-01-12T12:36:33.655Z","repository":{"id":39375458,"uuid":"356548668","full_name":"rlaffers/eslint-plugin-xstate","owner":"rlaffers","description":"ESLint plugin to check for common mistakes and enforce good practices when using XState.","archived":false,"fork":false,"pushed_at":"2023-12-16T11:36:19.000Z","size":910,"stargazers_count":49,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-20T17:48:43.712Z","etag":null,"topics":["eslint-plugin","fsm","hacktoberfest","javascript","state-machines","statecharts","xstate"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rlaffers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-10T10:34:17.000Z","updated_at":"2025-07-29T09:50:41.000Z","dependencies_parsed_at":"2023-10-04T04:55:08.293Z","dependency_job_id":"b3761842-0ef9-4871-8ffd-50656590eb62","html_url":"https://github.com/rlaffers/eslint-plugin-xstate","commit_stats":{"total_commits":170,"total_committers":5,"mean_commits":34.0,"dds":0.07058823529411762,"last_synced_commit":"2af70bb59accc692c7877802352b46bb4e017d7e"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/rlaffers/eslint-plugin-xstate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlaffers%2Feslint-plugin-xstate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlaffers%2Feslint-plugin-xstate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlaffers%2Feslint-plugin-xstate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlaffers%2Feslint-plugin-xstate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rlaffers","download_url":"https://codeload.github.com/rlaffers/eslint-plugin-xstate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlaffers%2Feslint-plugin-xstate/sbom","scorecard":{"id":778465,"data":{"date":"2025-08-11","repo":{"name":"github.com/rlaffers/eslint-plugin-xstate","commit":"9988c15a5c739779837687d752b477d8fa9764b8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:20","Info: jobLevel 'contents' permission set to 'read': .github/workflows/test.yml:14","Info: topLevel permissions set to 'read-all': .github/workflows/codesee-arch-diagram.yml:12","Info: topLevel 'contents' permission set to 'read': .github/workflows/pull-request.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/test.yml:7"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/codesee-arch-diagram.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/rlaffers/eslint-plugin-xstate/codesee-arch-diagram.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/rlaffers/eslint-plugin-xstate/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/rlaffers/eslint-plugin-xstate/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/rlaffers/eslint-plugin-xstate/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/rlaffers/eslint-plugin-xstate/test.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch 'next'","Warn: branch protection not enabled for branch 'beta'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T04:16:15.158Z","repository_id":39375458,"created_at":"2025-08-23T04:16:15.159Z","updated_at":"2025-08-23T04:16:15.159Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint-plugin","fsm","hacktoberfest","javascript","state-machines","statecharts","xstate"],"created_at":"2026-01-12T12:36:33.581Z","updated_at":"2026-01-12T12:36:33.647Z","avatar_url":"https://github.com/rlaffers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-xstate\n\nESLint plugin to check for common mistakes and enforce good practices when using [XState library](https://xstate.js.org/).\n\n[![npm version](https://img.shields.io/npm/v/eslint-plugin-xstate)](https://npmjs.com/package/eslint-plugin-xstate)\n[![build status](https://img.shields.io/github/actions/workflow/status/rlaffers/eslint-plugin-xstate/release.yml)](https://github.com/rlaffers/eslint-plugin-xstate/actions/workflows/release.yml)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n## Installation\n\nYou'll first need to install [ESLint](http://eslint.org):\n\n```\n$ npm i eslint --save-dev\n```\n\nNext, install `eslint-plugin-xstate`:\n\n```\n$ npm install eslint-plugin-xstate --save-dev\n```\n\n## Usage\n\nAdd `xstate` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:\n\n```json\n{\n  \"plugins\": [\"xstate\"]\n}\n```\n\nThen configure the rules you want to use under the rules section.\n\n```json\n{\n  \"rules\": {\n    \"xstate/spawn-usage\": \"error\",\n    \"xstate/no-infinite-loop\": \"error\",\n    \"xstate/no-imperative-action\": \"error\",\n    \"xstate/no-ondone-outside-compound-state\": \"error\",\n    \"xstate/invoke-usage\": \"error\",\n    \"xstate/entry-exit-action\": \"error\",\n    \"xstate/prefer-always\": \"error\",\n    \"xstate/prefer-predictable-action-arguments\": \"error\",\n    \"xstate/no-misplaced-on-transition\": \"error\",\n    \"xstate/no-invalid-transition-props\": \"error\",\n    \"xstate/no-invalid-state-props\": \"error\",\n    \"xstate/no-invalid-conditional-action\": \"error\",\n    \"xstate/no-async-guard\": \"error\",\n    \"xstate/event-names\": [\"warn\", \"macroCase\"],\n    \"xstate/state-names\": [\"warn\", \"camelCase\"],\n    \"xstate/no-inline-implementation\": \"warn\",\n    \"xstate/no-auto-forward\": \"warn\",\n    \"xstate/system-id\": \"warn\"\n  }\n}\n```\n\n## Shareable Configurations\n\nThis plugin exports a `recommended` configuration which checks for common mistakes. To enable this configuration use the `extends` property in your `.eslintrc.js` config file:\n\n```json\n{\n  \"extends\": [\"plugin:xstate/recommended\"]\n}\n```\n\nThere is also an `all` configuration which includes every available rule. It enforces both correct usage and best XState practices.\n\n```json\n{\n  \"extends\": [\"plugin:xstate/all\"]\n}\n```\n\n### XState Version\n\nThe default shareable configurations are for XState v5. If you use XState version 4, append `_v4` to the name of the configuration you want to use.\n\n```json\n{\n  \"extends\": [\"plugin:xstate/recommended_v4\"]\n}\n```\n\n```json\n{\n  \"extends\": [\"plugin:xstate/all_v4\"]\n}\n```\n\nIf you do not use shareable configs, you need to manually specify the XState version in the ESLint config (defaults to 5):\n\n```json\n{\n  \"settings\": {\n    \"xstate\": {\n      \"version\": 4\n    }\n  }\n}\n```\n\n## Supported Rules\n\n### Possible Errors\n\n| Rule                                                                               | Description                                                        | Recommended        |\n| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------ |\n| [spawn-usage](docs/rules/spawn-usage.md)                                           | Enforce correct usage of `spawn`. **Only for XState v4!**          | :heavy_check_mark: |\n| [no-infinite-loop](docs/rules/no-infinite-loop.md)                                 | Detect infinite loops with eventless transitions                   | :heavy_check_mark: |\n| [no-imperative-action](docs/rules/no-imperative-action.md)                         | Forbid using action creators imperatively                          | :heavy_check_mark: |\n| [no-ondone-outside-compound-state](docs/rules/no-ondone-outside-compound-state.md) | Forbid onDone transitions on `atomic`, `history` and `final` nodes | :heavy_check_mark: |\n| [invoke-usage](docs/rules/invoke-usage.md)                                         | Enforce correct invocation of services                             | :heavy_check_mark: |\n| [entry-exit-action](docs/rules/entry-exit-action.md)                               | Forbid invalid declarations of entry/exit actions                  | :heavy_check_mark: |\n| [no-misplaced-on-transition](docs/rules/no-misplaced-on-transition.md)             | Forbid invalid declarations of `on` transitions                    | :heavy_check_mark: |\n| [no-invalid-transition-props](docs/rules/no-invalid-transition-props.md)           | Forbid invalid properties in transition declarations               | :heavy_check_mark: |\n| [no-invalid-state-props](docs/rules/no-invalid-state-props.md)                     | Forbid invalid properties in state node declarations               | :heavy_check_mark: |\n| [no-async-guard](docs/rules/no-async-guard.md)                                     | Forbid asynchronous guard functions                                | :heavy_check_mark: |\n| [no-invalid-conditional-action](docs/rules/no-invalid-conditional-action.md)       | Forbid invalid declarations inside the `choose` action creator     | :heavy_check_mark: |\n\n### Best Practices\n\n| Rule                                                                                     | Description                                                             | Recommended        |\n| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------ |\n| [no-inline-implementation](docs/rules/no-inline-implementation.md)                       | Suggest refactoring guards, actions and services into machine options   |                    |\n| [prefer-always](docs/rules/prefer-always.md)                                             | Suggest using the `always` syntax for transient (eventless) transitions | :heavy_check_mark: |\n| [prefer-predictable-action-arguments](docs/rules/prefer-predictable-action-arguments.md) | Suggest turning on the `predictableActionArguments` option              | :heavy_check_mark: |\n| [no-auto-forward](docs/rules/no-auto-forward.md)                                         | Forbid auto-forwarding events to invoked services or spawned actors     |                    |\n| [system-id](docs/rules/system-id.md)                                                     | Suggest using systemId for invoked or spawned actors                    |                    |\n\n### Stylistic Issues\n\n| Rule                                     | Description                                                              | Recommended |\n| ---------------------------------------- | ------------------------------------------------------------------------ | ----------- |\n| [event-names](docs/rules/event-names.md) | Suggest consistent formatting of event names                             |             |\n| [state-names](docs/rules/state-names.md) | Suggest consistent formatting of state names and prevent confusing names |             |\n\n## Comment Directives\n\nBy default, the plugin lints only code within the `createMachine` or `Machine` calls. However, if your machine configuration is imported from another file, you will need to enable this plugin's rules by adding a comment directive to the top of the file:\n\n```js\n/* eslint-plugin-xstate-include */\n// 💡 This machine config will now be linted too.\nexport const machine = {\n  initial: 'active',\n  context: {},\n  // etc\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlaffers%2Feslint-plugin-xstate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frlaffers%2Feslint-plugin-xstate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlaffers%2Feslint-plugin-xstate/lists"}