# gspot/require-server-only

> Checks that a selected server module imports "server-only" or declares "use server".

Checks that a selected server module imports “server-only” or declares “use server”.

No config turns it on; turn it on in your ESLint config.

## Why

A server-only marker lets Next.js reject client imports of a module that uses private server capabilities.

## What to do

Add import “server-only” to the imports. Use “use server” only for a module that follows the Server Actions contract. If the file is not server code, remove it from the files this rule selects.

## Example

A selected server module containing `export const secret = 1;` reports `missing`. With the `server-only` package installed, add `import "server-only";` before that declaration.

## Options

This rule has no options.
