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-local-i18n

v0.2.2

Published

An ESLint plugin to enforce internationalization (i18n) best practices and disable hardcoded strings in your codebase.

Downloads

455

Readme

eslint-plugin-local-i18n

An ESLint plugin that helps enforce internationalization (i18n) best practices by detecting hardcoded strings in your JavaScript, TypeScript, and JSX code.

Features

  • 🌐 Detect Hardcoded Strings: Automatically identifies strings that should be internationalized
  • ⚙️ Configurable: Flexible rules and exceptions to match your project needs
  • 🎯 Attribute Checking: Validates text in JSX attributes like label, title, placeholder, and more
  • 🚫 Smart Ignoring: Support for regex patterns and component-specific ignoring
  • 📏 Minimum Length: Optional threshold to ignore very short strings

Installation

npm install --save-dev eslint-plugin-local-i18n

Or using your preferred package manager:

pnpm add -D eslint-plugin-local-i18n
yarn add --dev eslint-plugin-local-i18n

Configuration

Add the plugin to your ESLint configuration in eslint.config.js:

import localI18n from 'eslint-plugin-local-i18n';

export default defineConfig([
  {
    // React component files
    files: ['**/*.{js,jsx,ts,tsx}'],
    ignores: ['eslint.config.js', 'babel.config.js'],
    plugins: {'local-i18n': localI18n},
    rules: {
      'local-i18n/no-hardcoded-strings': [
        'error',
        {
          // optional config (defaults shown)
          attributes: [
            'label',
            'title',
            'placeholder',
            'alt',
            'aria-label',
            'accessibilityLabel',
            'accessibilityHint',
            'header',
            'headerTitle',
            'message',
          ],
          ignore: ['^https?://', '^[A-Z0-9_]+$'], // regex strings to allow
          ignoreComponents: ['Icon', 'Trans'], // skip these components' children
          minLength: 2, // ignore very short strings
        },
      ],
    },
  },
]);

Rules

no-hardcoded-strings

Detects hardcoded strings that should be internationalized.

Options

  • attributes (array of strings): JSX attribute names to check for hardcoded strings
    • Default: ['label', 'title', 'placeholder', 'alt', 'aria-label']
  • ignore (array of regex strings): Patterns to exclude from the rule
    • Example: ['^https?://', '^[A-Z0-9_]+$'] - ignores URLs and constant-like strings
  • ignoreComponents (array of strings): Component names whose children should not be checked
    • Example: ['Icon', 'Trans'] - useful for components that typically don't need translation
  • minLength (number): Minimum string length to trigger the rule
    • Default: 1
    • Useful to ignore very short strings like single characters

License

See LICENSE file for details.

Tests

Tests are written using RuleTester. To run the tests, use the following command:

pnpm test

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.