Skip to content

Commit aebaafc

Browse files
committed
Refine djLint rules: ignore false positives, fix real issues
This commit takes a systematic approach to djLint configuration: ## Ignore Rules (False Positives for Code Generation) Added ignores for rules that flag valid code generation patterns: - H012: Spaces around = (needed for TypeScript/Swift generics like <T = X>) - H025: Orphan tags (false positive for code generics like <T>, <String>) - T001: Whitespace in tags ({%~ is intentional Twig whitespace control) - T002: Quote styles (templates need flexibility) - T027: Unclosed strings (GitHub Actions ${{ secrets.X }} syntax) - T032: Extra whitespace (often intentional for line continuation) ## Enforced Rules - H014: Extra blank lines - FIXED all 34 occurrences across 26 files ## Result ✅ Linted 462 files, found 0 errors ## Philosophy - Only ignore rules that are genuine false positives for code generation - Fix legitimate issues that improve template quality - Maintain useful linting without breaking code generation
1 parent 04b5e00 commit aebaafc

File tree

27 files changed

+15
-53
lines changed

27 files changed

+15
-53
lines changed

pyproject.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
[tool.djlint]
2+
# LINT-ONLY MODE - Formatting disabled for code generation templates
3+
# djLint formatting breaks code syntax in generated files
4+
# Only use --lint flag, never --reformat
25

36
profile="jinja"
47
extension="twig"
58

6-
ignore="H006,H012,H013,H014,H021,H023,H025,H030,H031,T001,T002,T003,T027,T028,T032"
7-
# H006: img tag height/width (not needed in templates)
8-
# H012: spaces around = (needed for TypeScript generics like <T = X>)
9-
# H013: img tag alt text (not applicable to code templates)
10-
# H014: extra blank lines (often intentional in code generation)
11-
# H021: inline styles (generated code often has inline styles)
12-
# H023: entity references (templates use various entities)
13-
# H025: orphan tags (template logic creates valid output)
14-
# H030/H031: meta tags (not applicable to SDK templates)
15-
# T001: variable whitespace (breaks code generation)
16-
# T002: quote style (templates need flexibility)
17-
# T003: endblock naming (not always needed)
18-
# T027: unclosed strings (false positive for ${{ secrets.X }} syntax)
19-
# T028: spaceless tags (not applicable)
20-
# T032: extra whitespace in tags (often intentional for formatting)
9+
# Ignoring only genuine false positives for code generation templates
10+
ignore="H012,H025,H030,H031,T001,T002,T027,T032"
11+
# H012: spaces around = - false positive for TypeScript generics like <T = Models.Document>
12+
# H025: orphan tags - false positive for code generics like <T>, <String>, <Exception>
13+
# H030/H031: meta description/keywords (not applicable to SDK code templates)
14+
# T001: whitespace in tags - {%~ is intentional Twig whitespace control
15+
# T002: double quotes - templates need flexibility with quote styles
16+
# T027: unclosed strings - false positive for ${{ secrets.X }} in GitHub Actions
17+
# T032: extra whitespace in tags - often intentional for formatting/line continuation
18+
19+
# Rules we ARE enforcing:
20+
# H014: extra blank lines - will fix these
2121

2222
exclude=".git,vendor,tests/sdks,node_modules,examples"
2323

templates/android/build.gradle.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ task clean(type: Delete) {
2929
delete rootProject.buildDir
3030
}
3131

32-
3332
apply from: "${rootDir}/scripts/publish-config.gradle"
3433

templates/android/example/src/main/java/io/package/android/ui/accounts/AccountsFragment.kt.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import androidx.fragment.app.viewModels
1313
import {{ sdk.namespace | caseDot }}.android.R
1414
import {{ sdk.namespace | caseDot }}.android.databinding.FragmentAccountBinding
1515

16-
1716
class AccountsFragment : Fragment() {
1817

1918
private lateinit var binding: FragmentAccountBinding

templates/apple/Sources/Client.swift.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ open class Client {
3838

3939
internal var http: HTTPClient
4040

41-
4241
private static let boundaryChars = "abcdefghijklmnopqrstuvwxyz1234567890"
4342

4443
private static let boundary = randomBoundary()
@@ -266,7 +265,6 @@ open class Client {
266265
var request = HTTPClientRequest(url: endPoint + path + queryParameters)
267266
request.method = .RAW(value: method)
268267

269-
270268
for (key, value) in self.headers.merging(headers, uniquingKeysWith: { $1 }) {
271269
request.headers.add(name: key, value: value)
272270
}

templates/cli/install.ps1.twig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function Greeting {
3535
Write-Host "Welcome to the {{ spec.title | caseUcfirst }} CLI install shield."
3636
}
3737

38-
3938
function CheckSystemInfo {
4039
Write-Host "[1/4] Getting System Info ..."
4140
if ((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
@@ -60,7 +59,6 @@ function DownloadBinary {
6059
Move-Item ${{ spec.title | upper }}_DOWNLOAD_DIR ${{ spec.title | upper }}_INSTALL_PATH
6160
}
6261

63-
6462
function Install {
6563
Write-Host "[3/4] Starting installation ..."
6664

@@ -83,7 +81,6 @@ function InstallCompleted {
8381
Write-Host "As first step, you can login to your {{ spec.title | caseUcfirst }} account using 'appwrite login'"
8482
}
8583

86-
8784
Greeting
8885
CheckSystemInfo
8986
DownloadBinary

templates/cli/install.sh.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ RED='\033[0;31m'
3939
GREEN='\033[0;32m'
4040
NC='\033[0m' # No Color
4141

42-
4342
greeting() {
4443
echo -e "${RED}"
4544
cat << "EOF"

templates/cli/lib/commands/push.js.twig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ const compareAttribute = (remote, local, reason, key) => {
811811
return reason
812812
}
813813

814-
815814
/**
816815
* Check if attribute non-changeable fields has been changed
817816
* If so return the differences as an object.
@@ -1694,7 +1693,6 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
16941693
parseOutput: false
16951694
});
16961695

1697-
16981696
const status = response['status'];
16991697
if (status === 'ready') {
17001698
successfullyDeployed++;
@@ -2181,7 +2179,6 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
21812179
}
21822180
}));
21832181

2184-
21852182
if (!(await approveChanges(collections, databasesGetCollection, KeysCollection, 'collectionId', 'collections', ['attributes', 'indexes'], 'databaseId', 'databaseId',))) {
21862183
return;
21872184
}
@@ -2380,7 +2377,6 @@ const pushTeam = async ({ returnOnZero } = { returnOnZero: false }) => {
23802377
return;
23812378
}
23822379

2383-
23842380
log('Pushing teams ...');
23852381

23862382
for (let team of teams) {

templates/cli/lib/commands/update.js.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ const isInstalledViaHomebrew = () => {
4545
}
4646
};
4747

48-
49-
5048
/**
5149
* Execute command and return promise
5250
*/

templates/cli/lib/parser.js.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ const parseError = (err) => {
138138

139139
log(`To report this error you can:\n - Create a support ticket in our Discord server https://appwrite.io/discord \n - Create an issue in our Github\n ${githubIssueUrl.href}\n`);
140140

141-
142141
error('\n Stack Trace: \n');
143142
console.error(err);
144143
process.exit(1);

templates/cli/lib/questions.js.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,6 @@ const questionsCreateFunctionSelectTemplate = (templates) => {
397397
];
398398
};
399399

400-
401-
402400
const questionsCreateBucket = [
403401
{
404402
type: "input",

0 commit comments

Comments
 (0)