Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linter): added per-file-ignores as a config option for linter rules
closes #107
- Loading branch information
Christopher Pickering
committed
Jul 8, 2022
1 parent
3ef7c16
commit c709efd
Showing
19 changed files
with
483 additions
and
1,164 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,326 @@ | ||
[ | ||
{ | ||
"name": "ignore", | ||
"description": { | ||
"en": "Ignore linter codes.", | ||
"ru": "Игнорируйте коды линтера.", | ||
"fr": "Ignore les codes de linter." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "ignore=\"H014,H015\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"ignore\": \"H014,H015\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "extension", | ||
"description": { | ||
"en": "Use to only find files with a specific extension.", | ||
"ru": "Используется для поиска файлов только с определенным расширением.", | ||
"fr": "Permet de trouver uniquement les fichiers ayant une extension spécifique." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "extension=\"html.dj\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"extension\": \"html.dj\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "custom_blocks", | ||
"description": { | ||
"en": "Use to indent custom code blocks. For example `{% toc %}...{% endtoc %}`", | ||
"ru": "Используется для отступов в пользовательских блоках кода. Например, `{% toc %}...{% endtoc %}`", | ||
"fr": "Sert à indenter les blocs de code personnalisés. Par exemple `{% toc %}...{% endtoc %}`" | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "custom_blocks=\"toc,example\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"custom_blocks\": \"toc,example\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "custom_html", | ||
"description": { | ||
"en": "Use to indent custom HTML tags. For example `<mjml>` or `<simple-greeting>` or `<mj-\\w+>`", | ||
"ru": "Используется для отступа пользовательских HTML-тегов. Например, `<mjml>` или `<simple-greeting>` или `<mj-\\w+>`.", | ||
"fr": "Permet d'indenter les balises HTML personnalisées. Par exemple, `<mjml>` ou `<simple-greeting>` ou `<mj-\\w+>`." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "custom_html=\"mjml,simple-greeting,mj-\\w+\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"custom_html\": \"mjml,simple-greeting,mj-\\w+\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "indent", | ||
"description": { | ||
"en": "Use to change the code indentation. Default is 4 (four spaces).", | ||
"ru": "Используется для изменения отступа кода. По умолчанию - 4 (четыре пробела).", | ||
"fr": "Permet de modifier l'indentation du code. La valeur par défaut est 4 (quatre espaces)." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "indent=3" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"indent\": \"3\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "exclude", | ||
"description": { | ||
"en": "Override the default exclude paths.", | ||
"ru": "Переопределите пути исключения по умолчанию.", | ||
"fr": "Remplacer les chemins d'exclusion par défaut." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "exclude=\".venv,venv,.tox,.eggs,...\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"exclude\": \".venv,venv,.tox,.eggs,...\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "extend_exclude", | ||
"description": { | ||
"en": "Add additional paths to the default exclude.", | ||
"ru": "Добавьте дополнительные пути к исключаемым по умолчанию.", | ||
"fr": "Ajouter des chemins supplémentaires à l'exclusion par défaut." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "extend_exclude=\".custom\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"extend_exclude\": \".custom\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "blank_line_after_tag", | ||
"description": { | ||
"en": "Add an additional blank line after `{% <tag> ... %}` tag groups.", | ||
"ru": "Добавьте дополнительную пустую строку после групп тегов `{% <tag> ... %}`.", | ||
"fr": "Ajout d'une ligne vide supplémentaire après les groupes de balises `{% <tag> ... %}`." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "blank_line_after_tag=\"load,extends,include\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"blank_line_after_tag\": \"load,extends,include\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "profile", | ||
"description": { | ||
"en": "Set a profile for the template language. The profile will enable linter rules that apply to your template language, and may also change reformatting. For example, in `handlebars` there are no spaces inside `{{#if}}` tags.\n\nOptions:\n\n:::content\n\n- html (default)\n- django\n- jinja\n- nunjucks (for nunjucks and twig)\n- handlebars (for handlebars and mustache)\n- golang\n- angular\n :::", | ||
"ru": "Установите профиль для языка шаблона. Профиль будет включать правила линтера, применимые к языку шаблонов, а также может изменять переформатирование. Например, в `handlebars` нет пробелов внутри тегов `{{#if}}`.\n\nOptions:\n\n:::content\n\n- html (default)\n- django\n- jinja\n- nunjucks (for nunjucks and twig)\n- handlebars (for handlebars and mustache)\n- golang\n- angular\n :::", | ||
"fr": "Définissez un profil pour la langue du modèle. Le profil activera les règles de linter qui s'appliquent à votre langage de modèle, et peut également changer le reformatage. Par exemple, dans `handlebars`, il n'y a pas d'espaces dans les balises `{{#if}}`.\n\nOptions:\n\n:::content\n\n- html (default)\n- django\n- jinja\n- nunjucks (for nunjucks and twig)\n- handlebars (for handlebars and mustache)\n- golang\n- angular\n :::" | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "profile=\"django\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"profile\": \"django\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "require_pragma", | ||
"description": { | ||
"en": "Only format or lint files that starts with a comment with only the text 'djlint:on'. The comment can be a HTML comment or a comment in the template language defined by the profile setting. If no profile is specified, a comment in any of the template languages is accepted.\n\n```html\n<!-- djlint:on -->\n{# djlint:on #}\n{% comment %} djlint:on {% endcomment %}\n{{ /* djlint:on */ }}\n{{!-- djlint:on --}}\n```\n", | ||
"ru": "Форматировать или линтовать только те файлы, которые начинаются с комментария, содержащего только текст 'djlint:on'. Комментарий может быть HTML-комментарием или комментарием на языке шаблонов, определенном настройкой профиля. Если профиль не указан, принимается комментарий на любом из языков шаблонов.\n\n```html\n<!-- djlint:on -->\n{# djlint:on #}\n{% comment %} djlint:on {% endcomment %}\n{{ /* djlint:on */ }}\n{{!-- djlint:on --}}\n```\n", | ||
"fr": "Ne formatez ou ne limez que les fichiers qui commencent par un commentaire contenant uniquement le texte 'djlint:on'. Le commentaire peut être un commentaire HTML ou un commentaire dans le langage de modèle défini par le paramètre de profil. Si aucun profil n'est spécifié, un commentaire dans l'un des langages de modèle est accepté.\n\n```html\n<!-- djlint:on -->\n{# djlint:on #}\n{% comment %} djlint:on {% endcomment %}\n{{ /* djlint:on */ }}\n{{!-- djlint:on --}}\n```\n" | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "require_pragma=true" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"require_pragma\": \"true\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "max_line_length", | ||
"description": { | ||
"en": "Formatter will attempt to put some html and template tags on a single line instead of wrapping them if the line length will not exceed this value.", | ||
"ru": "Форматировщик попытается разместить некоторые html и шаблонные теги на одной строке вместо того, чтобы обернуть их, если длина строки не превышает этого значения.", | ||
"fr": "Le formateur essaiera de mettre certaines balises html et template sur une seule ligne au lieu de les envelopper si la longueur de la ligne ne dépasse pas cette valeur." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "max_line_length=120" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"max_line_length\": \"120\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "max_attribute_length", | ||
"description": { | ||
"en": "Formatter will attempt to wrap tag attributes if the attribute length exceeds this value.", | ||
"ru": "Форматировщик попытается обернуть атрибуты тега, если длина атрибута превышает это значение.", | ||
"fr": "Le formateur tentera d'envelopper les attributs de la balise si la longueur de l'attribut dépasse cette valeur." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "max_attribute_length=10" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"max_attribute_length\": \"10\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "use_gitignore", | ||
"description": { | ||
"en": "Add .gitignore excludes to the default exclude.", | ||
"ru": "Добавьте исключения .gitignore к исключениям по умолчанию.", | ||
"fr": "Ajouter les exclusions .gitignore à l'exclusion par défaut." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "use_gitignore=True" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"use_gitignore\": \"True\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "format_attribute_template_tags", | ||
"description": { | ||
"en": "Formatter will attempt to format template syntax inside of tag attributes. Disabled by default.", | ||
"ru": "Форматировщик будет пытаться форматировать синтаксис шаблона внутри атрибутов тега. По умолчанию отключен.", | ||
"fr": "Le formateur tentera de formater la syntaxe des modèles à l'intérieur des attributs des balises. Désactivé par défaut." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "format_attribute_template_tags=true" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"format_attribute_template_tags\": \"true\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "linter_output_format", | ||
"description": { | ||
"en": "Customize order of output message. Default=\"{code} {line} {message} {match}\". If `{filename}` is not include in message, then the output will be grouped by file and a header will automatically be added to each group.\n\nOptional variables:\n::: content\n\n- `{filename}`\n- `{line}`\n- `{code}`\n- `{message}`\n- `{match}`\n :::", | ||
"ru": "Настройка порядка вывода сообщения. По умолчанию=\"{code} {line} {message} {match}\". Если `{filename}` не включено в сообщение, то вывод будет сгруппирован по файлам и к каждой группе будет автоматически добавлен заголовок.\n\nOptional variables:\n::: content\n\n- `{filename}`\n- `{line}`\n- `{code}`\n- `{message}`\n- `{match}`\n :::", | ||
"fr": "Personnalise l'ordre du message de sortie. Défaut=\"{code} {ligne} {message} {match}\". Si `{filename}` n'est pas inclus dans le message, alors la sortie sera groupée par fichier et un en-tête sera automatiquement ajouté à chaque groupe.\n\nOptional variables:\n::: content\n\n- `{filename}`\n- `{line}`\n- `{code}`\n- `{message}`\n- `{match}`\n :::" | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "linter_output_format=\"{filename}:{line}: {code} {message} {match}\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"linter_output_format\": \"{filename}:{line}: {code} {message} {match}\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "preserve_leading_space", | ||
"description": { | ||
"en": "Preserve leading space on text, where possible. Ideal for non-html template files where text indent is intentional.", | ||
"ru": "Сохраняет пробелы в тексте, где это возможно. Идеально подходит для не-html файлов шаблонов, где отступ текста является намеренным.", | ||
"fr": "Préserve l'espace de tête du texte, dans la mesure du possible. Idéal pour les fichiers de modèles non-html où l'indentation du texte est intentionnelle." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "preserve_leading_space=true" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"preserve_leading_space\": true" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "preserve_blank_lines", | ||
"description": { | ||
"en": "Preserve blank where possible. Ideal for non-html template files where blank lines are intentional.", | ||
"ru": "Сохраняйте пробелы там, где это возможно. Идеально подходит для не-html файлов шаблонов, где пустые строки являются намеренными.", | ||
"fr": "Préserve les blancs lorsque cela est possible. Idéal pour les fichiers de modèles non-html où les lignes vides sont intentionnelles." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "preserve_blank_lines=true" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"preserve_blank_lines\": true" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "per_file_ignores", | ||
"description": { | ||
"en": "Ignore linter rules on a per-file basis.", | ||
"ru": "Игнорировать правила линтера на основе каждого файла.", | ||
"fr": "Ignorer les règles de linter sur une base par fichier." | ||
}, | ||
"usage": [ | ||
{ | ||
"name": "pyproject.toml", | ||
"value": "[tool.djlint.per-file-ignores]\n\"file.html\"= \"H026,H025\"\n\"file_two.html\"=\"H001\"" | ||
}, | ||
{ | ||
"name": ".djlintrc", | ||
"value": "\"per-file-ignores\": {\n \"file.html\": \"H026,H025\",\n \"file_two.html\":\"H001\"\n }" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.