2.0.0 • Published 3 months ago

eslint-plugin-readable-tailwind v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

ESLint plugin to automatically break up long tailwind class strings into multiple lines based on a specified print width or class count. This improves readability and eliminates horizontal scrolling.
In addition it sorts the classes logically, removes unnecessary whitespaces and duplicate classes and groups the classes by their variants. It works in jsx, svelte, vue, and html files.

Installation

npm i -D eslint-plugin-readable-tailwind

Quick start

  1. Follow the Parsers section below to learn how to configure the plugin for your specific requirements.
  2. Read the Rules section to learn about the available rules and how to configure them.
  3. Configure your editor to conveniently auto-fix on save.

Parsers

Depending on the flavor you are using, you may need to install and configure the corresponding parser:

Rules

Two predefined configurations are available that contain the recommended rules:

  • error - will throw an error if the rule is violated
  • warning - will throw a warning if the rule is violated

The following table shows the available rules and if they are enabled by default in the different configurations:

NameDescriptionerrorwarningautofix
multilineEnforce consistent line wrapping for tailwind classes.
no-unnecessary-whitespaceDisallow unnecessary whitespace in tailwind classes.
sort-classesEnforce a consistent order for tailwind classes.
no-duplicate-classesRemove duplicate classes.

Utilities

This plugin works out of the box with most popular tailwind utilities:

In case an utility is not supported or you have built your own, you can change which literals will get linted for each rule. Read the API documentation to learn how to override or extend the default config.

Editor configuration

VSCode

Auto-fix on save

All rules are intended to automatically fix the tailwind classes. If you have installed the VSCode ESLint plugin, you can configure it to automatically fix the classes on save by adding the following options to your .vscode/settings.json:

{
  // enable ESLint to fix tailwind classes on save
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  }
}
2.0.0

3 months ago

2.0.0-beta.4

4 months ago

1.9.1

4 months ago

2.0.0-beta.2

4 months ago

2.0.0-beta.3

4 months ago

2.0.0-beta.1

5 months ago

2.0.0-beta.0

5 months ago

1.9.0

5 months ago

1.8.2

7 months ago

1.8.1

9 months ago

1.8.0

10 months ago

1.6.1

10 months ago

1.6.0

10 months ago

1.7.0

10 months ago

1.5.3

11 months ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0-vue.4

1 year ago

1.5.0

1 year ago

1.5.0-vue.3

1 year ago

1.5.0-vue.2

1 year ago

1.5.0-vue.1

1 year ago

1.5.0-vue.0

1 year ago

1.4.0

1 year ago

1.4.0-beta.4

1 year ago

1.4.0-beta.3

1 year ago

1.4.0-beta.2

1 year ago

1.4.0-beta.1

1 year ago

1.3.2

1 year ago

1.4.0-beta.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.3.0-beta.0

1 year ago

1.2.5

1 year ago

1.2.5-beta.0

1 year ago

1.2.4

1 year ago

1.2.3-beta.0

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.2.0-beta.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.0-alpha.1

1 year ago

1.1.0-beta.1

1 year ago

1.0.0

1 year ago

0.3.0

1 year ago

0.2.0-beta.2

1 year ago

0.2.0-beta.1

1 year ago

0.2.0

1 year ago

0.2.0-beta.0

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago