@mdor/eslint-node-config
v0.0.1
Published
Shared ESLint flat configuration with Node.js best practices for MDOR projects
Maintainers
Readme
@mdor/eslint-node-config
Shared ESLint flat configuration for Node.js projects. It composes
@mdor/eslint-config with the maintained eslint-plugin-n recommended rules for
ES modules and CommonJS.
Requirements
- Node.js 22.13 or newer
- npm 10 or newer
- ESLint 10.8 or newer within the 10.x release line (
^10.8.0) - ESM ESLint configuration
Install
npm install --save-dev @mdor/eslint-node-configConsumers do not install @mdor/eslint-config or eslint-plugin-n separately;
they are runtime dependencies of this package. ESLint remains a peer dependency
because the consuming project owns and runs the linter. npm 7 and newer installs a
compatible ESLint peer automatically when needed. Package managers configured not
to install peers automatically require ESLint ^10.8.0 to be added explicitly.
Use
// eslint.config.mjs
import mdorNodeConfig from "@mdor/eslint-node-config";
export default mdorNodeConfig;Compose project-specific overrides after the shared configuration:
import mdorNodeConfig from "@mdor/eslint-node-config";
export default [
...mdorNodeConfig,
{
files: ["scripts/**/*.js"],
rules: {
"n/no-process-exit": "off",
},
},
];The preset treats .js and .mjs files as ES modules and .cjs files as
CommonJS. It reads the supported Node.js version from the consuming project's
package.json#engines.node, following eslint-plugin-n behavior.
Public API
- The default and named
eslintNodeConfigexports contain the complete flat configuration array. nodeModuleConfigexposes the Node.js ES-module layer.nodeCommonJsConfigexposes the Node.js CommonJS layer.
The package is ESM-only and ships TypeScript declarations. Formatting rules are left to Prettier.
Runtime enforcement
The package declares Node.js and npm requirements through engines. npm reports
incompatible consumer environments and rejects them when engine-strict=true.
The matching devEngines policy uses onFail: "error" when this package is
developed directly with npm.
Activate the repository runtime before running package commands:
nvm use 22.13.0Repository source configuration
The MDOR monorepo consumes both workspace sources through relative imports while avoiding duplicate base rules:
// eslint.config.mjs
import mdorConfig from "./packages/eslint-config/index.js";
import { nodeCommonJsConfig, nodeModuleConfig } from "./packages/eslint-node-config/index.js";
export default [...mdorConfig, nodeModuleConfig, nodeCommonJsConfig];Validate and release
npm run typecheck --workspace @mdor/eslint-node-config
npm test --workspace @mdor/eslint-node-config
npm pack --workspace @mdor/eslint-node-config --dry-run
npm run release-patch-try --workspace @mdor/eslint-node-configPublishing requires npm authentication with access to the @mdor organization.
