1.0.10 • Published 8 months ago

@kalimahapps/eslint-plugin-tailwind v1.0.10

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

✨ Rules

  • @kalimahapps/tailwind/tailwind-sort: Sort tailwind classes in alphabetical order in groups
  • @kalimahapps/tailwind/tailwind-multiline: Break tailwind classes into multiple lines if they exceed the max line length (default: 80)

💽 Installation

PNPM

pnpm add eslint @kalimahapps/eslint-plugin-tailwind -D

NPM

npm install eslint @kalimahapps/eslint-plugin-tailwind -D

🔧 Usage

Add this to your .eslintrc.js file

module.exports = {
 "plugins": ["@kalimahapps/eslint-plugin-tailwind"],
 "rules": {
	"@kalimahapps/tailwind/sort": "warn",
	"@kalimahapps/tailwind/multiline": "warn"
	}
}

The following options can be set to the mutiline rule:

  • maxLen: break classes as soon as the line length is longer than this (and join if the line is smaller)
  • quotesOnNewLine: put the quotes on different lines to the first and last class
module.exports = {
 "plugins": ["@kalimahapps/eslint-plugin-tailwind"],
 "rules": {
	"@kalimahapps/tailwind/sort": "warn",
	"@kalimahapps/tailwind/multiline": [
		"warn",
		{
			"maxLen": 100,
			"quotesOnNewLine": true
		}
	]
 }
}

To enable automatic formatting add this to your .vscode/settings.json file

{
 	"prettier.enable": false,
  	"editor.formatOnSave": false,
	"eslint.codeAction.showDocumentation": {
		"enable": true
	},
	"editor.codeActionsOnSave": {
		"source.fixAll.eslint": true
	},
	"eslint.validate": [
		"javascript",
		"javascriptreact",
		"typescript",
		"typescriptreact"
	],
}

You need to install ESLint extension in VSCode. You can find it here

Please note that the indentation of for the classes in multiline rule will follow the indentation of the parent. i.e. spaces will be used if the parent is using spaces and tabs will be used if the parent is using tabs

Other projects

KalimahApps Eslint Config

Comprehensive eslint rules for vue projects with typescript

Vue Icons

60,000+ SVG icons from popular icon sets that you can add seamlessly to your vue projects

Vue Popper

A tooltip component for Vue 3 based on popper.js

Vite inherit attrs

A vite plugin that adds support for inheritAttrs in vue-setup

License

MIT License

1.0.9

8 months ago

1.0.8

9 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.10

8 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago