Modern ESLint configuration for Node.js projects with essential best practices and future-proofing.
- Node.js >= 22.13.1
- ESLint >= 9.0.0
- Prettier >= 3.2.0
- 🚀 ESLint v9 flat config - Future-proof configuration format
- 🌟 Latest ECMAScript features - Automatically supports new JS features
- 📦 Essential Node.js patterns - Critical deprecation detection
- 🔧 Auto-fixable rules - Most issues can be automatically resolved
- 🎨 Prettier integration - Seamless code formatting
- 🧪 Test & config friendly - Relaxed rules for test and config files
- @eslint/js - Core ESLint recommended rules
- eslint-plugin-n - Node.js specific best practices
- eslint-config-prettier - Prettier compatibility
npm install --save-dev @mindflash-ops/eslint-config @eslint/js eslint eslint-config-prettier eslint-plugin-n prettier
Create an eslint.config.js
file in your project root:
import sharedConfig from '@mindflash-ops/eslint-config/eslint.config.js';
export default [
...sharedConfig,
// Add your custom rules here if needed
{
rules: {
// Custom overrides
},
},
];
Add these scripts to your package.json
:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check ."
}
}
no-var
,prefer-const
,prefer-template
(warnings) - Encourages modern syntaxno-duplicate-imports
(error) - Cleaner imports
n/no-deprecated-api
(error) - Prevents breaking changesno-buffer-constructor
(error) - UseBuffer.from()
instead
eqeqeq
,no-return-await
(errors) - Prevents bugs and performance issuesrequire-await
,no-unused-vars
,max-len
(warnings) - Code cleanliness
semi
,quotes
,comma-dangle
(auto-fixable errors) - Consistent formattingno-console
allowed - Common in Node.js development
- Very relaxed rules to not interfere with testing patterns
- Console usage allowed
- Unused variables allowed
- Console usage allowed
- Unused variables allowed for configuration flexibility
This configuration automatically adapts to new Node.js and JavaScript features:
ecmaVersion: 'latest'
- Always uses newest JavaScript features- Node.js deprecation detection - Automatically flags deprecated APIs
- Stable dependency ranges - Won't break with minor updates
ISC