https://github.com/wmfs/statelint
A validator for Amazon State Language JSON files.
https://github.com/wmfs/statelint
package tymly
Last synced: 16 days ago
JSON representation
A validator for Amazon State Language JSON files.
- Host: GitHub
- URL: https://github.com/wmfs/statelint
- Owner: wmfs
- License: mit
- Created: 2018-10-07T16:25:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-05-01T20:28:47.000Z (28 days ago)
- Last Synced: 2025-05-01T21:44:48.733Z (28 days ago)
- Topics: package, tymly
- Language: JavaScript
- Size: 273 KB
- Stars: 8
- Watchers: 7
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# statelint
[](https://tymly.io/) [](https://www.npmjs.com/package/@wmfs/statelint) [](https://circleci.com/gh/wmfs/statelint) [](https://codecov.io/gh/wmfs/statelint) [](https://dependabot.com/) [](http://commitizen.github.io/cz-cli/)
[](https://standardjs.com) [](https://github.com/wmfs/tymly/blob/master/packages/statelint/LICENSE)An npm package providing a validator for [Amazon States Language](https://states-language.net/spec.html) JSON files. Usable from the command-line or as a library.
This package is derived from Amazon Web Services Labs' [awslabs/statelint](https://github.com/awslabs/statelint) and is up to date with [Amazon States Language](https://states-language.net/) as of [September 7, 2023](https://states-language.net/#september-7-2023).
## From the Command-line
### Installation
```sh
npm install --global @wmfs/statelint
```### Usage
```javascript
statelint state-machine-spec [state-machine-spec...]
```There are no options. If you see no output, your state machine is fine.
## As a library
### Installation
```sh
npm install --save @wmfs/statelint
```### Usage
```javascript
const stateLint = require('@wmfs/statelint')const problems = stateLint.validate(json)
if (problems.length !== 0) {
console.log('Oh dear!')
problems.forEach(p => console.log(`ERROR: ${p}`)
}
```* `json` is the state machine to validate as a JSON object.
`stateLint.validate` returns an array or error strings. If the array is empty, the state machine is fine. If not, then there's a problem! The validator is exhaustive, so it will report every problem it finds, not simply bail at the first thing. The error messages have the general form ` `.
## Contributing
Bug reports and pull requests are welcome on GitHub. Please be aware of our [Code of Conduct](https://github.com/wmfs/statelint/blob/master/CODE_OF_CONDUCT.md)
## License
Licensed under the terms of the [MIT license](https://github.com/wmfs/statelint/blob/master/LICENSE). Copyright (c) 2018 West Midlands Fire Service