# Enable caching
npx eslint . --cache
# Cache location (optional)
npx eslint . --cache --cache-location .eslintcacheAdd to .gitignore:
.eslintcache
// .eslintrc.js
module.exports = {
ignorePatterns: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/*.min.js'
]
}// .eslintrc.js
module.exports = {
plugins: ['a11y'],
extends: ['plugin:a11y/recommended'],
overrides: [
{
files: ['**/*.test.{js,ts,jsx,tsx}'],
rules: {
'a11y/**': 'off' // Skip tests for speed
}
}
]
}Some rules are slower on large files:
// .eslintrc.js
module.exports = {
rules: {
// These can be slow on very large files
'a11y/heading-order': 'warn', // Checks all headings
'a11y/landmark-roles': 'warn' // Checks all landmarks
}
}Use tools like eslint-parallel:
npm install --save-dev eslint-parallel
# Run in parallel
npx eslint-parallel src/Only check changed files:
# Git-based incremental
npx eslint $(git diff --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx|vue)$')Measure ESLint performance:
# Time ESLint execution
time npx eslint . --cache
# Profile with Node
node --prof node_modules/.bin/eslint . --cache- Small project (<100 files): <5 seconds
- Medium project (100-1000 files): 10-30 seconds
- Large project (1000+ files): 30-120 seconds (with cache)
With cache enabled, subsequent runs should be 5-10x faster.
- Fastest execution
- ~30% faster than recommended
- Best for large projects starting out
- Balanced performance
- Standard execution time
- Good for most projects
- Same performance characteristics as recommended
- More errors reported (not slower)
- Start with minimal: Use
plugin:a11y/minimalinitially - Use cache: Always enable
--cacheflag - Limit scope: Use
ignorePatternsto exclude build outputs - Incremental adoption: Check only new/modified files first
- Disable slow rules: Temporarily disable
heading-orderandlandmark-rolesif needed