Registry / web-framework / prettier-plugin-rational-order

prettier-plugin-rational-order

JSON →
library1.0.3jsnpmunverified

Prettier plugin that sorts CSS property declarations into a rational order (positioning, box model, typography, visual, animation, misc). Version 1.0.3 is the latest stable release (no further releases since initial). It groups related properties together making styles more readable. Alternative to stylelint-based ordering like stylelint-config-rational-order, but works as a formatter instead of a linter. Supports CSS, SCSS, and Sass. Requires Prettier >=2.3.

npm install prettier-plugin-rational-order
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-RA
P
prettier-plugin-rational-order
web-frameworkjavascriptv1.0.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.

Plugin
// Plugin auto-loads when installed. No explicit import needed.
import 'prettier-plugin-rational-order'
Prettier automatically discovers plugins with the 'prettier-plugin-' prefix. No import statement is needed.
.prettierrc plugins
{ "plugins": ["./node_modules/prettier-plugin-rational-order"] }
{ "plugins": ["prettier-plugin-rational-order"] }
Prettier expects the plugin path relative to the config file. Using just the package name may work in some setups but the explicit path is more reliable.
CLI usage
npx prettier --write --plugin=prettier-plugin-rational-order '**/*.css'
npx prettier --plugin=prettier-plugin-rational-order --write '**/*.css'
Order of arguments matters in some shells; --plugin should come before --write.

Install the plugin, configure Prettier, create a CSS file with mixed order, run prettier, and view the reordered output.

npm install --save-dev prettier prettier-plugin-rational-order echo '{ "plugins": ["./node_modules/prettier-plugin-rational-order"] }' > .prettierrc cat <<EOF > test.css .declaration-order { color: #333; margin: 0; position: absolute; padding: 10px; font-size: 16px; } EOF npx prettier --write test.css cat test.css # Output will be grouped by rational order.
Debug
Known issues
gotchaPlugin auto-loads only if installed in the same project as Prettier. If installed globally or in a monorepo root, Prettier may not find it.
fix
Ensure the plugin is installed as a local devDependency, or specify the full path in the plugins array.
affects: >=0.0.0
gotchaThe plugin may reorder properties in an unexpected way for files with complex selectors or nested rules. Always review changes before committing.
fix
Use prettier --check to verify ordering without overwriting, and manually adjust if needed.
affects: >=0.0.0
gotchaDoes not support CSS-in-JS or styled-components by default; only works with .css, .scss, .sass files.
fix
Use the appropriate Prettier config to associate the plugin with those file types.
affects: >=0.0.0
deprecatedThis plugin is no longer actively maintained. Future CSS property additions may not be sorted correctly.
fix
Consider using stylelint-config-rational-order or a more actively maintained alternative.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-rational-order'
Plugin is not installed or not in node_modules.
fix
Run npm install --save-dev prettier-plugin-rational-order
Couldn't resolve plugin "prettier-plugin-rational-order"
Prettier cannot find the plugin despite being installed, often due to wrong path in .prettierrc.
fix
Set plugins to the relative path: 'plugins': ['./node_modules/prettier-plugin-rational-order']
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
prettierrequiredPeer dependency; the plugin requires Prettier to be installed and runs as a Prettier plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-rational-order — npm install prettier-plugin-rational-order · libregistry