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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mewhhaha/eslint-plugin-simple-tailwind

v0.0.12

Published

A simple ESLint plugin for Tailwind CSS.

Downloads

458

Readme

@mewhhaha/eslint-plugin-simple-tailwind

A simple ESLint plugin for Tailwind CSS.

Installation

pnpm add @mewhhaha/eslint-plugin-simple-tailwind

Usage

import tseslint from "typescript-eslint";
import plugin, { loadTailwind } from "@mewhhaha/eslint-plugin-simple-tailwind";

const tw = await loadTailwind("./path/to/tailwind.css");

export default [plugin(tw).configs.recommended];

Rules

Here are the rules that are available in this plugin:

  • formatting
  • duplicate
  • unknown

formatting

Adds a warning and a code action to format the className argument to a predictable style. Applies if it's using a template literal string in attributes className or class and if the callee is cn, cx, className, clsx, or classNames. This can be changed in the settings.

  • Sorts the classes by the tailwind order.
  • Formats the classes to be on multiple lines.
  • Breaks the line after the printWidth if it's greater than the printWidth.
  • Removes duplicate classes.
// before
<div className={`p-4 focus:p-5 focus:hover:p-6`}></div>

// after
<div className={`
     p-4

     focus:p-5

     hover:p-6
     `}></div>

duplicate

Adds an error if the className argument has duplicate classes.

unknown

Adds a warning if the className argument has unknown classes.

prefer-multiline

Adds a warning if the className argument is a string literal, and suggests to use a template literal string instead.

Settings

  • attributes: The attributes to check for the className argument. (default: ["className", "class"])
  • callees: The callees to check for the className argument. (default: ["cn", "cx", "className", "clsx", "classNames"])
  • printWidth: The print width to format the className argument. (default: 80)
export default [
  plugin.configs.recommended,
  {
    settings: {
      simpletailwindcss: {
        attributes: ["className", "class"],
        callees: ["cn", "cx", "className", "clsx", "classNames"],
        printWidth: 80,
      },
    },
  },
];