Neverending Prototype Mode
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

eslint-config-jessie

0.0.2 • Public • Published

Jessie

Jessie is a tiny subset of JavaScript designed for writing smart contracts with confidence. Jessie removes the hazardous parts to create an object-capability subset that supports reasoning about code functionality and robustness.

For more information on Jessie, view the repository on Github. You can also view the grammar written in BNF.

eslint-config-jessie

eslint-config-jessie is a package that includes the basic ESLint configuration for enforcing most Jessie rules.

Installation

Prerequisites: Node.js (>=6.14), npm version 3+.

You'll first need to install ESLint. We recommend installing it locally rather than globally:

$ npm i eslint --save-dev

Next, install eslint-config-jessie:

$ npm install eslint-config-jessie --save-dev

Usage

You should then setup a configuration file if you don't have one yet:

$ ./node_modules/.bin/eslint --init

Now we need to turn on the Jessie rules in the ESLint config file. This config file will have various properties such as "rules" and "env". Find or add the "extends" property, and set the value to jessie:

    "extends": "jessie"

This will allow you to use the Jessie shareable config file.

After that, you can run ESLint in your project’s root directory like this:

$ ./node_modules/.bin/eslint yourfile.js

Additionally, many IDEs will recognize your ESLint settings automatically and show errors and warnings in your code as you type.

Rules included

Jessie deliberately does not include:

  • use of new
  • semicolon insertion
  • in
  • computed property names
  • generators
  • async functions
  • async iterator functions
  • fall-through in switch statements
  • naked statements in control-flow branches
  • direct eval
  • some globals such as RegExp and Date
  • bitwise operators
  • do/while
  • this
  • ClassExpression
  • GeneratorExpression
  • super
  • MetaProperty
  • delete
  • ++, --
  • instanceof
  • for/in
  • ==, !=
  • ternary expressions (?)

Future Tasks

  1. Better error messages: The default error messages aren't as clear as they could be.
  2. More written tests for each of the rules
  3. Enforce more of the Jessie subset through an ESLint plugin that creates new rules, including the rules below:

Jessie rules still to include

  • treat async, arguments, and eval as reserved keywords
  • avoid this-capture hazards - i.e. looking up a function in an array and calling it can be used to capture the array itself through this. Statically rejects array[+i](arg)
  • all objects made by literal expressions (object literals, array literals, function literals, etc) must be tamper-proofed with def before they can be aliased or escape from their static context of origin
  • no top level mutability
  • restrict index access to number-names, require + as a prefix in indices.

install

npm i eslint-config-jessie

Downloadsweekly downloads

2

version

0.0.2

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability