# gspot/no-trivial-files

> Reports files containing only forwarding, aliases, re-exports, or trivial functions. Records, arrays, schema declarations, type predicates, and functions above the statement limit are exempt.

Reports files containing only forwarding, aliases, re-exports, or trivial functions. Records, arrays, schema declarations, type predicates, and functions above the statement limit are exempt.

The `all` config turns it on.

## Why

A file that only forwards to another module adds a step to every import and hides where the code lives.

## What to do

Import re-exported values from the modules that define them. Move aliases and small functions into the modules that use them, then delete the forwarding file.

## Example

A file containing only `export { value } from "./owner";` reports `trivial`. Change consumers to import directly from `owner`, then delete the forwarding file. Set `allowIndex: true` to permit an index barrel.

## Options

| Option              | Type              | Default | What it does                                               |
| ------------------- | ----------------- | ------- | ---------------------------------------------------------- |
| `trivialStatements` | Whole number      | `2`     | Functions with this many statements or fewer are reported. |
| `allowIndex`        | `true` or `false` | `false` | Allow a file named index that only re-exports.             |
