# max-len

Rule `eslint/max-len`. Enforce a maximum line length

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 10.6M weekly downloads of presets that enable it
- Trend: +3.0% last quarter
- Rank: #874 by reach, #1548 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `max-len` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/max-len) |

## Code examples

### Incorrect: the rule reports this

```js
var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };
```

```js
var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } };
```

```js
/**
 * This is a comment that violates the maximum line length we have specified
**/
```

### Correct: the rule accepts this

```js
var foo = {
  "bar": "This is a bar.",
  "baz": { "qux": "This is a qux" },
  "easier": "to read"
};
```

```js
var foo = {
    "bar": "This is a bar.",
    "baz": { "qux": "This is a qux" }
};
```

```js
/**
 * This is a really really really really really really really really really long comment
**/
```

Examples from the ESLint documentation.

## Enable it

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Google](https://lintradar.dev/presets/google.md) | ESLint | `eslint-config-google` | 60 | 646.4K | +18.9% |

## Related rules

- [vue/max-len](https://lintradar.dev/rules/vue/max-len.md): Enforce a maximum line length in `.vue` files
- [eslint/no-console](https://lintradar.dev/rules/eslint/no-console.md): Disallow the use of `console`
- [eslint/no-shadow](https://lintradar.dev/rules/eslint/no-shadow.md): Disallow variable declarations from shadowing variables declared in the outer scope
- [eslint/no-empty-function](https://lintradar.dev/rules/eslint/no-empty-function.md): Disallow empty functions
- [eslint/no-nested-ternary](https://lintradar.dev/rules/eslint/no-nested-ternary.md): Disallow nested ternary expressions
- [eslint/max-classes-per-file](https://lintradar.dev/rules/eslint/max-classes-per-file.md): Enforce a maximum number of classes per file

---

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