eslint-config-bevry
Bevry's ESLint configuration is an intelligent, self-configuring system that automatically analyzes your project and adapts ESLint configuration accordingly. It performs comprehensive project analysis to detect your development environment and applies the optimal ESLint setup.
🚀 For the ultimate zero-configuration experience: Use Boundation - Bevry's automatic scaffolding and upgrading tool. When your project is scaffolded and managed by Boundation, nearly everything (including ESLint, TypeScript, testing, documentation, CI/CD, and more) is automatically configured and maintained using Bevry's battle-tested best practices. Simply run npx boundation
in your project directory for complete project setup and ongoing maintenance.
🔍 Intelligent Project Analysis
- Boundation Ecosystem (optional): Complete automation via interactive Q&A system. When using Boundation, virtually all project metadata (editions, dependencies, keywords, browser fields, TypeScript/Babel/React setup, etc.) is automatically injected and managed, eliminating the need for manual configuration of the elements below.
- Editions Integration (optional): When present, analyzes your
package.json
editions to extract syntax, module system, and target environment information - Dependency Detection: Scans
dependencies
anddevDependencies
to automatically enable relevant plugins and configurations - Package.json Analysis: Examines
keywords
,browser
field, and other metadata to determine your project's target environment - ECMAScript Version Intelligence: Dynamically detects and configures for your specific ECMAScript target (ES5, ES2015, ES2017, ES2020, ES2021+)
- Automatically disables incompatible rules for older targets
- Configures appropriate globals and language features
- Adjusts rule severity based on target capabilities
⚙️ Adaptive Configuration
- ESLint Foundation: Extends ESLint's recommended configuration from
@eslint/js
as the baseline for all linting rules. - Module System Detection: Automatically configures for ES modules or CommonJS based on your project structure
- Enables
eslint-plugin-import
with appropriate module validation - Configures TypeScript-aware import rules when applicable
- Enables
- Environment-Specific Setup: Intelligently configures globals and rules for detected environments:
- Node.js: Configures
eslint-plugin-n
with module-aware or script-aware settings - Browser: Applies browser globals and environment-specific rules
- Web Workers: Configures worker and service worker globals
- Node.js: Configures
- Framework Integration: Automatically detects and configures framework-specific linting:
- React: Enables
eslint-plugin-react
with auto-detected React version andeslint-plugin-react-hooks
- JSX: Configures JSX parsing and JSX-runtime rules when detected
- React: Enables
- Language Support: Comprehensive language tooling integration:
- TypeScript: Uses
typescript-eslint
with strict configuration, disables conflicting JavaScript rules - Babel: Integrates
@babel/eslint-parser
and@babel/eslint-plugin
when detected
- TypeScript: Uses
- Documentation Standards: Automatic JSDoc validation with
eslint-plugin-jsdoc
, TypeScript-aware when applicable - Code Formatting: Intelligent Prettier integration via
eslint-config-prettier
with comprehensive stylistic rule management:- Prettier-Compatible Rules: Special rules that can coexist with Prettier (marked as
specialRule
rather than disabled) - Legacy Stylistic Rules: Non-Prettier rules managed by ESLint Stylistic for comprehensive code consistency
- Smart Conflict Resolution: Automatic detection and resolution of formatting conflicts between ESLint and Prettier
- Prettier-Compatible Rules: Special rules that can coexist with Prettier (marked as
📋 Comprehensive Rule Set
The configuration includes 120+ carefully curated ESLint rules designed to enforce best practices and coding conventions battle-tested by Bevry across 200+ packages and 20 years of JavaScript development.
Zero-Conflict Architecture: Takes great care to ensure zero conflicts between custom rules and plugin configurations. Each rule override is intentional and documented, preventing configurations from inadvertently disabling important plugin-provided rules.
Battle-Tested Standards: These conventions have evolved through maintaining hundreds of open source projects, from simple utilities to complex applications, ensuring they work reliably across diverse JavaScript environments and use cases.
All rules automatically adapt based on your detected environment, target ECMAScript version, and enabled features.
✨ Benefits
- 🚀 Zero Configuration: Works out-of-the-box with intelligent project detection
- 📦 Dependency-Free: No need to install or manage individual ESLint plugins
- 🔧 Self-Maintaining: Configuration updates automatically with your project changes
- ⚡ Performance Optimized: Only loads and configures plugins you actually need
- 🛡️ Battle-Tested: Used across Bevry's ecosystem of 200+ open source projects
Usage
Use boundation to automate installation and maintenance, making the rest of this usage section unnecessary.
Otherwise, to proceed and maintain manually, first install it and ESLint:
npm install --save-dev eslint eslint-config-bevry
💡 Zero Plugin Management: With
eslint-config-bevry
, there's no need to manually install or configure any ESLint plugins (eslint-plugin-react
,typescript-eslint
,eslint-plugin-import
, etc.). The configuration automatically includes and configures all necessary plugins based on your project's detected features, saving you from dependency management complexity.
Then add eslint.config.js
file to your project root:
import { defineConfig } from 'eslint/config'
import eslintBevry from 'eslint-config-bevry'
export default defineConfig(eslintBevry)
Advanced Configuration
eslint-config-bevry
supports customization through your package.json
or programmatically:
Default Files and Ignores
Default Files: When no files
are specified, eslint-config-bevry automatically includes:
- If Editions are detected:
{sourceEdition.directory}/**/*.{js,cjs,mjs,jsx,mjsx,ts,cts,mts,tsx,mtsx}
- Otherwise:
**/*.{js,cjs,mjs,jsx,mjsx,ts,cts,mts,tsx,mtsx}
Default Ignores: Always includes these patterns (your custom ignores are appended):
**/*.d.ts
- TypeScript declaration files**/vendor/
- Third-party vendor directories**/node_modules/
- Node.js dependencies
Customization Options
Via package.json:
{
"eslintConfig": {
"files": [
// Replaces the configuration from `eslint-config-bevry`
"source/**/*.{js,ts}"
],
"ignores": [
// Appends to the configuration from `eslint-config-bevry`
"dist/",
"*.config.js"
],
"rules": {
// Overrides the configuration from `eslint-config-bevry`
"no-console": "off"
}
}
}
Programmatic customization:
import { defineConfig } from 'eslint/config'
import eslintBevry from 'eslint-config-bevry'
export default defineConfig({
extends: [eslintBevry],
files: [
// Replaces the configuration from `eslint-config-bevry`
'source/**/*.{js,ts}',
],
ignores: [
// Appends to the configuration from `eslint-config-bevry`
'dist/',
'*.config.js',
],
rules: {
// Overrides the configuration from `eslint-config-bevry`
'no-console': 'off',
},
})
Running ESLint
Use ESLint as normal:
npx eslint --fix
Debugging and Inspection
To see, inspect, and debug the resultant configuration:
npx eslint --inspect-config
To validate your configuration is working correctly:
# Check specific files
npx eslint source/index.js --max-warnings 0
# See what files ESLint will process
npx eslint --dry-run
🔍 Troubleshooting: If you encounter unexpected behavior, the configuration adapts based on your package.json
dependencies and metadata. Check that your project's dependencies
, devDependencies
, keywords
, and editions
accurately reflect your project setup.
History
Discover the release history by heading on over to the HISTORY.md
file.
Backers
Code
Discover how to contribute via the CONTRIBUTING.md
file.
Authors
- Benjamin Lupton — Accelerating collaborative wisdom.
Maintainers
- Benjamin Lupton — Accelerating collaborative wisdom.
Contributors
- Benjamin Lupton — view contributions
- Michael Duane Mooring — view contributions
- Rob Loach — view contributions
Finances
Sponsors
- Andrew Nesbitt — Working on mapping the world of open source software @ecosyste-ms and empowering developers with @octobox
- Divinci ™ — A more comfortable AI conversation experience, with friends! 🤖🖤
- Mr. Henry
- Poonacha Medappa
- Roboflow
- Square
Donors
- Andrew Nesbitt
- Ángel González
- Arjun Aditya
- Armen Mkrtchian
- Balsa
- Canonical
- Chad
- Codecov
- Divinci ™
- dr.dimitru
- Elliott Ditman
- entroniq
- Frontend Masters
- GitHub
- Hunter Beast
- Jean-Luc Geering
- Lee Driscoll
- Michael Duane Mooring
- Michael Harry Scepaniak
- Mohammed Shah
- Mr. Henry
- Pleo
- Poonacha Medappa
- Robert de Forest
- Rob Morris
- Roboflow
- Scott Kempson
- Sentry
- ServieJS
- Skunk Team
- Square
- Syntax
- WriterJohnBuck
License
Unless stated otherwise all works are:
- Copyright © Benjamin Lupton
and licensed under: