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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rtl-shield

v0.1.0

Published

ESLint plugin to enforce CSS Logical Properties for robust RTL support

Readme

🛡️ RTL Shield

Automated ESLint guardrails for robust RTL support in the GCC market.

npm version License: MIT


⚠️ The Problem

In the Middle East and North Africa (MENA) region, Arabic and other RTL (Right-to-Left) languages represent a massive market opportunity. However, many engineering teams still build with physical CSS properties like left, right, marginLeft, and paddingRight—properties that fundamentally break bidirectional layouts.

Why This Matters

  • Physical properties are direction-specific: left: 10px means "move 10px from the left edge"—in RTL, this is visually incorrect.
  • Manual reviews are error-prone: CSS property mapping is tedious and easy to overlook in code reviews.
  • Scale is impossible: As codebases grow, maintaining RTL consistency becomes exponentially harder without automation.
  • Lost revenue: Poorly localized experiences drive users away from your platform.

RTL Shield solves this at the source—by enforcing logical CSS properties during development, ensuring your application is RTL-ready before it ships.


✨ Key Features

🎨 CSS-in-JS & Style Objects

Full support for React, Next.js, and JavaScript style objects (Emotion, Styled Components, inline styles, etc.)

  • Automatically detects and fixes physical properties
  • Works with object literals in JavaScript
  • Smart autofix saves hundreds of manual hours

🌬️ Tailwind CSS Support

Seamlessly handles Tailwind utility classes in className and class attributes

  • Converts ml-4ms-4, text-lefttext-start
  • Processes multiple classes in a single string
  • Fully compatible with Next.js and modern React projects

🔄 Comprehensive Property Mapping

Covers the full spectrum of directional CSS:

  • Margins & Padding: marginLeftmarginInlineStart
  • Positioning: leftinsetInlineStart, rightinsetInlineEnd
  • Borders: All variants—borderLeft, borderLeftWidth, borderLeftColor, etc.
  • Border Radius: Complex radius properties like borderTopLeftRadiusborderStartStartRadius

Smart Autofix

One command to fix your entire codebase:

eslint --fix

No manual intervention required—just commit and deploy.

🎯 Zero Configuration

The recommended preset works out-of-the-box with sensible defaults.


📦 Installation

Step 1: Install the Plugin

npm install --save-dev eslint-plugin-rtl-shield
# or
yarn add --dev eslint-plugin-rtl-shield
# or
pnpm add --save-dev eslint-plugin-rtl-shield

Step 2: Configure ESLint

Add the plugin to your ESLint configuration file (.eslintrc.json, .eslintrc.js, or eslint.config.js):

Using the Recommended Config (Recommended ✅)

{
  "extends": ["plugin:rtl-shield/recommended"]
}

This automatically enables both rules with error-level severity:

  • rtl-shield/prefer-logical-properties — for CSS-in-JS
  • rtl-shield/prefer-logical-tailwindcss — for Tailwind CSS

Manual Configuration

If you prefer granular control:

{
  "plugins": ["rtl-shield"],
  "rules": {
    "rtl-shield/prefer-logical-properties": "error",
    "rtl-shield/prefer-logical-tailwindcss": "error"
  }
}

Step 3: Run ESLint

Lint your project:

eslint .

Auto-fix issues:

eslint --fix .

📊 Showcase: Physical vs. Logical

CSS-in-JS / Style Objects

| Physical (❌ Breaks RTL) | Logical (✅ RTL-Ready) | Use Case | | ------------------------- | ---------------------------- | --------------- | | marginLeft: 16 | marginInlineStart: 16 | Outer spacing | | paddingRight: 8 | paddingInlineEnd: 8 | Inner spacing | | left: 0 | insetInlineStart: 0 | Positioning | | right: 10 | insetInlineEnd: 10 | Positioning | | borderLeftWidth: 2 | borderInlineStartWidth: 2 | Border styling | | borderTopLeftRadius: 12 | borderStartStartRadius: 12 | Rounded corners |

Tailwind CSS

| Physical (❌ Breaks RTL) | Logical (✅ RTL-Ready) | Use Case | | ------------------------ | ---------------------- | ---------------------------- | | ml-4 | ms-4 | Margin start | | mr-8 | me-8 | Margin end | | pl-2 | ps-2 | Padding start | | pr-6 | pe-6 | Padding end | | text-left | text-start | Text alignment | | text-right | text-end | Text alignment | | rounded-tl-lg | rounded-ss-lg | Border radius (top-left) | | rounded-br-md | rounded-ee-md | Border radius (bottom-right) | | left-0 | start-0 | Positioning | | right-10 | end-10 | Positioning |

Before & After Example

Before (Physical Properties):

// ❌ Breaks in Arabic/RTL
const Card = () => (
  <div className="ml-4 p-4 rounded-tl-lg">
    <h1 style={{ paddingLeft: 16, textAlign: "left" }}>Title</h1>
  </div>
);

After (Logical Properties):

// ✅ Works perfectly in RTL
const Card = () => (
  <div className="ms-4 p-4 rounded-ss-lg">
    <h1 style={{ paddingInlineStart: 16, textAlign: "start" }}>Title</h1>
  </div>
);

🌍 Why for the GCC Market?

The GCC region (United Arab Emirates, Saudi Arabia, Qatar, Kuwait, Bahrain, and Oman) represents one of the fastest-growing digital markets:

  • High-value market: GCC users have the highest digital spending in the MENA region
  • Native RTL requirement: Arabic is a constitutional requirement in government and enterprise apps
  • Business critical: Improper RTL support directly impacts user trust and platform adoption
  • Regulatory compliance: Many GCC-based companies must meet localization standards
  • Competitive advantage: Teams that ship proper RTL support get better retention and market share

RTL Shield enables your engineering team to:

  • Ship RTL-ready code from day one
  • Reduce localization QA cycles
  • Avoid expensive refactoring late in the project lifecycle
  • Build products that resonate with users across the MENA region

📋 Rules

prefer-logical-properties

Enforces logical CSS properties in JavaScript style objects, preventing physical properties that break bidirectional layouts.

Type: Suggestion Fixable: Yes ✅

Example:

// ❌ Error
const styles = { marginLeft: 10, borderRightColor: "red" };

// ✅ Correct
const styles = { marginInlineStart: 10, borderInlineEndColor: "red" };

prefer-logical-tailwindcss

Enforces logical Tailwind CSS utility classes in JSX className and class attributes.

Type: Suggestion Fixable: Yes ✅

Example:

// ❌ Error
<div className="ml-4 text-left rounded-tl-lg" />

// ✅ Correct
<div className="ms-4 text-start rounded-ss-lg" />

🚀 Quick Start

# 1. Install
npm install --save-dev eslint-plugin-rtl-shield

# 2. Add to .eslintrc.json
echo '{
  "extends": ["plugin:rtl-shield/recommended"]
}' > .eslintrc.json

# 3. Fix all files
npx eslint --fix .

# 4. Commit and deploy
git add .
git commit -m "chore: enforce RTL-safe logical properties"

📚 Resources


🤝 Contributing

We welcome contributions! Please feel free to open issues or submit pull requests on GitHub.


📄 License

MIT © 2025 Berkin Duz


💡 Support

Have questions or feedback? Open an issue on our GitHub repository.

Built with ❤️ for the GCC market and the broader MENA region.