Skip to content

Commit ec0e7e1

Browse files
committed
Fix: Disable djLint formatting, use lint-only mode
The previous commit applied djLint formatting which broke generated code syntax. This commit reverts all template formatting and configures djLint for linting only. ## Changes - Reverted all template file formatting (back to original state) - Updated pyproject.toml to lint-only mode with clear warnings - Removed format commands from composer.json (only kept lint-twig) - Updated GitHub Actions workflow to only run linting - Added more ignore rules for template-specific issues - Updated README to clarify formatting is disabled ## Why Lint-Only? djLint's HTML formatting breaks Twig templates that generate code: - Splits TypeScript/JavaScript function signatures across lines - Adds unwanted indentation in code generation blocks - Breaks syntax of generated files Linting still provides value by catching: - Template syntax errors - Missing closing tags - Basic HTML structure issues ## Usage ```bash composer lint-twig # Lint templates for syntax issues ```
1 parent df5574b commit ec0e7e1

File tree

358 files changed

+3242
-5335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+3242
-5335
lines changed

.github/workflows/djlint.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ jobs:
2828

2929
- name: Run djLint linter
3030
run: |
31-
uvx djlint templates/ --check --lint
32-
33-
- name: Run djLint formatter check
34-
run: |
35-
uvx djlint templates/ --check
31+
uvx djlint templates/ --lint

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ $sdk->generate(__DIR__ . '/examples/php'); // Generate source code
7070

7171
```
7272

73-
## Linting and Formatting Twig Templates
73+
## Linting Twig Templates
7474

75-
This project uses [djLint](https://djlint.com/) to lint and format Twig template files.
75+
This project uses [djLint](https://djlint.com/) to lint Twig template files for syntax and common issues.
7676

77-
**Available commands:**
77+
**Note:** Formatting is disabled as it breaks code generation syntax. Only linting is used.
78+
79+
**Available command:**
7880
```bash
79-
composer lint-twig # Check for linting errors
80-
composer format-twig # Auto-format all Twig files
81-
composer format-twig-check # Check formatting without changes
81+
composer lint-twig # Check for linting errors
8282
```
8383

8484
Requires [uv](https://github.com/astral-sh/uv) to be installed. Configuration is in `pyproject.toml`. The linter runs automatically on pull requests via GitHub Actions.

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
"test": "vendor/bin/phpunit",
1616
"lint": "vendor/bin/phpcs",
1717
"format": "vendor/bin/phpcbf",
18-
"lint-twig": "uvx djlint templates/ --check --lint",
19-
"format-twig": "uvx djlint templates/ --reformat",
20-
"format-twig-check": "uvx djlint templates/ --check"
18+
"lint-twig": "uvx djlint templates/ --lint"
2119
},
2220
"autoload": {
2321
"psr-4": {

pyproject.toml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
[tool.djlint]
2-
profile="jinja"
3-
4-
indent=4
5-
max_line_length=1200
6-
max_blank_lines=1
7-
preserve_blank_lines=true
8-
preserve_leading_space=true
9-
10-
format_js=true
11-
format_css=true
122

3+
profile="jinja"
134
extension="twig"
145

15-
ignore="H006,H030,H031"
6+
ignore="H006,H013,H021,H023,H025,H030,H031,T001,T002,T003,T028"
7+
# H006: img tag height/width (not needed in templates)
8+
# H013: img tag alt text (not applicable to code templates)
9+
# H021: inline styles (generated code often has inline styles)
10+
# H023: entity references (templates use various entities)
11+
# H025: orphan tags (template logic creates valid output)
12+
# H030/H031: meta tags (not applicable to SDK templates)
13+
# T001: variable whitespace (breaks code generation)
14+
# T002: quote style (templates need flexibility)
15+
# T003: endblock naming (not always needed)
16+
# T028: spaceless tags (not applicable)
1617

17-
exclude=".git,vendor,tests/sdks,node_modules"
18+
exclude=".git,vendor,tests/sdks,node_modules,examples"
1819

1920
use_gitignore=true
21+
max_line_length=1200
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ sdk.changelog | raw }}
1+
{{sdk.changelog | raw}}

templates/android/LICENSE.md.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ sdk.licenseContent | raw }}
1+
{{sdk.licenseContent | raw}}

templates/android/README.md.twig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ spec.title }} {{ sdk.name }} SDK
1+
# {{ spec.title }} {{sdk.name}} SDK
22

33
![Maven Central](https://img.shields.io/maven-central/v/{{ sdk.namespace | caseDot }}/{{ sdk.gitRepoName | caseDash }}.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/{{ sdk.gitUserName|url_encode }}/{{ sdk.gitRepoName|url_encode }}.svg?style=flat-square)
@@ -28,7 +28,7 @@
2828
Appwrite's Android SDK is hosted on Maven Central. In order to fetch the Appwrite SDK, add this to your root level `build.gradle(.kts)` file:
2929

3030
```groovy
31-
repositories {
31+
repositories {
3232
mavenCentral()
3333
}
3434
```
@@ -54,11 +54,11 @@ Add this to your project's `pom.xml` file:
5454

5555
```xml
5656
<dependencies>
57-
<dependency>
58-
<groupId>{{ sdk.namespace | caseDot }}</groupId>
59-
<artifactId>{{ sdk.gitRepoName | caseDash }}</artifactId>
60-
<version>{{ sdk.version }}</version>
61-
</dependency>
57+
<dependency>
58+
<groupId>{{ sdk.namespace | caseDot }}</groupId>
59+
<artifactId>{{ sdk.gitRepoName | caseDash }}</artifactId>
60+
<version>{{sdk.version}}</version>
61+
</dependency>
6262
</dependencies>
6363
```
6464

@@ -73,4 +73,4 @@ This library is auto-generated by Appwrite custom [SDK Generator](https://github
7373

7474
## License
7575

76-
Please see the [{{ spec.licenseName }} license]({{ spec.licenseURL }}) file for more information.
76+
Please see the [{{spec.licenseName}} license]({{spec.licenseURL}}) file for more information.

templates/android/build.gradle.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ task clean(type: Delete) {
3131

3232

3333
apply from: "${rootDir}/scripts/publish-config.gradle"
34+

templates/android/docs/java/example.md.twig

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,43 @@ import {{ sdk.namespace | caseDot }}.models.InputFile;
66
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }};
77
{% set added = [] %}
88
{% for parameter in method.parameters.all %}
9-
{% if parameter.enumValues is not empty %}
10-
{% if parameter.enumName not in added %}
9+
{% if parameter.enumValues is not empty %}
10+
{% if parameter.enumName not in added %}
1111
import {{ sdk.namespace | caseDot }}.enums.{{ parameter.enumName | caseUcfirst }};
1212
{% set added = added|merge([parameter.enumName]) %}
13-
{% endif %}
14-
{% endif %}
13+
{% endif %}
14+
{% endif %}
1515
{% endfor %}
1616
{% if method.parameters.all | hasPermissionParam %}
1717
import {{ sdk.namespace | caseDot }}.Permission;
1818
import {{ sdk.namespace | caseDot }}.Role;
1919
{% endif %}
2020

2121
Client client = new Client(context)
22-
{%~ if method.auth|length > 0 %}
22+
{%~ if method.auth|length > 0 %}
2323
.setEndpoint("{{ spec.endpointDocs | raw }}") // Your API Endpoint
24-
{%~ for node in method.auth %}
25-
{%~ for key,header in node|keys %}
26-
.set{{ header | caseUcfirst }}("{{ node[header]['x-appwrite']['demo'] | raw }}")
27-
{% if loop.last %}
28-
;
29-
{% endif %}
30-
// {{ node[header].description }}
31-
{%~ endfor %}
32-
{%~ endfor %}
33-
{%~ endif %}
24+
{%~ for node in method.auth %}
25+
{%~ for key,header in node|keys %}
26+
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo'] | raw }}"){% if loop.last %};{% endif %} // {{ node[header].description }}
27+
{%~ endfor %}
28+
{%~ endfor %}
29+
{%~ endif %}
3430

3531
{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client);
3632

37-
{{ service.name | caseCamel }}.{{ method.name | caseCamel }}(
38-
{% if method.parameters.all | length == 0 %}
39-
new CoroutineCallback<>((result, error) -> {
33+
{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new CoroutineCallback<>((result, error) -> {
4034
if (error != null) {
4135
error.printStackTrace();
4236
return;
4337
}
4438

4539
Log.d("{{ spec.title | caseUcfirst }}", result.toString());
46-
}));
47-
{% endif %}
40+
}));{% endif %}
4841

4942
{% for parameter in method.parameters.all %}
50-
{% if parameter.enumValues is not empty %}
51-
{{ parameter.enumName | caseUcfirst }}.{{ (parameter.enumKeys[0] ?? parameter.enumValues[0]) | caseEnumKey }}, // {{ parameter.name }}
52-
{% if not parameter.required %}
53-
(optional)
54-
{% endif %}
55-
{% else %}
56-
{{ parameter | paramExample }}, // {{ parameter.name }}
57-
{% if not parameter.required %}
58-
(optional)
59-
{% endif %}
60-
{% endif %}
43+
{% if parameter.enumValues is not empty %}{{ parameter.enumName | caseUcfirst }}.{{ (parameter.enumKeys[0] ?? parameter.enumValues[0]) | caseEnumKey }}, // {{ parameter.name }} {% if not parameter.required %}(optional){% endif %}
44+
{% else %}{{ parameter | paramExample }}, // {{ parameter.name }} {% if not parameter.required %}(optional){% endif %}
45+
{% endif %}
6146
{%~ if loop.last %}
6247

6348
new CoroutineCallback<>((result, error) -> {
@@ -71,4 +56,4 @@ new CoroutineCallback<>((result, error) -> {
7156
);
7257
{% endif %}
7358

74-
{% endfor %}
59+
{% endfor %}

templates/android/docs/kotlin/example.md.twig

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,40 @@ import {{ sdk.namespace | caseDot }}.models.InputFile
66
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}
77
{% set added = [] %}
88
{% for parameter in method.parameters.all %}
9-
{% if parameter.enumValues is not empty %}
10-
{% if parameter.enumName not in added %}
9+
{% if parameter.enumValues is not empty %}
10+
{% if parameter.enumName not in added %}
1111
import {{ sdk.namespace | caseDot }}.enums.{{ parameter.enumName | caseUcfirst }}
1212
{% set added = added|merge([parameter.enumName]) %}
13-
{% endif %}
14-
{% endif %}
13+
{% endif %}
14+
{% endif %}
1515
{% endfor %}
1616
{% if method.parameters.all | hasPermissionParam %}
1717
import {{ sdk.namespace | caseDot }}.Permission
1818
import {{ sdk.namespace | caseDot }}.Role
1919
{% endif %}
2020

2121
val client = Client(context)
22-
{%~ if method.auth|length > 0 %}
22+
{%~ if method.auth|length > 0 %}
2323
.setEndpoint("{{ spec.endpointDocs | raw }}") // Your API Endpoint
24-
{%~ for node in method.auth %}
25-
{%~ for key,header in node|keys %}
26-
.set{{ header | caseUcfirst }}("{{ node[header]['x-appwrite']['demo'] | raw }}") // {{ node[header].description }}
27-
{%~ endfor %}
28-
{%~ endfor %}
29-
{%~ endif %}
24+
{%~ for node in method.auth %}
25+
{%~ for key,header in node|keys %}
26+
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo'] | raw }}") // {{node[header].description}}
27+
{%~ endfor %}
28+
{%~ endfor %}
29+
{%~ endif %}
3030

3131
val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client)
3232

3333
{% if method.type == 'webAuth' %}
3434
{% else %}
35-
val result =
36-
{% endif %}
37-
{{ service.name | caseCamel }}.{{ method.name | caseCamel }}(
38-
{% if method.parameters.all | length == 0 %}
39-
)
40-
{% endif %}
35+
val result = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %}
4136

42-
{%~ for parameter in method.parameters.all %}
43-
{%~ if parameter.enumValues is not empty %}
44-
{{ parameter.name }} = {{ parameter.enumName }}.{{ (parameter.enumKeys[0] ?? parameter.enumValues[0]) | caseEnumKey }},
45-
{% if not parameter.required %}
46-
// (optional)
47-
{% endif %}
48-
{%~ else %}
49-
{{ parameter.name }} = {{ parameter | paramExample }},
50-
{% if not parameter.required %}
51-
// (optional)
52-
{% endif %}
53-
{%~ endif %}
37+
{%~ for parameter in method.parameters.all %}
38+
{%~ if parameter.enumValues is not empty %}
39+
{{ parameter.name }} = {{ parameter.enumName }}.{{ (parameter.enumKeys[0] ?? parameter.enumValues[0]) | caseEnumKey }},{% if not parameter.required %} // (optional){% endif %}
40+
{%~ else %}
41+
{{ parameter.name }} = {{ parameter | paramExample }}, {% if not parameter.required %}// (optional){% endif %}
42+
{%~ endif %}
5443

55-
{%~ endfor %}
56-
{% if method.parameters.all | length > 0 %}
57-
)
58-
{% endif %}
44+
{%~ endfor %}
45+
{% if method.parameters.all | length > 0 %}){% endif %}

0 commit comments

Comments
 (0)