ESLint plugin with rules for o1js (formerly SnarkyJS) Smart Contract development. Version 0.4.0 is stable, released via npm. It detects invalid patterns such as throws, if/ternary statements, use of JSON/random functions in circuits, state variable limit (max 8), and constructor overriding. Designed for TypeScript projects using o1js to build zero-knowledge smart contracts on Mina Protocol. Alternative to manual code review for o1js circuit constraints.
npm install eslint-plugin-o1jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure ESLint with o1js plugin and demonstrates rule violations for excessive state variables, if statements, and throw in circuits.
Ensure your ESLint config uses parser: '@typescript-eslint/parser' and enable TypeScript parsing.
Move constructor logic to a @method or use a deployment pattern that does not override the constructor.
Use 'plugin:o1js/recommended' and avoid referencing individual rules by name unless necessary.
Manually verify that total internal state objects do not exceed 8, including those without @state decorator.
Avoid using computed property names or dynamic method calls in circuit methods.
Run 'npm install eslint-plugin-o1js --save-dev' or the equivalent for your package manager.
Install '@typescript-eslint/parser' and set 'parser: '@typescript-eslint/parser'' in your ESLint config.
Ensure plugin is listed in 'plugins: ["o1js"]' and rule name matches one of the available rules (e.g., 'o1js/no-throw-in-circuit').