1.3.2 ā€¢ Published 1 day ago

eslint-plugin-readable-tailwind v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

GitHub license npm version GitHub issues npm weekly downloads GitHub repo stars GitHub workflow status


ESLint plugin to automatically break up long tailwind class strings into multiple lines for better readability. Also sorts the classes logically, removes unnecessary whitespaces and groups the classes by their modifiers. It works in jsx and html.

Installation

npm install eslint-plugin-readable-tailwind --save-dev

Usage

Flat config

Add readable-tailwind to your flat eslint config:

import eslintPluginReadableTailwind from "eslint-plugin-readable-tailwind";

export default [
  {
    languageOptions: {
      parserOptions: {
        ecmaFeatures: {
          jsx: true
        }
      }
    },
    plugins: {
      "readable-tailwind": eslintPluginReadableTailwind
    },
    rules: {
      // enable all recommended rules to warn
      ...eslintPluginReadableTailwind.configs.warning,
      // enable all recommended rules to error
      ...eslintPluginReadableTailwind.configs.error,

      // or configure rules individually
      "readable-tailwind/multiline": ["warn", { printWidth: 100 }]
    }
  }
];

VSCode

To enable the new flat config format in VSCode, add the following to your .vscode/settings.json:

{
  "eslint.experimental.useFlatConfig": true
}

Legacy config

Add readable-tailwind to your eslint config:

{
  "extends": [
    // enable all recommended rules to warn
    "plugin:readable-tailwind/warning",
    // enable all recommended rules to error
    "plugin:readable-tailwind/error"
  ],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": "latest"
  },
  "plugins": ["readable-tailwind"],
  "rules": {
    // or configure rules individually
    "readable-tailwind/multiline": ["warn", { "printWidth": 100 }]
  }
}

Rules

šŸ’¼ Configurations enabled in.\ āš ļø Configurations set to warn in.\ error Set in the error configuration.\ warning Set in the warning configuration.\ šŸ”§ Automatically fixable by the --fix CLI option.

NameDescriptionšŸ’¼āš ļøšŸ”§
multilineEnforce consistent line wrapping for tailwind classes.errorwarningšŸ”§
no-unnecessary-whitespaceDisallow unnecessary whitespace in tailwind classes.errorwarningšŸ”§
sort-classesEnforce a consistent order for tailwind classes.errorwarningšŸ”§
1.4.0-beta.2

7 days ago

1.4.0-beta.1

11 days ago

1.3.2

11 days ago

1.4.0-beta.0

12 days ago

1.3.1

22 days ago

1.3.0

25 days ago

1.3.0-beta.0

25 days ago

1.2.5

2 months ago

1.2.5-beta.0

2 months ago

1.2.4

2 months ago

1.2.3-beta.0

2 months ago

1.2.3

2 months ago

1.2.2

2 months ago

1.2.1

2 months ago

1.2.0

2 months ago

1.2.0-beta.0

2 months ago

1.1.1

2 months ago

1.1.0

2 months ago

1.1.0-alpha.1

3 months ago

1.1.0-beta.1

3 months ago

1.0.0

3 months ago

0.3.0

4 months ago

0.2.0-beta.2

4 months ago

0.2.0-beta.1

4 months ago

0.2.0

4 months ago

0.2.0-beta.0

4 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago

0.0.17

5 months ago

0.0.18

5 months ago

0.0.12

5 months ago

0.0.13

5 months ago

0.0.14

5 months ago

0.0.15

5 months ago

0.0.16

5 months ago

0.0.10

5 months ago

0.0.11

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.1

5 months ago

0.0.0

5 months ago