Skip to content

Unused

TIP

This can be configured. Read more about configuration.

This checks items that are defined but never used. It checks for:

  • functions
  • parameters
  • function locals
  • type definitions
  • globals
  • memories
  • tables
  • WasmGC struct fields

Here is an example of unused functions and globals with or without identifiers:

wasm
(module
  (func)
  (func $f)
  (global i32
    i32.const 0)
  (global $g i32
    i32.const 0))

To intentionally ignore, you can add an underscore prefix to the identifier:

wasm
(module
  (func $_)
  (func $_f))

If they're exported, they won't be reported as unused:

wasm
(module
  (func (export "main")))