Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 638 Bytes

imports-first.md

File metadata and controls

32 lines (21 loc) · 638 Bytes

imports-first

By popular demand, this rule reports any imports that come after non-import statments.

Rule Details

import foo from './foo'

// some module-level initializer
initWith(foo)

import bar from './bar' // <- reported

Providing absolute-first as an option will report any absolute imports (i.e. packages) that come after any relative imports:

import foo from 'foo'
import bar from './bar'

import * as _ from 'lodash' // <- reported

TODO: add explanation of imported name hoisting

When Not To Use It

If you don't mind imports being sprinkled throughout, you may not want to enable this rule.