Registry /
web-framework / prettier-plugin-classnames
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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default export
✓ In Prettier config, add 'prettier-plugin-classnames' to plugins array (e.g., { plugins: ['prettier-plugin-classnames'] })
The plugin does not have a direct JS import for end users; it's loaded by Prettier's plugin system.
require (CommonJS config)
✓ module.exports = { plugins: ['prettier-plugin-classnames'] }
✗ const plugin = require('prettier-plugin-classnames'); module.exports = { plugins: [plugin] }
The plugin string 'prettier-plugin-classnames' is resolved by Prettier; requiring the module directly may cause issues with resolved plugins.
import (ESM config)
✓ export default { plugins: ['prettier-plugin-classnames'] }
✗ import plugin from 'prettier-plugin-classnames'; export default { plugins: [plugin] }
Using the string name is the recommended way; importing the module may not work if the plugin does not export a Prettier plugin object.
Installs the package and configures Prettier to use the plugin. After running prettier, long class name strings will be wrapped.
npm install -D prettier prettier-plugin-classnames
// .prettierrc.json
{
"plugins": ["prettier-plugin-classnames"],
"printWidth": 80
}
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-classnames'
Plugin not installed or not in node_modules.
fixRun 'npm install -D prettier-plugin-classnames'
Error: Cannot resolve plugin prettier-plugin-classnames
Prettier cannot find the plugin in the config.
fixEnsure the package is installed and listed in the 'plugins' array as a string.
TypeError: prettier-plugin-classnames is not a plugin
Using import/require of the module instead of the string name in Prettier config.
fixUse the string 'prettier-plugin-classnames' in the plugins array, e.g., { plugins: ['prettier-plugin-classnames'] } Audit
Dependencies
prettierrequiredpeer dependency: required to use the plugin
@prettier/plugin-oxcoptionaloptional peer for oxc parser support (since v0.9.0)
prettier-plugin-astrooptionaloptional peer for Astro file support
prettier-plugin-svelteoptionaloptional peer for Svelte file support