From 474f71db3f6ea42a9e7fe7c090f1a09bef4a4b9c Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 14 Jun 2023 15:55:15 +0200 Subject: [PATCH] Prettier: Introduce `prettier-plugin-tailwindcss` Which is the official plugin that helps with auto sorting class names https://www.npmjs.com/package/prettier-plugin-tailwindcss The config follows the recommendation from https://github.com/sveltejs/prettier-plugin-svelte#usage-with-tailwind-prettier-plugin --- .prettierrc.json | 2 +- package-lock.json | 82 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/.prettierrc.json b/.prettierrc.json index 34f9bb0ac..33768ed0e 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,7 @@ { "semi": false, "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], "svelteBracketNewLine": false, "htmlWhitespaceSensitivity": "ignore" diff --git a/package-lock.json b/package-lock.json index 2e3a109de..9e447c28c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,7 @@ "node-html-parser": "^6.1.5", "prettier": "^2.8.8", "prettier-plugin-svelte": "^2.10.1", + "prettier-plugin-tailwindcss": "^0.3.0", "read-file": "^0.2.0", "sass": "^1.58.0", "sharp": "^0.30.5", @@ -8576,6 +8577,80 @@ "svelte": "^3.2.0 || ^4.0.0-next.0" } }, + "node_modules/prettier-plugin-tailwindcss": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.3.0.tgz", + "integrity": "sha512-009/Xqdy7UmkcTBpwlq7jsViDqXAYSOMLDrHAdTMlVZOrKfM2o9Ci7EMWTMZ7SkKBFTG04UM9F9iM2+4i6boDA==", + "dev": true, + "engines": { + "node": ">=12.17.0" + }, + "peerDependencies": { + "@ianvs/prettier-plugin-sort-imports": "*", + "@prettier/plugin-pug": "*", + "@shopify/prettier-plugin-liquid": "*", + "@shufo/prettier-plugin-blade": "*", + "@trivago/prettier-plugin-sort-imports": "*", + "prettier": ">=2.2.0", + "prettier-plugin-astro": "*", + "prettier-plugin-css-order": "*", + "prettier-plugin-import-sort": "*", + "prettier-plugin-jsdoc": "*", + "prettier-plugin-marko": "*", + "prettier-plugin-organize-attributes": "*", + "prettier-plugin-organize-imports": "*", + "prettier-plugin-style-order": "*", + "prettier-plugin-svelte": "*", + "prettier-plugin-twig-melody": "*" + }, + "peerDependenciesMeta": { + "@ianvs/prettier-plugin-sort-imports": { + "optional": true + }, + "@prettier/plugin-pug": { + "optional": true + }, + "@shopify/prettier-plugin-liquid": { + "optional": true + }, + "@shufo/prettier-plugin-blade": { + "optional": true + }, + "@trivago/prettier-plugin-sort-imports": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + }, + "prettier-plugin-css-order": { + "optional": true + }, + "prettier-plugin-import-sort": { + "optional": true + }, + "prettier-plugin-jsdoc": { + "optional": true + }, + "prettier-plugin-marko": { + "optional": true + }, + "prettier-plugin-organize-attributes": { + "optional": true + }, + "prettier-plugin-organize-imports": { + "optional": true + }, + "prettier-plugin-style-order": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "prettier-plugin-twig-melody": { + "optional": true + } + } + }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", @@ -18535,6 +18610,13 @@ "dev": true, "requires": {} }, + "prettier-plugin-tailwindcss": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.3.0.tgz", + "integrity": "sha512-009/Xqdy7UmkcTBpwlq7jsViDqXAYSOMLDrHAdTMlVZOrKfM2o9Ci7EMWTMZ7SkKBFTG04UM9F9iM2+4i6boDA==", + "dev": true, + "requires": {} + }, "pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", diff --git a/package.json b/package.json index 350b689ac..49f101af7 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "node-html-parser": "^6.1.5", "prettier": "^2.8.8", "prettier-plugin-svelte": "^2.10.1", + "prettier-plugin-tailwindcss": "^0.3.0", "read-file": "^0.2.0", "sass": "^1.58.0", "sharp": "^0.30.5",