npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-unicode-typography

v1.0.1

Published

ESLint plugin to enforce use of unicode characaters for typography

Readme

eslint-plugin-unicode-typography

ESLint plugin to enforce proper Unicode typography characters instead of ASCII approximations. This is similar to smartquotes.js or eslint-plugin-prefer-smart-quotes but includes characters other than just quotes and more granular configuration options.

Why?

Using proper Unicode characters instead of ASCII approximations makes your text more readable and professional:

| Instead of | Use | |------------|-----| | ... | (ellipsis) | | -- | (em dash) | | - | (en dash, see below) | | "quoted" | “quoted” (smart quotes) | | 'quoted' | ‘quoted’ (smart quotes) | | don't | don’t (smart apostrophe) | | 5' 6" | 5′ 6″ (prime symbols) |

Note: The en dash rule specifically looks for a space on either side. Words like well-known and red-tailed should use a hyphen but something like 9am–5pm should use an en dash.

Installation

npm install eslint-plugin-unicode-typography --save-dev
# or
pnpm add -D eslint-plugin-unicode-typography
# or
yarn add -D eslint-plugin-unicode-typography

Usage

Flat Config (ESLint 9+)

// eslint.config.js
import unicodeTypography from 'eslint-plugin-unicode-typography';

export default [
  // Use the recommended config
  unicodeTypography.configs.recommended,

  // Or configure manually
  {
    plugins: {
      'unicode-typography': unicodeTypography,
    },
    rules: {
      'unicode-typography/prefer-unicode': 'warn',
    },
  },
];

Legacy Config (ESLint 7-8)

{
  "plugins": ["unicode-typography"],
  "rules": {
    "unicode-typography/prefer-unicode": "warn"
  }
}

Rule: prefer-unicode

Enforces the use of proper Unicode typography characters.

Default Behavior

By default, the rule checks:

  • JSX children (text inside JSX elements) - all elements
  • JSX attributes - only title, alt, label, aria-label, aria-describedby

By default, the rule does NOT check:

  • String literals - disabled by default
  • Template literals - disabled by default

Options

{
  "unicode-typography/prefer-unicode": ["warn", {
    // Replacement toggles (all true by default)
    "ellipsis": true,      // ... → …
    "emdash": true,        // -- → —
    "endash": true,        // " - " → –
    "quotes": true,        // "" '' → "" ''
    "apostrophes": true,   // ' → ' (in contractions)
    "primes": true,        // ' " → ′ ″ (after numbers)

    // Scope options (trinary: true | false | object)
    "checkStringLiterals": false,
    "checkTemplateLiterals": false,
    "checkAttributes": { "onlyAttributes": ["title", "alt", "label", "aria-label", "aria-describedby"] },
    "checkChildren": true
  }]
}

Scope Options

Each scope option accepts three types of values:

checkStringLiterals

Controls checking of string literals in JavaScript/TypeScript.

// Disable (default)
"checkStringLiterals": false

// Enable for all string literals
"checkStringLiterals": true

// Enable only inside specific function calls (e.g., i18n)
"checkStringLiterals": { "onlyFunctions": ["t", "msg", "i18n.t"] }

checkTemplateLiterals

Controls checking of template literals.

// Disable (default)
"checkTemplateLiterals": false

// Enable for all template literals (tagged and untagged)
"checkTemplateLiterals": true

// Enable for specific tagged templates only
"checkTemplateLiterals": { "tags": ["t", "msg"] }

// Enable for untagged templates only
"checkTemplateLiterals": { "untagged": true }

// Enable for both specific tags and untagged
"checkTemplateLiterals": { "tags": ["t"], "untagged": true }

checkAttributes

Controls checking of JSX attribute values.

// Disable
"checkAttributes": false

// Enable for all attributes
"checkAttributes": true

// Enable for specific attributes only (default)
"checkAttributes": { "onlyAttributes": ["title", "alt", "label", "aria-label", "aria-describedby"] }

checkChildren

Controls checking of JSX text content.

// Disable
"checkChildren": false

// Enable for all elements (default)
"checkChildren": true

// Enable for specific elements/components only
"checkChildren": { "onlyComponents": ["p", "span", "Text", "Label"] }

Auto-fix

This rule provides auto-fix support. Run ESLint with --fix to automatically replace ASCII characters with their Unicode equivalents:

eslint --fix src/

Related

License

MIT