Skip to content

Commit

Permalink
add new djLint JSON schema (#3074)
Browse files Browse the repository at this point in the history
* add new djLint JSON schema

* add JSON schema
* add catalog
* add test cases

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ngdangtu-vn and pre-commit-ci[bot] authored Jul 12, 2023
1 parent f725c82 commit fd34ef2
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -4307,6 +4307,12 @@
"6.0": "https://json.schemastore.org/devinit.schema-6.0.json"
}
},
{
"name": "djlint",
"description": "JSON Schema for djLint configuration file",
"url": "https://json.schemastore.org/djlint.json",
"fileMatch": [".djlintrc"]
},
{
"name": "tsoa",
"description": "JSON Schema for the tsoa configuration file",
Expand Down
3 changes: 3 additions & 0 deletions src/negative_test/djlint/invalid-profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"profile": false
}
134 changes: 134 additions & 0 deletions src/schemas/json/djlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"$comment": "Source: https://www.djlint.com/docs/configuration",
"$id": "https://json.schemastore.org/djlint.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"default": {
"format_attribute_template_tags": false,
"profile": "html"
},
"definitions": {
"css-beautify": {
"type": "object"
},
"js-beautify": {
"type": "object"
}
},
"properties": {
"blank_line_after_tag": {
"type": "string"
},
"blank_line_before_tag": {
"type": "string"
},
"close_void_tags": {
"type": "boolean"
},
"css": {
"$ref": "#/definitions/css-beautify"
},
"custom_blocks": {
"type": "string"
},
"custom_html": {
"type": "string"
},
"exclude": {
"type": "string"
},
"extend_exclude": {
"type": "string"
},
"extension": {
"type": "string"
},
"files": {
"items": {
"type": "string"
},
"type": "array"
},
"format_attribute_template_tags": {
"type": "boolean"
},
"format_css": {
"type": "boolean"
},
"format_js": {
"type": "boolean"
},
"ignore": {
"type": "string"
},
"ignore_blocks": {
"type": "string"
},
"ignore_case": {
"type": "boolean"
},
"include": {
"type": "string"
},
"indent": {
"type": "number"
},
"js": {
"$ref": "#/definitions/js-beautify"
},
"line_break_after_multiline_tag": {
"type": "boolean"
},
"linter_output_format": {
"examples": ["{filename}:{line}: {code} {message} {match}"],
"type": "string"
},
"max_attribute_length": {
"type": "number"
},
"max_blank_lines": {
"type": "number"
},
"max_line_length": {
"type": "number"
},
"no_function_formatting": {
"type": "boolean"
},
"no_line_after_yaml": {
"type": "boolean"
},
"no_set_formatting": {
"type": "boolean"
},
"per-file-ignores": {
"type": "object"
},
"preserve_blank_lines": {
"type": "boolean"
},
"preserve_leading_space": {
"type": "boolean"
},
"profile": {
"enum": [
"html",
"django",
"jinja",
"nunjucks",
"handlebars",
"golang",
"angular"
]
},
"require_pragma": {
"type": "boolean"
},
"use_gitignore": {
"type": "boolean"
}
},
"additionalProperties": false,
"title": "djlint schema",
"description": "JSON schema for djLint's configuration file",
"type": "object"
}
42 changes: 42 additions & 0 deletions src/test/djlint/.djlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"blank_line_after_tag": "load,extends,include",
"blank_line_before_tag": "load,extends,include",
"close_void_tags": true,
"css": {
"indent_size": 5
},
"custom_blocks": "toc,example",
"custom_html": "mjml,simple-greeting,mj-\\w+",
"exclude": ".venv,venv,.tox,.eggs,...",
"extend_exclude": ".custom",
"extension": "html.dj",
"files": ["index.html"],
"format_attribute_template_tags": true,
"format_css": true,
"format_js": true,
"ignore": "H014,H015",
"ignore_blocks": "raw,example",
"ignore_case": true,
"include": "H014,H015",
"indent": 3,
"js": {
"indent_size": 5
},
"line_break_after_multiline_tag": true,
"linter_output_format": "{filename}:{line}: {code} {message} {match}",
"max_attribute_length": 10,
"max_blank_lines": 5,
"max_line_length": 120,
"no_function_formatting": true,
"no_line_after_yaml": true,
"no_set_formatting": true,
"per-file-ignores": {
"file.html": "H026,H025",
"file_two.html": "H001"
},
"preserve_blank_lines": true,
"preserve_leading_space": true,
"profile": "html",
"require_pragma": true,
"use_gitignore": true
}

0 comments on commit fd34ef2

Please sign in to comment.