> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# newline-after-import

[Added in v0.4.2](https://github.com/web-infra-dev/rslint/releases/tag/v0.4.2)
## Configuration


```ts title=rslint.config.ts
import { defineConfig, importPlugin } from '@rslint/core';

export default defineConfig([
  importPlugin.configs.recommended,
  {
    rules: {
      'import/newline-after-import': 'error',
    },
  },
]);
```

## Rule Details

Enforces having one or more empty lines after the last top-level import statement or require call.

This rule supports the following options:

- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.
- `exactCount` which enforces the exact number of newlines mentioned in `count`. This option defaults to `false`.
- `considerComments` which enforces the rule on comments after the last import statement as well when set to true. This option defaults to `false`.

Examples of **incorrect** code for this rule:

```javascript
import * as foo from 'foo';
const FOO = 'BAR';
```

```javascript
const FOO = require('./foo');
const BAZ = 1;
```

Examples of **correct** code for this rule:

```javascript
import defaultExport from './foo';

const FOO = 'BAR';
```

```javascript
const FOO = require('./foo');
const BAR = require('./bar');

const BAZ = 1;
```

## Original Documentation

- [eslint-plugin-import: newline-after-import](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/newline-after-import.md)
- [Source code](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/src/rules/newline-after-import.js)
