Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lint): install html lint to lint njk and html files, remo… #1493

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ plugins:
- 'editorconfig'
- '@typescript-eslint'
- 'eslint-plugin-tsdoc'
- '@html-eslint'

overrides:
- files:
- '*.njk'
- '*.html'
parser: '@html-eslint/parser'
extends:
- 'plugin:@html-eslint/recommended'
excludedFiles: '*.ts'
rules:
'@typescript-eslint/no-unnecessary-boolean-literal-compare': off
'@typescript-eslint/await-thenable': off
'@typescript-eslint/no-unnecessary-qualifier': off
'@typescript-eslint/no-unnecessary-type-assertion': off
'@typescript-eslint/require-array-sort-compare': off
'@typescript-eslint/no-base-to-string': off
'@typescript-eslint/no-unnecessary-type-arguments': off
'@typescript-eslint/non-nullable-type-assertion-style': off
'@typescript-eslint/no-implied-eval': off
'@typescript-eslint/no-throw-literal': off
'@typescript-eslint/return-await': off
'spaced-comment': off
'@html-eslint/require-doctype': off
'@html-eslint/require-lang': off
'@html-eslint/require-title': off
'max-len': off
'max-lines': off
'@html-eslint/require-closing-tags': off
'@html-eslint/no-duplicate-attrs': off
'@html-eslint/indent': off
'@html-eslint/element-newline': off

# Overall rules
rules:
Expand Down
5 changes: 0 additions & 5 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@
- "jest --silent --noStackTrace --bail --passWithNoTests --findRelatedTests"
"*.less":
- "stylelint"
- "lintspaces -n -t -d spaces"
"*.html":
- "lintspaces -n -t -d spaces"
"*.njk":
- "lintspaces -n -t -d spaces"
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
"test:ci": "jest --coverage --silent --noStackTrace",
"test:unit": "jest --silent --noStackTrace",
"test:report": "jest --coverage",
"lint": "concurrently \"npm run lint:js\" \"npm run lint:css\" \"npm run lint:spaces\" && node build/catlog.js \"Linting passed\"",
"lint": "concurrently \"npm run lint:js\" \"npm run lint:njk\" \"npm run lint:css\" && node build/catlog.js \"Linting passed\"",
"lint:js": "eslint \"src/**/*.ts\" \"pages/src/**/*.ts\" --max-warnings 3",
"lint:css": "stylelint \"src/**/*.less\" \"pages/src/**/*.less\"",
"lint:spaces": "lintspaces \"./pages/{src,views,controller}/**/*.{html,less,json}\" \"./src/**/*.{less}\" -n -t -d spaces",
"lint:njk": "eslint \"pages/views/**/*.njk\" --max-warnings 3 --fix",
"prepare": "husky install && npm run build",
"preversion": "npm test"
},
Expand All @@ -87,6 +87,8 @@
"@11ty/eleventy-dev-server": "^1.0.3",
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@html-eslint/eslint-plugin": "^0.16.0",
"@html-eslint/parser": "^0.16.0",
"@juggle/resize-observer": "^3.4.0",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/commit-analyzer": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion pages/views/_includes/landing/blogs.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="blogs-content">
<h4 class="blogs-content-name">{{ item.data.name }}</h4>
<p class="blogs-content-text">{{ item.templateContent | text | truncate(250) }}</p>
<a class="arrow-link btn-link btn-sm" href="{{ item.url | url }}">{{ landing.blogs.cta.text }}</a>
<a class="arrow-link btn-link btn-sm" href="{{ item.url | url }}">{{ landing.blogs.cta.text }}</a>
</div>
</li>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions pages/views/_layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{# Additional site meta information #}
{% block meta %}{% endblock meta %}
{# Site icon #}
<link rel="icon" type="image/png" href="{{ '/assets/logo-64x64.png' | url }}" />
<link rel="icon" type="image/png" href="{{ '/assets/logo-64x64.png' | url }}"/>

{% if not env.isDev %}
{% include 'analytics.njk' %}
Expand All @@ -23,7 +23,7 @@
{% include 'polyfill.njk' %}
{% endblock %}
{% block headlib %}
<link rel="stylesheet" type="text/css" href="{{ '/bundles/localdev.css' | url }}" />
<link rel="stylesheet" type="text/css" href="{{ '/bundles/localdev.css' | url }}"/>
{% endblock %}
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion pages/views/_layouts/forward.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block meta %}
<meta charset="utf-8"/>
<meta name="robots" content="noindex" />
<meta name="robots" content="noindex"/>
<meta http-equiv="refresh" content="0;url={{ target | url }}"/>
{% endblock meta %}
{% block content %}
Expand Down
8 changes: 4 additions & 4 deletions pages/views/examples/embedded-video.njk
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ aside:
{# <div class="alert alert-info">Video bellow will be loading only on XS breakpoint</div>#}
{# <div class="img-container img-container-16-9">#}
{# <esl-media load-condition="@XS, @MOBILE"#}
{# media-type="youtube"#}
{# media-id="e1omOSkYltw"#}
{# autoplay="true"#}
{# muted loop>#}
{# media-type="youtube"#}
{# media-id="e1omOSkYltw"#}
{# autoplay="true"#}
{# muted loop>#}
{# </esl-media>#}
{# </div>#}
{# </div>#}
Expand Down