{"id":20452,"library":"prettier-plugin-wgsl","title":"prettier-plugin-wgsl","description":"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.","status":"active","version":"0.1.9","language":"javascript","source_language":"en","source_url":"https://github.com/AbdBarho/prettier-plugin-wgsl","tags":["javascript","prettier","prettier-plugin","plugin","wgsl","webgpu","gpu","shading-language","formatter","typescript"],"install":[{"cmd":"npm install prettier-plugin-wgsl","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-wgsl","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-wgsl","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: required to run as a Prettier plugin","package":"prettier","optional":false}],"imports":[{"note":"This is a Prettier plugin, not a Node.js module. It is used via Prettier CLI or API by adding to plugins array.","wrong":"require('prettier-plugin-wgsl')","symbol":"none","correct":"npx prettier --write *.wgsl"},{"note":"In Prettier config file (JSON or JS), add the package name to the plugins array.","wrong":"require('prettier-plugin-wgsl')","symbol":"prettier-plugin-wgsl","correct":"plugins: ['prettier-plugin-wgsl']"},{"note":"Use Prettier's API with plugin installed; specify parser: 'wgsl' to format WGSL code.","wrong":"const prettier = require('prettier-plugin-wgsl')","symbol":"prettier","correct":"const prettier = require('prettier'); await prettier.format(code, { parser: 'wgsl', plugins: ['prettier-plugin-wgsl'] })"}],"quickstart":{"code":"// Install: npm install --save-dev prettier prettier-plugin-wgsl\n// Add to .prettierrc:\n{\n  \"plugins\": [\"prettier-plugin-wgsl\"],\n  \"semi\": true\n}\n// Format a file:\n// npx prettier --write shader.wgsl","lang":"json","description":"Shows how to install and configure the plugin, then format a WGSL file via CLI."},"warnings":[{"fix":"Upgrade Prettier to 3.0.0 or later.","message":"Ensure Prettier version is >=3.0.0; older versions are incompatible.","severity":"gotcha","affected_versions":"<0.1.0"},{"fix":"Check the plugin's GitHub repository for updates or open an issue.","message":"The plugin may not support all WGSL syntax if the language spec has been updated after the plugin release.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Add 'prettier-plugin-wgsl' to your Prettier configuration plugins array.","message":"The plugin must be listed in the 'plugins' array of Prettier config; simply installing is not enough.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev prettier-plugin-wgsl","cause":"The plugin is not installed or not in node_modules.","error":"Cannot find module 'prettier-plugin-wgsl'"},{"fix":"Update Prettier to >=3.0.0 and add plugin to plugins config.","cause":"Prettier is older than 3.0.0 or plugin not loaded.","error":"Couldn't resolve parser 'wgsl'"},{"fix":"Update the plugin to latest version or report the issue on GitHub.","cause":"WGSL syntax not supported by the plugin version.","error":"Uncaught SyntaxError: Unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}