# max-lines

Rule `eslint/max-lines`. Enforce a maximum number of lines per file

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 584.7K weekly downloads of presets that enable it
- Trend: +4.8% last quarter
- Rank: #1612 by reach, #1521 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `max-lines` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/max-lines) |
| Oxlint | `max-lines` | no | no | plugin `eslint`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines.html) |
| Biome | `style/noExcessiveLinesPerFile` | no | no | group style, since 2.3.12 | [docs](https://biomejs.dev/linter/rules/no-excessive-lines-per-file/) |

## Code examples

### Incorrect: the rule reports this

```js
let a,
    b,
    c;
```

```js
let a,
    b,c;
```

```js
// a comment
let a,
    b,c;
```

### Correct: the rule accepts this

```js
let a,
    b, c;
```

```js
let a, b, c;
```

```js
// a comment
let a, b, c;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "max-lines": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "max-lines": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noExcessiveLinesPerFile": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [sonarjs/max-lines](https://lintradar.dev/rules/sonarjs/max-lines.md): Files should not have too many lines of code
- [eslint/max-depth](https://lintradar.dev/rules/eslint/max-depth.md): Enforce a maximum depth that blocks can be nested
- [eslint/no-invalid-this](https://lintradar.dev/rules/eslint/no-invalid-this.md): Disallow use of `this` in contexts where the value of `this` is `undefined`
- [eslint/max-params](https://lintradar.dev/rules/eslint/max-params.md): Enforce a maximum number of parameters in function definitions
- [eslint/no-implicit-coercion](https://lintradar.dev/rules/eslint/no-implicit-coercion.md): Disallow shorthand type conversions
- [eslint/capitalized-comments](https://lintradar.dev/rules/eslint/capitalized-comments.md): Enforce or disallow capitalization of the first letter of a comment

---

Web page: https://lintradar.dev/rules/eslint/max-lines. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
