Commits (30)
......@@ -35,12 +35,12 @@
"allowExpressions": true
}
],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/no-angle-bracket-type-assertion": "error",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-triple-slash-reference": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
......@@ -75,6 +75,12 @@
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-identical-functions": "off"
}
},
{
"files": "*.js",
"rules": {
"@typescript-eslint/explicit-function-return-type": "off"
}
}
]
}
......@@ -80,7 +80,8 @@ Docs:
junit: temp/jest.xml
script:
- npm run build:docs
- ./bin/html-validate.js docs/**/*.html public/**/.html
- npm run htmlvalidate -- --config docs/htmlvalidate-templates.json 'docs/**/*.html'
- npm run htmlvalidate -- --config docs/htmlvalidate-public.json 'public/**/*.html'
- npm test -- docs
- git status
- test -z "$(git status --porcelain)" || (echo 'working copy dirty, need to commit updated specs'; exit 1)
......
## Checklist
- [ ] Changelog updated
- [ ] Documentation updated
- [ ] Change covered by a testcase
- [ ] Commit history cleaned (no WIP, fixups, etc)
......
## Checklist
- [ ] Changelog updated
- [ ] Documentation updated
- [ ] Change covered by a testcase
- [ ] Commit history cleaned (no WIP, fixups, etc)
## Checklist
- [ ] Changelog updated
- [ ] Documentation updated
- [ ] Rule added to recommended list
- [ ] Change covered by a testcase
......
......@@ -2,20 +2,38 @@
# [1.4.0](https://gitlab.com/html-validate/html-validate/compare/v1.3.0...v1.4.0) (2019-08-15)
# [1.5.0](https://gitlab.com/html-validate/html-validate/compare/v1.4.0...v1.5.0) (2019-08-17)
### Bug Fixes
* **deps:** update dependency acorn-walk to v7 ([1fe89e0](https://gitlab.com/html-validate/html-validate/commit/1fe89e0))
* **reporter:** fix {error,warning}Count after merging reports ([bc657d0](https://gitlab.com/html-validate/html-validate/commit/bc657d0))
* **reporter:** require {error,warning}Count to be present in Result ([b1306a4](https://gitlab.com/html-validate/html-validate/commit/b1306a4))
* **elements:** <img> must have non-empty src ([8916e19](https://gitlab.com/html-validate/html-validate/commit/8916e19))
* **rules:** change output format of wcag/h37 and element-required-attributes to match ([26f5074](https://gitlab.com/html-validate/html-validate/commit/26f5074))
### Features
* **cli:** add --config to specify a custom configuration file ([87b565f](https://gitlab.com/html-validate/html-validate/commit/87b565f))
* **elements:** <fieldset> requires <legend> ([0bce9dd](https://gitlab.com/html-validate/html-validate/commit/0bce9dd))
* **elements:** <head> requires <title> ([8aaa801](https://gitlab.com/html-validate/html-validate/commit/8aaa801))
* **elements:** src, href, etc attributes cannot be empty ([89c7ac6](https://gitlab.com/html-validate/html-validate/commit/89c7ac6))
* **parser:** include valueLocation in doctype event ([803ddae](https://gitlab.com/html-validate/html-validate/commit/803ddae))
* **rules:** new rule doctype-html ([46061a7](https://gitlab.com/html-validate/html-validate/commit/46061a7))
* **rules:** new rule element-required-content ([664dead](https://gitlab.com/html-validate/html-validate/commit/664dead))
* **rules:** new rule no-style-tag ([a1dff5c](https://gitlab.com/html-validate/html-validate/commit/a1dff5c))
# [1.4.0](https://gitlab.com/html-validate/html-validate/compare/v1.3.0...v1.4.0) (2019-08-15)
### Bug Fixes
- **deps:** update dependency acorn-walk to v7 ([1fe89e0](https://gitlab.com/html-validate/html-validate/commit/1fe89e0))
- **reporter:** fix {error,warning}Count after merging reports ([bc657d0](https://gitlab.com/html-validate/html-validate/commit/bc657d0))
- **reporter:** require {error,warning}Count to be present in Result ([b1306a4](https://gitlab.com/html-validate/html-validate/commit/b1306a4))
### Features
* **cli:** add new --max-warnings flag ([e78a1dc](https://gitlab.com/html-validate/html-validate/commit/e78a1dc))
* **reporter:** add {error,warning}Count summary to Report object ([2bae1d0](https://gitlab.com/html-validate/html-validate/commit/2bae1d0))
- **cli:** add new --max-warnings flag ([e78a1dc](https://gitlab.com/html-validate/html-validate/commit/e78a1dc))
- **reporter:** add {error,warning}Count summary to Report object ([2bae1d0](https://gitlab.com/html-validate/html-validate/commit/2bae1d0))
# [1.3.0](https://gitlab.com/html-validate/html-validate/compare/v1.2.1...v1.3.0) (2019-08-12)
......
......@@ -54,12 +54,18 @@ module.exports = function(grunt) {
},
copy: {
fonts: {
fontawesome: {
expand: true,
cwd: "node_modules/font-awesome/fonts",
src: "*",
dest: "public/assets/fonts/",
},
glyphicons: {
expand: true,
cwd: "node_modules/bootstrap-sass/assets/fonts/bootstrap",
src: "*",
dest: "public/assets/fonts/",
},
favicon: {
expand: true,
cwd: "docs/app",
......
......@@ -10,7 +10,7 @@ Array [
"column": 2,
"context": undefined,
"line": 1,
"message": "<img> is missing required alt attribute",
"message": "<img> is missing required \\"alt\\" attribute",
"offset": 1,
"ruleId": "WCAG/H37",
"severity": 2,
......@@ -23,7 +23,7 @@ Array [
"element": "button",
},
"line": 2,
"message": "<button> is missing required attribute \\"type\\"",
"message": "<button> is missing required \\"type\\" attribute",
"offset": 22,
"ruleId": "element-required-attributes",
"severity": 2,
......
$fa-font-path: "fonts";
$icon-font-path: "fonts/";
@import "font-awesome";
@import "bootstrap";
......
......@@ -29,13 +29,18 @@ Emitted after the parsing has finished loading the DOM tree.
```typescript
{
location: Location,
value: string,
valueLocation: Location,
}
```
Emitted when a doctype is encountered. `value` is the doctype (without
`<doctype` and `>`).
`location` refers to the doctype opening tag and `valueLocation` to the value
(as described above)
## `tag:open`
```typescript
......
......@@ -5,7 +5,7 @@
# Transformers
### `TemplateExtractor`
## `TemplateExtractor`
Extracts templates from javascript sources.
......@@ -17,7 +17,7 @@ const te = TemplateExtractor.fromFilename("my-file.js");
const source = te.extractObjectProperty("template");
```
### Source hooks
## Source hooks
Transformers can add hooks for additional processing by setting `source.hooks`:
......@@ -38,13 +38,13 @@ source.hooks = {
};
```
#### `processAttribute`
### `processAttribute`
Called before an attribute is set on `HtmlElement` and can be used to modify
both the key and value. If the attribute is processed with scripting
(e.g. databinding) the value may be replaced with `DynamicValue`.
#### `processElement`
### `processElement`
Called after element is fully created but before children are parsed. Can be
used to manipluate elements (e.g. add dynamic text from frameworks).
......@@ -66,9 +66,9 @@ module.exports = {
};
```
### Callbacks
## Callbacks
#### `init()`
### `init()`
The `init` callback is called once during validation engine initialization and
can be used to initialize resources required later.
......@@ -78,7 +78,7 @@ file (as the configuration might change) thus this callback can still be called
multiple times. If you need initialization that happens exactly once for any
scenario you can run it in your plugin file global scope.
#### `setup(source: Source, eventhandler: EventHandler)`
### `setup(source: Source, eventhandler: EventHandler)`
Called once per source and can be used to prepare the plugin for validation,
e.g. rules that requires initialization.
......@@ -88,7 +88,7 @@ events](/dev/events.html) (same as rules).
The callback may not manpiulate the source object.
### Configuration presets
## Configuration presets
Plugins can create configuration presets similar to a shared configuration:
......@@ -112,7 +112,7 @@ Users may then extend the preset using `plugin:name`, e.g.:
}
```
### Rules
## Rules
See [writing rules](/dev/writing-rules.html) for details on how to write a rules.
......@@ -145,7 +145,7 @@ This makes the rules accessable as usual when configuring in
}
```
### Extend metadata
## Extend metadata
Plugins can extend the available [element metadata](/usage/elements.html) by
setting `elementSchema` with an additional [json
......
......@@ -56,18 +56,18 @@ class MyRule extends Rule<ContextualData> {
}
```
### API
## API
#### `options: {[key: string]: any}`
### `options: {[key: string]: any}`
Object with all the options passed from the configuration.
#### `on(event: string, callback: (event: Event)): void`
### `on(event: string, callback: (event: Event)): void`
Listen for events. See [events](/dev/events.html) for a full list of available
events and data.
#### `report(node: HtmlElement, message: string, location?: Location, context?: T): void`
### `report(node: HtmlElement, message: string, location?: Location, context?: T): void`
Report a new error.
......
......@@ -44,7 +44,10 @@ module.exports = function renderMarkdown(trimIndentation) {
.replace(/\(.*?\)/g, "")
.replace(/[^\w]+/g, "-");
const id = `${this.options.headerPrefix}${slug}`;
const anchor = level > 1 ? ` <a class="anchorlink" href="#${id}"></a>` : "";
const anchor =
level > 1
? ` <!-- [html-validate-disable-next wcag/h30] --><a class="anchorlink" href="#${id}" aria-hidden="true"></a>`
: "";
return `<h${level} id="${id}">${text}${anchor}</h${level}>`;
};
......
/* eslint-disable @typescript-eslint/no-empty-function */
const path = require("canonical-path");
const packagePath = __dirname;
const Package = require("dgeni").Package;
......
{# <!-- [html-validate-disable attr-case: since nunjucks templating is not stripped it flags the attributes as wrong case] --> #}
{# <!-- [html-validate-disable close-order: marked wraps the content in a <p> which breaks the layout, has a hack it is closed and reopened in this template so the final output is ok] --> #}
</p>
<div class="inline-validation">
<div class="markup"
{%- for attrName, attrValue in doc.validate.attributes %}{$ attrName $}="{$ attrValue $}"{% endfor %}>
......@@ -12,3 +14,4 @@
</div>
{%- endif %}
</div>
<p>
{% extends "base.template.html" %}
{% block content %}
<!-- [html-validate-disable no-dup-id, heading-level: changelog generator generates headings with these errors] -->
{$ doc.description | marked $}
{% endblock %}
{
"extends": ["htmlvalidate:recommended", "htmlvalidate:document"],
"rules": {
"no-trailing-whitespace": "off",
"require-sri": "off"
}
}
{
"extends": ["htmlvalidate:recommended"]
}
......@@ -54,7 +54,7 @@ element is missing.
**Learn more about [writing element metadata](usage/elements.html) for custom
components.**
### Accessibility
### Accessibility tests
Validates technical aspects of <abbr title="accessibility">a11y</abbr>
guidelines such as WCAG 2.1.
......