# gspot/no-comments-in-imports

> Reports comments within or immediately after an import block. Exempts tool directives after the last import and comments that lead the next declaration.

Reports comments within or immediately after an import block. Exempts tool directives after the last import and comments that lead the next declaration.

The `all` config turns it on. `eslint --fix` fixes it.

## Why

An import block lists dependencies. A file header belongs before it, and a behavior comment belongs with the code it explains.

## What to do

Move the comment above the first import or beside its declaration. eslint `--fix` moves it above the block.

## Example

A file header after an import reports `noCommentsInImports`. A comment between imports does too. Move the comment above the first import or beside the code it explains. A comment that leads the next declaration remains in place. A tool directive is allowed only after the last import; a directive between imports is reported without a fix. CommonJS require declarations follow the same rule when ESLint selects the commonjs source type.

## Options

This rule has no options.
