Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-snarkyjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-snarkyjs

SnarkyJS rules for ESLint

  • 0.2.0
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by36.84%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-snarkyjs

SnarkyJS rules for ESLint to detect bugs and invalid patterns in your Smart Contract code.

Rules

  • The maximum allowed state variables in a Smart Contract is 8
  • Throw statements should not be used in a Circuit method
  • If statements should not be used in a Circuit method
  • Ternary statements should not be used in a Circuit method
  • JavaScript JSON functions should not be used in a Circuit method
  • JavaScript random functions should not be used in a Circuit method
  • Overriding the constructor in a SmartContract is disallowed

Installation

# npm
npm install eslint-plugin-snarkyjs --save-dev

# yarn
yarn add eslint-plugin-snarkyjs --dev

Add eslint-plugin-snarkyjs to the plugins option in your eslint config:

{
  "plugins": ["snarkyjs"]
}
  • Then extend the recommended eslint config:
{
  extends: ['plugin:snarkyjs/recommended'],
}
  • You can enable specific rules manually:
{
  "rules": {
    "snarkyjs/no-greater-storage-limit-in-circuit": "error",
    "snarkyjs/no-throw-in-circuit": "error"
    ...
  }
}
  • An example ESLint configuration looks like:
module.exports = {
  parser: '@typescript-eslint/parser',
  plugins: ['snarkyjs'],
  extends: ['plugin:snarkyjs/recommended'],
};

Valid and Invalid Examples

Please refer to the project tests to learn more about the usage of the rules.

Keywords

FAQs

Package last updated on 02 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc