# string-content

Rule `unicorn/string-content`. Enforce better string content.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2043 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/string-content` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/string-content.md) |

## Code examples

### Incorrect: the rule reports this

```js
const foo = 'Someone\'s coming!';
```

### Correct: the rule accepts this

```js
const foo = 'Someone’s coming!';
```

Examples from the ESLint documentation.

## Enable it

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

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/string-content": "error",
    },
  },
];
```

## Related rules

- [unicorn/require-frontmatter-fields](https://lintradar.dev/rules/unicorn/require-frontmatter-fields.md): Require configured YAML frontmatter fields.
- [unicorn/try-complexity](https://lintradar.dev/rules/unicorn/try-complexity.md): Limit the complexity of `try` blocks.
- [unicorn/prefer-uint8array-hex](https://lintradar.dev/rules/unicorn/prefer-uint8array-hex.md): Prefer `Uint8Array#toHex()` and `Uint8Array.fromHex()` over manual and Buffer hex conversions.
- [unicorn/prefer-uint8array-base64](https://lintradar.dev/rules/unicorn/prefer-uint8array-base64.md): Prefer `Uint8Array#toBase64()` and `Uint8Array.fromBase64()` over legacy base64 conversions and manual postprocessing.
- [unicorn/prefer-temporal](https://lintradar.dev/rules/unicorn/prefer-temporal.md): Prefer `Temporal` over `Date`.
- [unicorn/prefer-short-arrow-method](https://lintradar.dev/rules/unicorn/prefer-short-arrow-method.md): Prefer arrow function properties over methods with a single return.

---

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