Skip to content

Commit ba8db0e

Browse files
committed
docs: Add Twig linting section to CONTRIBUTING.md
Added a concise section explaining: - How to lint templates locally (composer lint-twig) - Requirements (uv for uvx commands) - Configuration location and approach - What the linter catches - Note about discussing false positives in PRs
1 parent 3d1534f commit ba8db0e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,31 @@ docker run --rm -v $(pwd):/app -w /app php:8.3-cli php example.php
122122
123123
Check your output files at: /examples/new-lang and make sure the SDK works. When possible, add some unit tests.
124124

125+
## Linting Twig Templates
126+
127+
We use [djLint](https://djlint.com/) to lint Twig template files for syntax errors and common issues. The linter runs automatically on pull requests.
128+
129+
**To lint templates locally:**
130+
```bash
131+
composer lint-twig
132+
```
133+
134+
**Requirements:**
135+
- [uv](https://github.com/astral-sh/uv) must be installed (for running `uvx` commands)
136+
137+
**Configuration:**
138+
- Located in `pyproject.toml`
139+
- Only linting is enabled (formatting is disabled to avoid breaking code generation)
140+
- Several rules are ignored as they produce false positives for code generation templates
141+
142+
**What the linter catches:**
143+
- Template syntax errors
144+
- Missing closing tags
145+
- Extra blank lines
146+
- Basic HTML structure issues
147+
148+
**Note:** If you encounter linting errors that seem incorrect for code generation templates, please discuss in your PR rather than disabling the linter.
149+
125150
## SDK Checklist
126151

127152
It is very important for us to create a consistent structure and architecture, as well as a language-native feel for the SDKs we generate.

0 commit comments

Comments
 (0)