Prettier Plugin for Stylus

raw JSON →
1.0.4 verified Sat Apr 25 auth: no javascript

Prettier plugin that formats Stylus stylesheets using the stylus-supremacy formatting rules. Current stable version is 1.0.4. Requires Prettier v2.0.0+ and ships TypeScript type definitions. Differentiators: provides a wide range of formatting options (e.g., insertion of braces, quotes, parentheses control) via prettierrc, allows seamless integration with Prettier's CLI and editor tooling, and maintains consistency with Stylus community conventions.

error Error: Couldn't resolve plugin "prettier-plugin-stylus-supremacy"
cause Plugin not installed or not in node_modules
fix
Run 'npm install prettier-plugin-stylus-supremacy --save-dev' inside your project.
error Error: Cannot find module 'prettier-plugin-stylus-supremacy'
cause Node.js cannot resolve the plugin module
fix
Ensure the package is installed. For global Prettier, install plugin globally as well: 'npm install -g prettier-plugin-stylus-supremacy'.
error TypeError: prettier.resolveConfig.sync is not a function
cause Prettier version is not compatible (likely v3).
fix
Downgrade Prettier to ^2.0.0.
gotcha The plugin only works with Prettier v2.x. Prettier v3 changed plugin API and is not supported.
fix Ensure Prettier version is ^2.0.0. Do not use with Prettier v3+.
breaking If Prettier's version is too old (<2.0.0), plugin will silently fail or cause errors.
fix Upgrade Prettier to ^2.0.0.
deprecated Option names may change between minor versions. Check changelog.
fix Refer to the plugin's documentation for the current option names.
npm install prettier-plugin-stylus-supremacy
yarn add prettier-plugin-stylus-supremacy
pnpm add prettier-plugin-stylus-supremacy

Installs the plugin, configures formatting options in .prettierrc, and runs Prettier on Stylus files via CLI.

npm i prettier-plugin-stylus-supremacy
# .prettierrc
{
  "plugins": ["prettier-plugin-stylus-supremacy"],
  "stylusSupremacy.insertBraces": false,
  "stylusSupremacy.quoteChar": "single"
}
# CLI
npx prettier --plugin=prettier-plugin-stylus-supremacy --write '**/*.styl'