@stack-lint/node
v0.0.11
Published
stack lint eslint configs for nodejs
Maintainers
Readme
@stack-lint/node
Node.js ESLint configuration with best practices tailored for backend and server-side JavaScript projects.
Part of the Stack Lint family — designed to be combined with @stack-lint/base and others.
📦 Installation
npm install --save-dev eslint prettier @stack-lint/base @stack-lint/node
# or
yarn add -D eslint prettier @stack-lint/base @stack-lint/node
# or
pnpm add -D eslint prettier @stack-lint/base @stack-lint/node🚀 Usage
eslint.config.js (or eslint.config.mjs if not "type": "module"):
import getFlatConfigs from '@stack-lint/base';
import getNodeConfig from '@stack-lint/node';
export default getFlatConfigs(getNodeConfig(true)); // true if ESM, false or omit if CJSNode + TypeScript
npm install --save-dev @stack-lint/typescript typescript
# or
yarn add -D @stack-lint/typescript typescript
# or
pnpm add -D @stack-lint/typescript typescripteslint.config.js:
import getFlatConfigs from '@stack-lint/base';
import getNodeConfig from '@stack-lint/node';
import getTsConfigs from '@stack-lint/typescript';
export default getFlatConfigs(
getNodeConfig(true), // true if ESM, false or omit if CJS
...getTsConfigs({
tsconfigRootDir: import.meta.dirname,
// tsRootDir: 'src/' your tsconfigs files rootDir, if * then no need the field
}),
);Explanation
getNodeConfig(true || { extension: true })returns the Node.js ESLint configuration optimized for ESM (ECMAScript Modules) environments.- Passing
trueenables ESM-specific rules and settings; passfalseor omit the argument for CommonJS environments. - Passing
{ extension: true }enables ESM-specific rules and settings andextension: truefor omit extension check if you use bundler for resolve extension getFlatConfigs(...)takes one or more ESLint config objects and merges them into a single flat configuration that ESLint can directly use.
