Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 769 Bytes

newline-after-import.md

File metadata and controls

51 lines (35 loc) · 769 Bytes

newline-after-import

Enforces having an empty line after the last top-level import statement or require call.

Rule Details

Valid:

import defaultExport from './foo'

const FOO = 'BAR'
import defaultExport from './foo'
import { bar }  from 'bar-lib'

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

const BAZ = 1

...whereas here imports will be reported:

import * as foo from 'foo'
const FOO = 'BAR'
import * as foo from 'foo'
const FOO = 'BAR'

import { bar }  from 'bar-lib'
const FOO = require('./foo')
const BAZ = 1
const BAR = require('./bar')

When Not To Use It

If you like to visually group module imports with its usage, you don't want to use this rule.