Some modules export many unrelated utilities (likeDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sindresorhus/eslint-plugin-unicorn/llms.txt
Use this file to discover all available pages before exploring further.
util), where named imports keep the code clear about what is being used. Other modules (like path) group closely related functions under a single namespace, making a default import more practical. This rule lets you enforce the right import style per module.
| Recommended | ✅ recommended · ☑️ unopinionated |
| Fixable | — |
| Suggestions | — |
unassigned—import 'foo'orrequire('foo')default—import path from 'path'orconst path = require('path')namespace—import * as path from 'path'named—import {inspect} from 'util'orconst {inspect} = require('util')
| Module | Required style |
|---|---|
util / node:util | named |
path / node:path | default |
chalk | default |
Configuration options
styles
Type: object
Extend or override the default import styles per module. Each key is a module name; the value is either false (disable all restrictions) or an object mapping style names to true/false.
util and additionally allows named imports from path (keeping the existing default style allowed too).
extendDefaultStyles
Type: booleanDefault:
true
When true, your styles config merges with the built-in defaults. Set to false to replace the defaults entirely.
checkImport
Type: booleanDefault:
true
Set to false to skip linting of static import statements.
checkDynamicImport
Type: booleanDefault:
true
Set to false to skip linting of dynamic import() expressions.
checkExportFrom
Type: booleanDefault:
false
Set to true to also lint export … from re-export statements.
checkRequire
Type: booleanDefault:
true
Set to false to skip linting of require() calls.
When the
default style is required and you use require(), both const path = require('path') (namespace assignment) and const { default: path } = require('path') (default destructuring) are accepted, because require() has no automatic ES module interop.