π Auto-chunking ESLint runner that updates cache incrementally based on your ESLint config.
- π Incremental Cache Updates: Updates ESLint cache after each successful chunk, preventing loss of progress on failures
- π Smart File Discovery: Automatically discovers files based on your ESLint configuration and ignore patterns
- β‘ Configurable Chunk Sizes: Customize chunk size based on your system's capabilities
- π οΈ Auto-fixing Support: Apply ESLint fixes incrementally with configurable fix types
- π Detailed Progress Reporting: Real-time progress updates with statistics
- πͺ Error Recovery: Continue processing remaining chunks even if some fail
- π― TypeScript Support: Written in TypeScript with full type definitions
- π¨ Beautiful CLI: Colorful, informative command-line interface
- βοΈ Highly Configurable: Extensive configuration options for all use cases
npm install -g eslint-plugin-chunkylint
Or use locally in your project:
npm install --save-dev eslint-plugin-chunkylint
You can also run it directly with npx without installation:
npx eslint-plugin-chunkylint # New canonical package name
npx chunkylint # Short alias (legacy bin retained)
npx eslint-chunker # Legacy package/command (will remain as alias)
npx chunky-lint # Hyphenated alias
Action | Command |
---|---|
Install (dev) | npm i -D eslint-plugin-chunkylint |
Global install | npm i -g eslint-plugin-chunkylint |
Import | import { ESLintChunker } from 'eslint-plugin-chunkylint'; |
CLI run | npx eslint-plugin-chunkylint |
# Basic usage with default settings (200 files per chunk)
chunkylint
# Or use the legacy command name (still works)
eslint-chunker
# Or use the hyphenated alias
chunky-lint
# Specify chunk size and enable fixing
chunkylint --size 150 --fix
# Use custom cache location and enable verbose output
chunkylint --cache-location .cache/.eslintcache --verbose
# Include custom patterns and continue on errors
chunkylint --include "**/*.{js,ts,tsx}" --continue-on-error
import { ESLintChunker } from "eslint-plugin-chunkylint";
const chunker = new ESLintChunker({
size: 150,
cacheLocation: ".cache/.eslintcache",
fix: true,
verbose: true,
continueOnError: true,
});
const stats = await chunker.run((processed, total, currentChunk) => {
console.log(`Progress: ${processed}/${total} chunks`);
if (currentChunk) {
console.log(`Current chunk: ${currentChunk.files.length} files`);
}
});
console.log(
`β
Processed ${stats.totalFiles} files in ${stats.totalChunks} chunks`
);
console.log(`β±οΈ Total time: ${stats.totalTime}ms`);
console.log(`π§ Files fixed: ${stats.filesFixed}`);
Option | Description | Default |
---|---|---|
-c, --config <path> |
Path to ESLint config file | Auto-detected |
-s, --size <number> |
Files per chunk | 200 |
--cache-location <path> |
ESLint cache file location | .eslintcache |
--max-workers <n> |
ESLint max workers ("auto", "off", or number) | "off" |
--continue-on-error |
Do not exit on first chunk failure | false |
--fix |
Apply ESLint fixes | false |
--fix-types <types> |
Types of fixes to apply (comma-separated) | All types |
--no-warn-ignored |
Do not warn about ignored files | Warn enabled |
--include <patterns> |
Include patterns (comma-separated) | Auto-detected |
--ignore <patterns> |
Additional ignore patterns (comma-separated) | Auto-detected |
--cwd <path> |
Working directory | process.cwd() |
-v, --verbose |
Enable verbose output | false |
--concurrency <n> |
Number of chunks to process concurrently | 1 |
--config-file <path> |
Path to chunkyLint config file | Auto-detected |
ESLint Chunker supports configuration files to avoid passing many command-line flags. Create a config file in your project root:
// .chunkylint.json
{
"size": 10,
"concurrency": 2,
"verbose": true,
"cacheLocation": ".chunky-cache",
"fix": false,
"continueOnError": true,
"include": ["src/**/*.ts"],
"ignore": ["**/*.test.ts"]
}
// .chunkylint.ts - TypeScript config with full type safety
import type { ChunkyLintConfig } from "eslint-plugin-chunkylint";
const config: ChunkyLintConfig = {
size: 10,
concurrency: 2,
verbose: true,
cacheLocation: ".chunky-cache",
fix: false,
continueOnError: true,
include: ["src/**/*.ts"],
ignore: ["**/*.test.ts"],
};
export default config;
// .chunkylint.js - JavaScript config
module.exports = {
size: 10,
concurrency: 2,
verbose: true,
cacheLocation: ".chunky-cache",
fix: false,
continueOnError: true,
include: ["src/**/*.ts"],
ignore: ["**/*.test.ts"],
};
Supported config files (in order of precedence):
.chunkylint.ts
- TypeScript config.chunkylint.js
- JavaScript config.chunkylint.mjs
- ES Module config.chunkylint.json
- JSON configchunkylint.config.*
- Alternative naming
CLI options always override config file settings.
See the Configuration Guide for detailed examples and advanced usage.
You can run ESLint Chunker using any of these commands:
npx eslint-chunker # Original command
npx chunkylint # Short alias
npx chunky-lint # Hyphenated alias
interface ChunkerOptions {
/** Path to ESLint config file */
config?: string;
/** Number of files per chunk */
size?: number;
/** Path to ESLint cache file */
cacheLocation?: string;
/** Number of ESLint worker processes */
maxWorkers?: number | "auto" | "off";
/** Continue processing even if a chunk fails */
continueOnError?: boolean;
/** Apply fixes to files */
fix?: boolean;
/** Types of fixes to apply */
fixTypes?: Array<"directive" | "problem" | "suggestion" | "layout">;
/** Show warnings for ignored files */
warnIgnored?: boolean;
/** Custom include patterns */
include?: string[];
/** Custom ignore patterns */
ignore?: string[];
/** Working directory */
cwd?: string;
/** Enable verbose output */
verbose?: boolean;
/** Concurrency for processing chunks */
concurrency?: number;
}
ESLint Chunker provides detailed statistics about the processing:
interface ChunkingStats {
/** Total number of files discovered */
totalFiles: number;
/** Number of chunks processed */
totalChunks: number;
/** Total processing time in milliseconds */
totalTime: number;
/** Number of files with errors */
filesWithErrors: number;
/** Number of files with warnings */
filesWithWarnings: number;
/** Number of files that were fixed */
filesFixed: number;
/** Number of failed chunks */
failedChunks: number;
}
Perfect for monorepos or large projects where ESLint might run out of memory or take too long:
chunkylint --size 100 --max-workers auto --continue-on-error
Ideal for continuous integration where you want to ensure progress isn't lost:
chunkylint --cache-location /tmp/.eslintcache --verbose --continue-on-error
Great for development with auto-fixing enabled:
chunkylint --fix --fix-types problem,suggestion --size 50
Useful when gradually fixing linting issues in legacy codebases:
chunkylint --continue-on-error --fix --fix-types problem
- File Discovery: Uses your ESLint configuration to discover files that should be linted
- Chunking: Splits the discovered files into manageable chunks
- Sequential Processing: Processes each chunk with ESLint, updating the cache after each successful chunk
- Error Handling: Optionally continues processing even if some chunks fail
- Statistics: Provides detailed statistics about the entire operation
Contributions are welcome! Please feel free to submit a Pull Request.
# Clone the repository
git clone https://github.com/Nick2bad4u/eslint-plugin-chunkyLint.git
cd eslint-plugin-chunkyLint
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
# Type checking
npm run type-check
# Build and test the CLI locally
npm run build
node dist/bin/eslint-chunker.js --help
# Or use the development command (no build required)
npm run dev -- --help
# Test with different aliases
npm run dev -- --size 50 --verbose
MIT Β© Nick2bad4u
- ESLint - The amazing linting tool this package enhances
- Commander.js - Excellent CLI framework
- fast-glob - Fast and efficient file globbing
- chalk - Beautiful terminal colors
Made with β€οΈ for developers dealing with large codebases