Prefer the native JavaScript module (ESM) format over the legacy CommonJS format. Enforcing ESM across a project helps the ecosystem converge on a single, interoperable module system.Documentation 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.
| Recommended | ✅ recommended · ☑️ unopinionated |
| Fixable | 🔧 Auto-fixable |
| Suggestions | 💡 Has suggestions |
.cjs files are completely ignored by this rule.'use strict'directive — ESM is always in strict mode; the directive is redundant.- Top-level
return— a CommonJS-only feature with no ESM equivalent. __dirnameand__filename— not available in ESM. Useimport.meta.dirname/import.meta.filename(Node.js ≥ 20.11) or derive them fromimport.meta.url.require(…)— replaced byimportorimport(…).exportsandmodule.exports— replaced byexportdeclarations.