Registry / devops / prettier-plugin-wgsl

prettier-plugin-wgsl

JSON →
library0.1.9jsnpmunverified

A Prettier plugin that formats WGSL (WebGPU Shading Language) files. Version 0.1.9 is the latest stable release. It uses Chevrotain for parsing and is inspired by prettier-plugin-glsl. Works with Prettier >=3.0.0 and ships TypeScript types. As WGSL is still evolving, this plugin may lag behind spec changes. It is the primary option for formatting WGSL code in WebGPU projects.

npm install prettier-plugin-wgsl
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-WG
P
prettier-plugin-wgsl
devopsjavascriptv0.1.9
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.

none
npx prettier --write *.wgsl
require('prettier-plugin-wgsl')
This is a Prettier plugin, not a Node.js module. It is used via Prettier CLI or API by adding to plugins array.
prettier-plugin-wgsl
plugins: ['prettier-plugin-wgsl']
require('prettier-plugin-wgsl')
In Prettier config file (JSON or JS), add the package name to the plugins array.
prettier
const prettier = require('prettier'); await prettier.format(code, { parser: 'wgsl', plugins: ['prettier-plugin-wgsl'] })
const prettier = require('prettier-plugin-wgsl')
Use Prettier's API with plugin installed; specify parser: 'wgsl' to format WGSL code.

Shows how to install and configure the plugin, then format a WGSL file via CLI.

// Install: npm install --save-dev prettier prettier-plugin-wgsl // Add to .prettierrc: { "plugins": ["prettier-plugin-wgsl"], "semi": true } // Format a file: // npx prettier --write shader.wgsl
Debug
Known issues
gotchaEnsure Prettier version is >=3.0.0; older versions are incompatible.
fix
Upgrade Prettier to 3.0.0 or later.
affects: <0.1.0
gotchaThe plugin may not support all WGSL syntax if the language spec has been updated after the plugin release.
fix
Check the plugin's GitHub repository for updates or open an issue.
affects: >=0.1.0
gotchaThe plugin must be listed in the 'plugins' array of Prettier config; simply installing is not enough.
fix
Add 'prettier-plugin-wgsl' to your Prettier configuration plugins array.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-wgsl'
The plugin is not installed or not in node_modules.
fix
Run npm install --save-dev prettier-plugin-wgsl
Couldn't resolve parser 'wgsl'
Prettier is older than 3.0.0 or plugin not loaded.
fix
Update Prettier to >=3.0.0 and add plugin to plugins config.
Uncaught SyntaxError: Unexpected token
WGSL syntax not supported by the plugin version.
fix
Update the plugin to latest version or report the issue on GitHub.
Upgrade
Version history
0.1.9latest on npm
Audit
Dependencies
prettierrequiredpeer dependency: required to run as a Prettier plugin
Agent activity
17 hits · last 30 days
node
16
Amazon
1
Resources
prettier-plugin-wgsl — npm install prettier-plugin-wgsl · libregistry