File: README.md

package info (click to toggle)
node-webassemblyjs 1.11.0%2Bdfsg%2B~cs10.10.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,040 kB
  • sloc: javascript: 28,630; makefile: 84; sh: 42; ansic: 16
file content (76 lines) | stat: -rw-r--r-- 1,282 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# eslint-plugin-webassembly

ESLint plugin for WebAssembly

## Installation

You'll first need to install [ESLint](http://eslint.org):

```
$ 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:

```json
{
    "plugins": [
        "webassembly"
    ]
}
```


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

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

## Supported Rules

### `no-unknown-export`

Checks that the exports exists, example:

Good:

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

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

Bad:

```js
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.