Consistency
max-component-lines
Flag single-file components exceeding a configurable line count.
Warns when a component file grows beyond the configured line ceiling. Long components are the asymptote of AI iterative editing — easier to ask the agent to add than to extract — and the rule keeps the codebase decomposable.
Behavior
- Fixable: No.
- Suggestions: No.
Options
["warn", {
"maxLines": 300,
"ignoreComments": false,
"ignoreBlankLines": false
}]Examples
Bad:
// 600-line single-file componentGood:
// Decomposed into focused sub-componentsRelated rules
no-duplicate-class-stringsFlag identical className strings repeated 3+ times in a file.max-tailwind-classesFlag elements with too many Tailwind utility classes.no-inline-stylesDisallow inline style attributes; use Tailwind utility classes.
Use it
Enable max-component-lines in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/max-component-lines': 'error',
},
},
];Found a false positive? Report it on GitHub →