@estjs/eslint-config v2.0.5
@estjs/eslint-config
Comprehensive flat ESLint configuration for modern JavaScript/TypeScript projects
A unified, easy-to-use ESLint configuration package supporting JavaScript, TypeScript, Vue 2, Vue 3, React, Node, RegExp, UnoCSS, Markdown, and JSDoc.
โจ Features
- ๐ Modern Format Engine - Powered by Biome with optimized rules
- ๐ Zero Configuration - Works out-of-the-box with TypeScript, Vue 2/3, and more
- ๐ฆ Broad Support - Handles JSON(5), YAML, Markdown, and other file formats
- ๐งน Smart Organization - Automatically sorts imports,
package.json
,tsconfig.json
, etc. - ๐ง Flat Config System - Uses ESLint Flat config for easy composition
- โ๏ธ Auto Detection - Intelligently enables features based on your project dependencies
- ๐ป Dev Experience - Reasonable defaults and best practices with minimal configuration
๐ Requirements
- Node.js >= 18
๐ฅ Installation
# npm
npm install -D @estjs/eslint-config
# yarn
yarn add -D @estjs/eslint-config
# pnpm
pnpm add -D @estjs/eslint-config
๐ ๏ธ Usage
Create an eslint.config.js
file in your project root:
import { estjs } from '@estjs/eslint-config';
export default estjs(
// Override default configurations
{
javascript: {
'unused-imports/no-unused-imports': 'off',
'unused-imports/no-unused-vars': 'off',
'no-console': 'off',
},
unicorn: {
'unicorn/filename-case': 'off',
},
imports: {
'import/no-default-export': 'off',
},
},
// Configure features - auto-detected by default
{
biome: true, // default: false
markdown: true, // default: true
vue: true, // auto-detected based on dependencies
unocss: false, // auto-detected based on dependencies
typescript: true, // auto-detected based on dependencies
react: true, // auto-detected based on dependencies
node: true, // default: true
prettier: true, // default: true
pnpm: false, // default: false
test: true, // auto-detected based on dependencies
},
);
๐ Configuration Options
Override Rules
You can override any rules in the first parameter:
export default estjs({
// JavaScript/TypeScript related rules
javascript: {
// Override JavaScript related rules
},
// TypeScript specific rules (only applied when typescript is enabled)
typescript: {
// Override TypeScript related rules
},
// Import organization and validation
imports: {
// Override import plugin rules
},
// Unicorn plugin rules
unicorn: {
// Override unicorn plugin rules
},
// JSDoc validation rules
jsdoc: {
// Override JSDoc related rules
},
// Vue specific rules
vue: {
// Override Vue related rules
},
// Markdown processing rules
markdown: {
// Override Markdown related rules
},
// Biome configuration options
biome: {
// Override Biome config
},
// Prettier configuration
prettier: {
// Override Prettier config
},
// React specific rules
react: {
// Override React related rules
},
// Testing related rules
test: {
// Override testing related rules
},
// Global variables to enable
globals: {
// Define global variables
myGlobal: true,
},
// RegExp validation rules
regexp: {
// Override RegExp related rules
},
// PNPM specific rules
pnpm: {
yaml: {}, // YAML config for PNPM
json: {}, // JSON config for PNPM
},
// Patterns to ignore
ignores: [
// Add files/directories to ignore
'dist',
'.cache',
],
});
Feature Flags
The second parameter controls which features to enable:
Option | Default | Description |
---|---|---|
biome | false | Enable Biome formatting integration |
markdown | true | Enable Markdown linting |
vue | auto | Enable Vue support |
unocss | auto | Enable UnoCSS support |
typescript | auto | Enable TypeScript support |
react | auto | Enable React support |
node | true | Enable Node.js specific rules |
prettier | true | Enable Prettier formatting |
pnpm | false | Enable PNPM specific rules see |
test | auto | Enable testing rules |
Note: When
biome
is enabled, it will automatically disable certain ESLint rules that conflict with Biome's rules. If using global formatting, it will runbiome format
on your files.
๐ง Biome Configuration
You can extend the default Biome configuration by creating a biome.json
file in your project root:
{
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["node_modules/@estjs/eslint-config/biome.json"],
"organizeImports": {
"enabled": true
},
"linter": {
"rules": {
// Your custom rules here
}
}
}
When biome
is enabled and global formatting is active, biome format
will run on your files. The configuration is merged with any Biome configuration found in your project.
๐ Additional Features
The config includes several additional features that are automatically applied:
- Comments: Rules for properly formatting comments
- Sort Keys: Automatic sorting of object keys
- JSONC: Support for JSON with comments
- Sort Package JSON: Automatic organization of package.json files
- Sort TSConfig: Automatic organization of tsconfig.json files
- YAML: Support for YAML files
- RegExp: Validation for regular expressions
๐ Examples
TypeScript + Vue 3 Project
// eslint.config.js
import { estjs } from '@estjs/eslint-config';
export default estjs(); // Auto-detects Vue and TypeScript
React + Node.js Project
// eslint.config.js
import { estjs } from '@estjs/eslint-config';
export default estjs({
javascript: {
'no-console': 'warn',
},
globals: {
React: true,
},
}); // Auto-detects React and Node.js
Project with Biome for Formatting
// eslint.config.js
import { estjs } from '@estjs/eslint-config';
export default estjs(
{
// Your rule overrides
},
{
biome: true, // Enable Biome
prettier: false, // Disable Prettier (optional as Biome will be used)
},
);
PNPM Workspace
// eslint.config.js
import { estjs } from '@estjs/eslint-config';
export default estjs(
{
// Your rule overrides
pnpm: {
yaml: {
// YAML-specific configs for pnpm-workspace.yaml
},
},
},
{
pnpm: true, // Enable PNPM-specific rules
},
);
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
6 months ago
9 months ago
9 months ago
6 months ago
6 months ago
5 months ago
6 months ago
7 months ago
10 months ago
11 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago