eslint-plugin-asmjs
asm.js validation for ESLint
asm.js has performance benefits over vanilla JS in many browsers. However, invalid asm.js code may be interpreted as normal JS, causing a hard-to-identify deoptimization. This helps identify those cases in hand-written asm.js code that may be intertwined with your normal JS.
It uses the
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-asmjs
:
$ npm install eslint-plugin-asmjs --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must
also install eslint-plugin-asmjs
globally.
Usage
Add asmjs
to the plugins section of your .eslintrc
configuration file. You
can omit the eslint-plugin-
prefix:
Then configure the rules you want to use under the rules section.
Supported Rules
asmjs
: Uses the official asm.js validator to verify any function with a"use asm"
directive.
Known Limitations
- The official validator has no error recovery, so this only returns one error at a time.
- Mixing this rule with certain other eslint rules, such as
no-bitwise
may cause conflicts.