{"id":20382,"library":"prettier-plugin-jte","title":"prettier-plugin-jte","description":"A Prettier plugin (v1.2.0) for formatting Java JTE template files. Compatible with Prettier ^3.0.0 and maintained by the JTE community. Supports JTE expressions, directives (@if, @for, @import, @param, @template calls), content blocks, and HTML formatting via Prettier's HTML printer. Actively developed with monthly releases. Differentiates from generic template formatters by understanding JTE-specific syntax and preserving whitespace semantics.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/sgruendel/prettier-plugin-jte","tags":["javascript","prettier","plugin","template","html","jte","java","typescript"],"install":[{"cmd":"npm install prettier-plugin-jte","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-jte","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-jte","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - Prettier must be installed (v3.0.0 or higher)","package":"prettier","optional":false}],"imports":[{"note":"Plugins are referenced by package name in Prettier config; no import statement needed.","wrong":"plugins: ['prettier-plugin-jte'] (no require, no import, just string)","symbol":"plugin (in .prettierrc)","correct":"plugins: ['prettier-plugin-jte']"},{"note":"Package is ESM-only; CommonJS require does not work in Node.js with \"type\": \"module\".","wrong":"const plugin = require('prettier-plugin-jte')","symbol":"Default import (for programmatic use)","correct":"import plugin from 'prettier-plugin-jte'"},{"note":"This package provides types but they are re-exported from Prettier; no separate type import needed.","wrong":null,"symbol":"TypeScript import (type)","correct":"import type { Plugin } from 'prettier'"}],"quickstart":{"code":"# Install as a dev dependency\nnpm install --save-dev prettier prettier-plugin-jte\n\n# Create or update .prettierrc\ncat > .prettierrc << 'EOF'\n{\n  \"plugins\": [\"prettier-plugin-jte\"]\n}\nEOF\n\n# Format a JTE file\nnpx prettier --write \"src/main/resources/**/*.jte\"\n\n# Example input file: src/main/resources/template.jte\n# @import org.example.Page\n# @param Page page\n#\n# @if(page.getDescription() != null)\n#     <meta name=\"description\" content=\"${page.getDescription()}\">\n# @endif\n#\n# After formatting, the file gets consistent indentation and spacing.","lang":"javascript","description":"Installs the plugin, adds it to Prettier config, and formats a JTE template file with Prettier."},"warnings":[{"fix":"Upgrade Prettier to ^3.0.0: npm install prettier@latest --save-dev","message":"Plugin requires Prettier v3 or higher. Using with Prettier v2 will silently fail.","severity":"gotcha","affected_versions":"<3.0.0"},{"fix":"Use a different formatter for .kte files, or convert to .jte if possible.","message":"The plugin only supports .jte files – it does not support .kte (Kotlin JTE) syntax.","severity":"gotcha","affected_versions":"all"},{"fix":"Run prettier with --parser jte or ensure .prettierrc includes 'overrides': [{'files': '*.jte', 'options': {'parser': 'jte'}}]","message":"Explicit --parser jte flag may be required if Prettier does not auto-detect .jte files.","severity":"gotcha","affected_versions":"all"}],"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-jte\" in the project root.","cause":"Plugin not installed or not in node_modules.","error":"Cannot find module 'prettier-plugin-jte'"},{"fix":"Run \"npm install --save-dev prettier\" to install Prettier v3+.","cause":"Prettier is not installed as a peer dependency.","error":"Error: Loading plugin 'prettier-plugin-jte' failed: Cannot find module 'prettier'"},{"fix":"Upgrade Prettier to ^3.0.0.","cause":"Prettier version < 3.0.0 does not support custom plugins.","error":"Error: Unsupported parser: \"jte\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}