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-sitecore-jss

v1.1.6

Published

An ESLint plugin to enforce correct usage of Sitecore JSS components

Readme

ESLint Plugin for Sitecore JSS

npm version License: MIT

A custom ESLint plugin to enforce best practices when using Sitecore JSS components in a Next.js project. This plugin helps ensure correct usage of components like Text, RichText, Image, Link, and File from @sitecore-jss/sitecore-jss-nextjs.


🚀 Features

  • Prevents raw JSX usage for Sitecore fields
  • Suggests correct Sitecore JSS components automatically
  • Supports auto-fixing with --fix
  • Preserves HTML/JSX attributes during auto-fix (v1.1.6+)
  • Prevents invalid nested <p> tags (v1.1.5+)
  • Includes multiple individual rules
  • Ability to enable all rules at once

📦 Installation

npm install --save-dev eslint-plugin-sitecore-jss

or with Yarn:

yarn add -D eslint-plugin-sitecore-jss

🛠 Usage

Update your .eslintrc.json or .eslintrc.js:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "plugins": ["sitecore-jss"],
  "rules": {
    "sitecore-jss/enforce-text-component": "warn",
    "sitecore-jss/enforce-richtext-component": "warn",
    "sitecore-jss/enforce-image-component": "warn",
    "sitecore-jss/enforce-link-component": "warn",
    "sitecore-jss/enforce-file-component": "warn"
  }
}

Alternatively, you can enable all rules with:

{
  "extends": ["plugin:sitecore-jss/all"]
}

📜 Rules

Enforce Correct Usage of Sitecore JSS Components

This plugin includes the following rules:

enforce-text-component

Ensures that Field<string> and TextField are wrapped with <Text>.

Incorrect:

<p>{props.fields.title.value}</p>

Correct:

<Text field={props.fields.title} tag="p" />

enforce-richtext-component

Ensures that RichTextField is wrapped with <RichText>.

Incorrect:

<div className="rich-text" id="content">
  {props.fields.body.value}
</div>

Correct (auto-fixed):

<RichText
  field={props.fields.body}
  tag="div"
  className="rich-text"
  id="content"
/>

Note: As of v1.1.6, all HTML/JSX attributes (className, id, style, data-*, etc.) are automatically preserved during auto-fix!

enforce-image-component

Ensures that ImageField is used with <Image> instead of <img>.

Incorrect:

<img
  src={props.fields.image.value.src}
  className="hero-image"
  alt="Hero"
  loading="lazy"
/>

Correct (auto-fixed):

<Image
  field={props.fields.image}
  className="hero-image"
  alt="Hero"
  loading="lazy"
/>

Note: The src attribute is automatically removed (replaced by field), but all other attributes are preserved!

enforce-link-component

Ensures that LinkField is used with <Link> instead of <a>.

Incorrect:

<a
  href={props.fields.externalLink.value.href}
  className="btn btn-primary"
  target="_blank"
>
  Click Here
</a>

Correct (auto-fixed):

<Link
  field={props.fields.externalLink}
  className="btn btn-primary"
  target="_blank"
>
  Click Here
</Link>

Note: The href attribute is automatically removed (replaced by field), but all other attributes are preserved!

enforce-file-component

Ensures that FileField is used with <File> instead of <a>.

Incorrect:

<a href={props.fields.file.value.src}>{props.fields.file.value.title}</a>

Correct:

<File field={props.fields.file} />

🤝 Contributing

Feel free to submit issues or PRs to improve this plugin.


📜 License

MIT