Notwithstanding Precautions, Misadventure

    eslint-plugin-webassembly

    1.11.1 • Public • Published

    eslint-plugin-webassembly

    ESLint plugin for WebAssembly

    Installation

    You'll first need to install ESLint:

    $ yarn add eslint --save-dev
    

    Next, install eslint-plugin-webassembly:

    $ yarn add eslint-plugin-webassembly --save-dev
    

    Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-webassembly globally.

    Usage

    Add webassembly to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

    {
        "plugins": [
            "webassembly"
        ]
    }

    Then configure the rules you want to use under the rules section.

    {
        "rules": {
            "webassembly/no-unknown-export": 2
        }
    }

    Supported Rules

    no-unknown-export

    Checks that the exports exists, example:

    Good:

    import("module.wasm").then(x => {
      x.test();
    });
    
    import("module.wasm").then(({test}) => {
      test();
    });

    Bad:

    import("module.wasm").then(x => {
      x.unknownExport();
    });
    
    import("module.wasm").then(({unknownExport}) => {
      unknownExport();
    });

    Parsing error: The keyword 'import' is reserved

    ESLint doesn't support dynamic import out of the box. Make sure to check out https://github.com/babel/babel-eslint.

    Install

    npm i eslint-plugin-webassembly

    DownloadsWeekly Downloads

    89

    Version

    1.11.1

    License

    MIT

    Unpacked Size

    11.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar