|
4 | 4 |
|
5 | 5 | > **{{ 🎀}}** Prototype linter for [Jinja](https://jinja.palletsprojects.com/) and [Django templates](https://docs.djangoproject.com/en/dev/topics/templates/), forked from [jinjalint](https://github.com/motet-a/jinjalint). |
6 | 6 |
|
7 | | -It works with [Django’s templates](https://docs.djangoproject.com/en/1.11/ref/templates/language/) too, it should |
8 | | -work with [Twig](https://twig.symfony.com/) and similar template languages. |
9 | | -It should work fine with any kind of HTML 4 and 5, however XHTML is not |
10 | | -supported. |
11 | | - |
12 | | -This linter parses both HTML and Jinja tags and will report mismatched |
13 | | -tags and indentation errors: |
14 | | - |
15 | | -```html+jinja |
16 | | -<div> |
17 | | - {% if something %} |
18 | | -</div> |
19 | | -{% endif %} |
20 | | -``` |
| 7 | +curlylint is a prototype linter for your templates – whether that’s [Django’s templates](https://docs.djangoproject.com/en/1.11/ref/templates/language/), [Jinja](https://jinja.palletsprojects.com/), [Twig](https://twig.symfony.com/), or any other [“curly braces”](tests/README.md) template language. |
21 | 8 |
|
22 | | -```html+jinja |
23 | | -<div> |
24 | | - <span> |
25 | | - </div> |
26 | | -</span> |
27 | | -``` |
| 9 | +As of now, curlylint supports: |
28 | 10 |
|
29 | | -```html+jinja |
30 | | -{% if something %} |
31 | | -<div>not indented properly</div> |
32 | | -{% endif %} |
33 | | -``` |
| 11 | +- Linting invalid template / HTML syntax due to mismatched tags – while template errors are easy enough to spot, it’s not rare for HTML issues to make their way to live sites. |
| 12 | +- Indentation inconsistencies – Usage of tabs vs spaces, line breaks, indentation size. |
34 | 13 |
|
35 | | -```html+jinja |
36 | | -{% if something %}<a href="somewhere" |
37 | | - >{% endif %} |
38 | | - <p>something</p> |
39 | | - {% if not something %}</a |
40 | | ->{% endif %} |
41 | | -``` |
| 14 | +In the future, we intend to support linting: |
| 15 | + |
| 16 | +- Common accessibility issues in HTML – misuse of ARIA `role`, and making sure alternative text is used where appropriate. |
| 17 | +- Common security issues – e.g. `rel="noopener noreferrer"`, or preventing usage of HTTP URLs. |
| 18 | +- General HTML code smells – duplicate attributes, invalid attributes, etc. |
| 19 | +- More [ideas welcome](docs/README.md)! |
42 | 20 |
|
43 | 21 | ## Usage |
44 | 22 |
|
|
0 commit comments