Registry / web-framework / prettier-plugin-nativewind

prettier-plugin-nativewind

JSON →
library0.2.3jsnpmunverified

A deprecated Prettier plugin for sorting Tailwind CSS classes in NativeWind projects. Version 0.2.3 is the final release. This fork added support for custom props, function calls, and tagged template literals beyond what upstream prettier-plugin-tailwindcss offered. However, as of prettier-plugin-tailwindcss v0.3.0 and later, all these features are natively supported, making this plugin obsolete. Users should migrate to the official plugin. No further updates are planned.

npm install prettier-plugin-nativewind
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-NA
P
prettier-plugin-nativewind
web-frameworkjavascriptv0.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (plugin)
Add to prettier config as a plugin: module.exports = { plugins: ['prettier-plugin-nativewind'] }
import or require the plugin directly in code – it is a Prettier plugin, not a programmatic API.
No JavaScript import needed; the plugin is automatically detected by Prettier when listed in config.

Shows how to configure the plugin with custom props and function calls, and demonstrates class sorting.

// prettier.config.js module.exports = { plugins: ['prettier-plugin-nativewind'], tailwindCustomProps: ['className', 'containerClassName'], tailwindCustomFunctions: ['cva'], tailwindCustomTaggedTemplates: ['tw'] }; // Input const el = <div className="px-4 py-2 bg-blue-500 text-white"></div>; // Output (sorted) const el = <div className="bg-blue-500 px-4 py-2 text-white"></div>;
Debug
Known issues
deprecatedPackage is deprecated; use prettier-plugin-tailwindcss instead.
fix
Replace prettier-plugin-nativewind with prettier-plugin-tailwindcss in devDependencies and remove any custom configuration specific to this fork (e.g., tailwindCustomProps).
affects: >=0.2.3
gotchaPeer dependencies include many optional peer deps like @ianvs/prettier-plugin-sort-imports. Installing them may cause conflicts if not needed.
fix
Only install peer deps that are actually required by your project. The plugin works without them if you don't use those features.
affects: >=0.1.0
gotchaThe plugin uses regular expressions for custom props/functions; starting a string with '^' enables regex mode. This can lead to unexpected matches if not used carefully.
fix
Use exact string matches unless you specifically need regex. For example, '^[a-z]+ClassName$' matches any prop ending with 'ClassName'.
affects: >=0.2.0
breakingIn v0.2.0, the option names changed: tailwindCustomProps replaced a previous undocumented option.
fix
Update config to use the new option names if upgrading from v0.1.x.
affects: >=0.2.0 <0.3.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-nativewind'
The package is not installed or is missing from node_modules.
fix
Run npm install prettier-plugin-nativewind --save-dev or yarn add -D prettier-plugin-nativewind.
Error: Invalid plugin options. Expected an array of strings for `tailwindCustomProps`.
Option tailwindCustomProps (or similar) is not an array of strings.
fix
Ensure the option is an array, e.g., tailwindCustomProps: ['className'].
TypeError: Cannot destructure property 'tailwindConfig' of 'undefined' or 'null'.
The plugin cannot find a Tailwind CSS configuration file or the config is invalid.
fix
Ensure you have a tailwind.config.js or tailwind.config.ts in your project root, or configure the tailwindConfig option in Prettier config.
Upgrade
Version history
0.2.3latest on npm
Audit
Dependencies
prettierrequiredpeer dependency – the plugin requires Prettier >=2.2.0 to function.
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-nativewind — npm install prettier-plugin-nativewind · libregistry