# eslint-plugin-curly-quotes

> Enforce the use of curly quotes

Latest version **2.2.0** (published 2026-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-curly-quotes
pnpm add eslint-plugin-curly-quotes
yarn add eslint-plugin-curly-quotes
bun add eslint-plugin-curly-quotes
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-06-13 |
| First published | 2022-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Younes Aassila |
| Maintainers | younesaassila |
| Keywords | eslint, eslintconfig, eslint-plugin, quotes, smart-quotes, curly-quotes |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-curly-quotes
- Repository: https://github.com/younesaassila/eslint-plugin-curly-quotes
- Homepage: https://github.com/younesaassila/eslint-plugin-curly-quotes#readme
- Issues: https://github.com/younesaassila/eslint-plugin-curly-quotes/issues
- npm.io page: https://npm.io/package/eslint-plugin-curly-quotes

## Dependencies (1)

- [regexp.escape](https://npm.io/package/regexp.escape.md) ^2.0.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2026-06-13
- 2.1.0 — 2025-04-04
- 2.0.0 — 2024-12-18
- 1.3.2 — 2024-11-08
- 1.3.1 — 2024-09-19
- 1.3.0 — 2024-04-16
- 1.2.1 — 2024-03-15
- 1.1.0 — 2024-03-03
- 1.0.10 — 2023-10-20
- 1.0.9 — 2023-10-20
- 1.0.8 — 2023-08-09
- 1.0.7 — 2023-08-03
- 1.0.6 — 2023-08-02
- 1.0.5 — 2023-01-10
- 1.0.4 — 2022-04-26
- … 5 more at https://npm.io/package/eslint-plugin-curly-quotes/versions

## README

# eslint-plugin-curly-quotes

<a href="https://github.com/younesaassila/eslint-plugin-curly-quotes/issues">
  <img alt="GitHub issues" src="https://img.shields.io/github/issues/younesaassila/eslint-plugin-curly-quotes">
</a>
<a href="https://github.com/younesaassila/eslint-plugin-curly-quotes/stargazers">
  <img alt="GitHub stars" src="https://img.shields.io/github/stars/younesaassila/eslint-plugin-curly-quotes">
</a>
<a href="https://github.com/younesaassila/eslint-plugin-curly-quotes">
  <img alt="GitHub license" src="https://img.shields.io/github/license/younesaassila/eslint-plugin-curly-quotes">
</a>

Enforce the use of curly quotes and apostrophes.

✨ **Simple** and **customizable** 🔧 Compatible with JavaScript, TypeScript, **JSX** and **Vue**!

**Fixable:** This rule is automatically fixable using the `--fix` flag on the command line.

> **CAUTION**
>
> The plugin replaces quotes used in query selector or stringified JSON strings when using the `--fix` flag on the command line. To ignore a specific string:
>
> Use tagged template literals:
>
> ```js
> String.raw`{"foo": "bar"}`
> ```
>
> Or disable the rule for the line:
>
> ```js
> const data = '{"foo": "bar"}' // eslint-disable-line curly-quotes/no-straight-quotes
> ```

## Installation

Install [ESLint](https://www.npmjs.com/package/eslint):

```sh
npm i --save-dev eslint
```

Install [`eslint-plugin-curly-quotes`](https://www.npmjs.com/package/eslint-plugin-curly-quotes):

```sh
npm i --save-dev eslint-plugin-curly-quotes
```

## Usage

Add `eslint-plugin-curly-quotes` to the `plugins` section of your `eslint.config.mjs` configuration file:

```js
import curlyQuotes from "eslint-plugin-curly-quotes"

export default [
  {
    plugins: {
      "curly-quotes": curlyQuotes,
    },
  },
]
```

Then add the `no-straight-quotes` rule to the `rules` section:

```js
import curlyQuotes from "eslint-plugin-curly-quotes"

export default [
  {
    plugins: {
      "curly-quotes": curlyQuotes,
    },
    rules: {
      "curly-quotes/no-straight-quotes": "warn",
    },
  },
]
```

You may customize the characters used to replace straight quotes:

```js
import curlyQuotes from "eslint-plugin-curly-quotes"

export default [
  {
    plugins: {
      "curly-quotes": curlyQuotes,
    },
    rules: {
      "curly-quotes/no-straight-quotes": [
        "warn",
        {
          "single-opening": "‘",
          "single-closing": "’", // This character is also used to replace apostrophes.
          "double-opening": "“",
          "double-closing": "”",
        },
      ],
    },
  },
]
```

You may also ignore straight quotes in specific JSX/Vue elements, JSX/Vue attributes, function calls, and object properties:

```js
import curlyQuotes from "eslint-plugin-curly-quotes"

export default [
  {
    plugins: {
      "curly-quotes": curlyQuotes,
    },
    rules: {
      "curly-quotes/no-straight-quotes": [
        "warn",
        {
          "single-opening": "‘",
          "single-closing": "’", // This character is also used to replace apostrophes.
          "double-opening": "“",
          "double-closing": "”",
          "ignored-elements": ["script", "style"],
          "ignored-attributes": ["className", "id", "key", "style"],
          "ignored-function-calls": [
            "document.querySelector",
            "document.querySelectorAll",
            "Error",
            "RegExp", // This also ignores regular expression literals.
            "*.exampleFunction", // Wildcards are supported.
            {
              text: "exampleFunction",

              // Whether the function name should be matched case-insensitively.
              // Default is `false`.
              caseInsensitive: true,

              // Whether nested function calls should be ignored. For example,
              // if `exampleFunction` is ignored and `cascades` is set to `true`,
              // then `exampleFunction(anotherFunction("'"))` will also be ignored.
              // If `cascades` is set to `false`, then only `exampleFunction("'")` will be ignored.
              // Default is `true`.
              cascades: false,
            },
          ],
          "ignored-object-properties": [],
        },
      ],
    },
  },
]
```

## Acknowledgements

- Plugin inspired by [`eslint-plugin-prefer-smart-quotes`](https://github.com/totallymoney/eslint-plugin-prefer-smart-quotes)
- Algorithm adapted from [“Ideas for converting straight quotes to curly quotes”](https://stackoverflow.com/questions/509685/ideas-for-converting-straight-quotes-to-curly-quotes) by [ShreevatsaR](https://stackoverflow.com/users/4958/shreevatsar) on Stack Overflow

---
_Source: https://npm.io/package/eslint-plugin-curly-quotes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
