...
 
Commits (28)
image: node:latest
include:
- template: Security/License-Management.gitlab-ci.yml
- template: License-Scanning.gitlab-ci.yml
stages:
- prepare
......@@ -120,6 +120,7 @@ Node 13.x (current):
Release:
stage: release
image: node:12
only:
- web
variables:
......@@ -128,7 +129,7 @@ Release:
GIT_COMMITTER_NAME: "David Sveningsson"
GIT_COMMITTER_EMAIL: "ext@sidvind.com"
script:
- npm run semantic-release
- npm run semantic-release -- --debug
.downstream: &downstream
stage: postrelease
......
# html-validate changelog
# [2.18.0](https://gitlab.com/html-validate/html-validate/compare/v2.17.1...v2.18.0) (2020-03-11)
### Bug Fixes
- validate `input[list]` ([9c70db2](https://gitlab.com/html-validate/html-validate/commit/9c70db243aa3fa0c9243bc6fd6a206bac28a5873))
- **rules:** `no-dup-id` handles when id is set but omitted value ([5f678a5](https://gitlab.com/html-validate/html-validate/commit/5f678a566c006d50b90fee23d140b5f49784b0e0))
- **rules:** `no-missing-references` ignores omitted references ([b8863cd](https://gitlab.com/html-validate/html-validate/commit/b8863cd8ebd8c5c05e97ef9e5e662f406aa1cb92))
- **rules:** add contextual documentation for `deprecated` ([7fbf433](https://gitlab.com/html-validate/html-validate/commit/7fbf433f9ce70ce34759448936d40c7dd96f55ae))
- **rules:** add contextual documentation for `element-name` ([2a98bad](https://gitlab.com/html-validate/html-validate/commit/2a98bada16a15c802a3e050e9274153237e916fd))
- **rules:** better and more contextual messages for `deprecated` ([3602be7](https://gitlab.com/html-validate/html-validate/commit/3602be730dd2ec54e1de702171ce606e4043c02a))
- **rules:** contextual documentation for `deprecated-rule` ([8b10601](https://gitlab.com/html-validate/html-validate/commit/8b10601405f74ddbe62a6d666153dece1b3ad9a4))
- **rules:** improve documentation for `doctype-html` ([1a896a8](https://gitlab.com/html-validate/html-validate/commit/1a896a87f8e7c253e4d21faf01aae6f52df754f8))
- **shim:** expose `ConfigError` and `UserError` ([2d002c7](https://gitlab.com/html-validate/html-validate/commit/2d002c79f1f6f088c1792de768ba80777629b739))
- **transform:** ignore non-string values in `TemplateExtractor` ([7f27c8b](https://gitlab.com/html-validate/html-validate/commit/7f27c8b6b0ff4f4afd85501b0b554886742b5c6f))
- allow both null and empty string when attribute allows empty values ([5b6991b](https://gitlab.com/html-validate/html-validate/commit/5b6991b6ea7d8b4418168b1f9d0f8bef7cac935e))
### Features
- `attribute-allowed-values` handle omitted values ([962d079](https://gitlab.com/html-validate/html-validate/commit/962d0791dae6ad4fed663909556c480f5789cd81))
- new rule `attribute-empty-style` ([a328b55](https://gitlab.com/html-validate/html-validate/commit/a328b558adced37c05b76dddd6cf6f83d36fe72d))
## [2.17.1](https://gitlab.com/html-validate/html-validate/compare/v2.17.0...v2.17.1) (2020-03-02)
### Bug Fixes
......
......@@ -74,7 +74,9 @@ Array [
},
Object {
"column": 4,
"context": undefined,
"context": Object {
"tagName": "my-deprecated",
},
"line": 3,
"message": "<my-deprecated> is deprecated: replaced with <my-other>",
"offset": 39,
......@@ -123,7 +125,11 @@ Array [
},
Object {
"column": 6,
"context": undefined,
"context": Object {
"documentation": "\`<blink>\` has no direct replacement and blinking text is frowned upon by accessibility standards.",
"source": "non-standard",
"tagName": "blink",
},
"line": 8,
"message": "<blink> is deprecated",
"offset": 138,
......
......@@ -5,9 +5,27 @@ exports[`docs/rules/attribute-allowed-values.md inline validation: correct 1`] =
exports[`docs/rules/attribute-allowed-values.md inline validation: incorrect 1`] = `
Array [
Object {
"errorCount": 1,
"errorCount": 2,
"filePath": "inline",
"messages": Array [
Object {
"column": 4,
"context": Object {
"allowed": Array [
/\\.\\*/,
],
"attribute": "href",
"element": "a",
"value": "",
},
"line": 1,
"message": "Attribute \\"href\\" is missing value",
"offset": 3,
"ruleId": "attribute-allowed-values",
"selector": "a",
"severity": 2,
"size": 4,
},
Object {
"column": 14,
"context": Object {
......@@ -39,16 +57,17 @@ Array [
"element": "input",
"value": "foobar",
},
"line": 1,
"line": 2,
"message": "Attribute \\"type\\" has invalid value \\"foobar\\"",
"offset": 13,
"offset": 29,
"ruleId": "attribute-allowed-values",
"selector": "input",
"severity": 2,
"size": 6,
},
],
"source": "<input type=\\"foobar\\">",
"source": "<a href>...</a>
<input type=\\"foobar\\">",
"warningCount": 0,
},
]
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`docs/rules/attribute-empty-style.md inline validation: correct 1`] = `Array []`;
exports[`docs/rules/attribute-empty-style.md inline validation: incorrect 1`] = `
Array [
Object {
"errorCount": 1,
"filePath": "inline",
"messages": Array [
Object {
"column": 4,
"context": undefined,
"line": 1,
"message": "Attribute \\"download\\" should omit value",
"offset": 3,
"ruleId": "attribute-empty-style",
"selector": "a",
"severity": 2,
"size": 8,
},
],
"source": "<a download=\\"\\"></a>",
"warningCount": 0,
},
]
`;
......@@ -10,7 +10,9 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"tagName": "my-element",
},
"line": 1,
"message": "<my-element> is deprecated: replaced with <other-element>",
"offset": 1,
......@@ -34,9 +36,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use the CSS \`text-align\` or \`margin: auto\` properties instead.",
"message": "use CSS instead",
"source": "html4",
"tagName": "center",
},
"line": 1,
"message": "<center> is deprecated",
"message": "<center> is deprecated: use CSS instead",
"offset": 1,
"ruleId": "deprecated",
"selector": "center",
......@@ -45,9 +52,14 @@ Array [
},
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS \`font-size\` property instead.",
"message": "use CSS instead",
"source": "html5",
"tagName": "big",
},
"line": 2,
"message": "<big> is deprecated",
"message": "<big> is deprecated: use CSS instead",
"offset": 22,
"ruleId": "deprecated",
"selector": "big",
......
......@@ -10,7 +10,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"blacklist": Array [],
"pattern": "^[a-z][a-z0-9\\\\-._]*-[a-z0-9\\\\-._]*$",
"tagName": "foobar",
},
"line": 1,
"message": "<foobar> is not a valid element name",
"offset": 1,
......
import HtmlValidate from "../../../src/htmlvalidate";
const markup: { [key: string]: string } = {};
markup["incorrect"] = `<input type="foobar">`;
markup["correct"] = `<input type="text">`;
markup["incorrect"] = `<a href>...</a>
<input type="foobar">`;
markup["correct"] = `<a href="page.html">...</a>
<input type="text">`;
describe("docs/rules/attribute-allowed-values.md", () => {
it("inline validation: incorrect", () => {
......
import HtmlValidate from "../../../src/htmlvalidate";
const markup: { [key: string]: string } = {};
markup["incorrect"] = `<a download=""></a>`;
markup["correct"] = `<a download></a>`;
describe("docs/rules/attribute-empty-style.md", () => {
it("inline validation: incorrect", () => {
const htmlvalidate = new HtmlValidate({"rules":{"attribute-empty-style":"error"}});
const report = htmlvalidate.validateString(markup["incorrect"]);
expect(report.results).toMatchSnapshot();
});
it("inline validation: correct", () => {
const htmlvalidate = new HtmlValidate({"rules":{"attribute-empty-style":"error"}});
const report = htmlvalidate.validateString(markup["correct"]);
expect(report.results).toMatchSnapshot();
});
});
......@@ -28,11 +28,13 @@ The requirements comes from the [element metadata](/usage/elements.html):
Examples of **incorrect** code for this rule:
<validate name="incorrect" rules="attribute-allowed-values">
<a href>...</a>
<input type="foobar">
</validate>
Examples of **correct** code for this rule:
<validate name="correct" rules="attribute-allowed-values">
<a href="page.html">...</a>
<input type="text">
</validate>
......@@ -7,7 +7,19 @@ summary: Require a specific style for boolean attributes
# Boolean attribute style (`attribute-boolean-style`)
Require a specific style when writing boolean attributes.
Boolean attributes are attributes without a value and the presence of the attribute is considered a boolean `true` and absense a boolean `false`.
The [HTML5 standard][whatwg] allows three styles to write boolean attributes:
- `<input required>` (omitting the value)
- `<input required="">` (empty string)
- `<input required="required">` (attribute name)
This rule requires a specific style when writing boolean attributes.
Default is to omit the value.
This rule does not have an effect on regular attributes with empty values, see {@link attribute-empty-style} instead.
[whatwg]: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
## Rule details
......
---
docType: rule
name: attribute-empty-style
category: style
summary: Require a specific style for empty attributes
---
# Empty attribute style (`attribute-empty-style`)
Attributes without a value is implied to be an empty string by the [HTML5 standard][whatwg], e.g. `<a download>` and `<a download="">` are equal.
This rule requires a specific style when writing empty attributes.
Default is to omit the empty string `""`.
This rule does not have an effect on boolean attributes, see {@link attribute-boolean-style} instead.
[whatwg]: https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
## Rule details
Examples of **incorrect** code for this rule:
<validate name="incorrect" rules="attribute-empty-style">
<a download=""></a>
</validate>
Examples of **correct** code for this rule:
<validate name="correct" rules="attribute-empty-style">
<a download></a>
</validate>
## Options
This rule takes an optional object:
```javascript
{
"style": "omit"
}
```
### Style
- `omit` require empty attributes to omit value, e.g. `<a download></a>`
- `empty` require empty attributes to be empty string, e.g. `<a download=""></a>`
......@@ -5,17 +5,18 @@ category: document
summary: Require all element references to exist
---
# no missing references (`no-missing-references`)
# No missing references (`no-missing-references`)
Require all elements referenced by attributes such as `for` to exist in the
current document.
Checked attributes:
- `for`
- `aria-controls`
- `aria-describedby`
- `aria-labelledby`
- `label[for]`
- `input[list]`
- `*[aria-controls]`
- `*[aria-describedby]`
- `*[aria-labelledby]`
## Rule details
......
......@@ -32,7 +32,7 @@ export interface MetaElement {
interactive: boolean | PropertyExpression;
/* element properties */
deprecated: boolean | string;
deprecated: boolean | string | DeprecatedElement;
foreign: boolean;
void: boolean;
transparent: boolean;
......@@ -101,8 +101,35 @@ The available evaluators are:
### `deprecated`
If true the element will trigger the [deprecated](/rules/deprecated.html) rule
when used. Can optionally be set to a string which will be displayed as well.
If truthy the element will trigger the [deprecated](/rules/deprecated.html) rule
when used.
Can be set to `true`, a string or an object.
```typescript
interface DeprecatedElement {
message?: string;
documentation?: string;
source?: string;
}
```
Setting `true` is the same as the empty object.
Setting a string is the same as setting `message` to the string.
If the `message` property is set the text will be displayed in the error message.
If the `documentation` property is set the text will be rendered as markdown and shown in the contextual documentation shown by editors.
`$tagname` can be used as a placeholder in the text.
If the `source` property is set it is used to help the end-user to understand when and by what it is deprecated.
It can be set to:
- HTML major revision, e.g. `html5` or `html4`.
- HTML minor revision, e.g. `html53` or `html32`.
- `whatwg`: WHATWG Living Standard.
- `non-standard`: non-standard element implemented only by one or few browsers.
- your library or application name.
### `foreign`
......@@ -169,13 +196,16 @@ An object with allowed attribute values.
With this metadata the attribute `"foo"` may only have the values `"bar"` or
`"foo"`.
- To allow empty values explicitly list `""`:
`"my-attr": ["", "value 1", "value 2"]`
- Boolean attributes must be set to an empty list `[]`:
`"my-attr": []`
Regular expressions can also be used, e.g `"/-?\\d+/"` to match numbers.
- To allow empty values explicitly list `""`:
- `"my-attr": ["", "value 1", "value 2"]`
- Boolean attributes must be set to an empty list `[]` or include `""`:
- `"my-attr": []`
- `"my-attr": [""]`
- To allow empty string `my-attr=""` but not omitted value `my-attr` use regexp:
- `"my-attr": ["/.*/"]`
This is used by the
[attribute-allowed-values](/rules/attribute-allowed-values.html) rule.
......
......@@ -3,7 +3,7 @@
exports[`HTML elements <a> invalid markup 1`] = `
Array [
Object {
"errorCount": 4,
"errorCount": 5,
"filePath": "test-files/elements/a-invalid.html",
"messages": Array [
Object {
......@@ -50,6 +50,24 @@ Array [
"severity": 2,
"size": 1,
},
Object {
"column": 4,
"context": Object {
"allowed": Array [
/\\.\\*/,
],
"attribute": "href",
"element": "a",
"value": "",
},
"line": 12,
"message": "Attribute \\"href\\" is missing value",
"offset": 341,
"ruleId": "attribute-allowed-values",
"selector": "a:nth-child(5)",
"severity": 2,
"size": 4,
},
],
"source": "<!-- should be transparent -->
<span><a><div>foo</div></a></span>
......@@ -60,6 +78,9 @@ Array [
<!-- should not allow nesting -->
<a><span><a>foo</a></span></a>
<!-- should not allow omitted href value -->
<a href>foo</a>
",
"warningCount": 0,
},
......@@ -104,9 +125,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "\`<abbr>\` can be used as a replacement.",
"message": "use <abbr> instead",
"source": "html5",
"tagName": "acronym",
},
"line": 2,
"message": "<acronym> is deprecated",
"message": "<acronym> is deprecated: use <abbr> instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "acronym",
......@@ -214,7 +240,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "html5",
"tagName": "applet",
},
"line": 2,
"message": "<applet> is deprecated",
"offset": 32,
......@@ -601,9 +630,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS \`font-size\` property instead.",
"message": "use CSS instead",
"source": "html4",
"tagName": "basefont",
},
"line": 2,
"message": "<basefont> is deprecated",
"message": "<basefont> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "basefont",
......@@ -685,9 +719,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use the \`<audio>\` element instead but consider accessibility concerns with autoplaying sounds.",
"message": "use <audio> instead",
"source": "non-standard",
"tagName": "bgsound",
},
"line": 2,
"message": "<bgsound> is deprecated",
"message": "<bgsound> is deprecated: use <audio> instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "bgsound",
......@@ -713,9 +752,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS \`font-size\` property instead.",
"message": "use CSS instead",
"source": "html5",
"tagName": "big",
},
"line": 2,
"message": "<big> is deprecated",
"message": "<big> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "big",
......@@ -741,7 +785,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "\`<blink>\` has no direct replacement and blinking text is frowned upon by accessibility standards.",
"source": "non-standard",
"tagName": "blink",
},
"line": 2,
"message": "<blink> is deprecated",
"offset": 32,
......@@ -1039,9 +1087,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use the CSS \`text-align\` or \`margin: auto\` properties instead.",
"message": "use CSS instead",
"source": "html4",
"tagName": "center",
},
"line": 2,
"message": "<center> is deprecated",
"message": "<center> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "center",
......@@ -1429,7 +1482,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "The non-standard \`<dir>\` element has no direct replacement but MDN recommends replacing with \`<ul>\` and CSS.",
"source": "html4",
"tagName": "dir",
},
"line": 2,
"message": "<dir> is deprecated",
"offset": 32,
......@@ -1820,9 +1877,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS font properties instead.",
"message": "use CSS instead",
"source": "html4",
"tagName": "font",
},
"line": 2,
"message": "<font> is deprecated",
"message": "<font> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "font",
......@@ -1948,7 +2010,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "The \`<frame>\` element can be replaced with the \`<iframe>\` element but a better solution is to remove usage of frames entirely.",
"source": "html5",
"tagName": "frame",
},
"line": 2,
"message": "<frame> is deprecated",
"offset": 32,
......@@ -1994,7 +2060,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "The \`<frameset>\` element can be replaced with the \`<iframe>\` element but a better solution is to remove usage of frames entirely.",
"source": "html5",
"tagName": "frameset",
},
"line": 2,
"message": "<frameset> is deprecated",
"offset": 32,
......@@ -2538,7 +2608,9 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"tagName": "hgroup",
},
"line": 2,
"message": "<hgroup> is deprecated",
"offset": 32,
......@@ -3231,7 +3303,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "html4",
"tagName": "isindex",
},
"line": 2,
"message": "<isindex> is deprecated",
"offset": 32,
......@@ -3481,7 +3556,7 @@ Array [
"size": 4,
},
Object {
"column": 2,
"column": 21,
"context": Object {
"allowed": Array [
/\\.\\+/,
......@@ -3491,12 +3566,12 @@ Array [
"value": "",
},
"line": 9,
"message": "Attribute \\"integrity\\" has invalid value \\"\\"",
"offset": 182,
"message": "Attribute \\"integrity\\" is missing value",
"offset": 201,
"ruleId": "attribute-allowed-values",
"selector": "link:nth-child(4)",
"severity": 2,
"size": 4,
"size": 9,
},
Object {
"column": 2,
......@@ -3543,7 +3618,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "html32",
"tagName": "listing",
},
"line": 2,
"message": "<listing> is deprecated",
"offset": 32,
......@@ -3607,7 +3685,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Marked as obsolete by both W3C and WHATWG standards but still implemented in most browsers. Animated text should be avoided for accessibility reasons as well.",
"source": "html5",
"tagName": "marquee",
},
"line": 2,
"message": "<marquee> is deprecated",
"offset": 32,
......@@ -3634,7 +3716,7 @@ Array [
"filePath": "test-files/elements/math-invalid.html",
"messages": Array [
Object {
"column": 2,
"column": 7,
"context": Object {
"allowed": Array [
"ltr",
......@@ -3648,12 +3730,12 @@ Array [
"value": "",
},
"line": 2,
"message": "Attribute \\"dir\\" has invalid value \\"\\"",
"offset": 32,
"message": "Attribute \\"dir\\" is missing value",
"offset": 37,
"ruleId": "attribute-allowed-values",
"selector": "math:nth-child(1)",
"severity": 2,
"size": 4,
"size": 3,
},
Object {
"column": 12,
......@@ -3678,7 +3760,7 @@ Array [
"size": 6,
},
Object {
"column": 2,
"column": 7,
"context": Object {
"allowed": Array [
"block",
......@@ -3689,12 +3771,12 @@ Array [
"value": "",
},
"line": 4,
"message": "Attribute \\"display\\" has invalid value \\"\\"",
"offset": 77,
"message": "Attribute \\"display\\" is missing value",
"offset": 82,
"ruleId": "attribute-allowed-values",
"selector": "math:nth-child(3)",
"severity": 2,
"size": 4,
"size": 7,
},
Object {
"column": 16,
......@@ -3716,7 +3798,7 @@ Array [
"size": 6,
},
Object {
"column": 2,
"column": 7,
"context": Object {
"allowed": Array [
"linebreak",
......@@ -3730,12 +3812,12 @@ Array [
"value": "",
},
"line": 6,
"message": "Attribute \\"overflow\\" has invalid value \\"\\"",
"offset": 130,
"message": "Attribute \\"overflow\\" is missing value",
"offset": 135,
"ruleId": "attribute-allowed-values",
"selector": "math:nth-child(5)",
"severity": 2,
"size": 4,
"size": 8,
},
Object {
"column": 17,
......@@ -3857,9 +3939,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS columns instead.",
"message": "use CSS instead",
"source": "html5",
"tagName": "multicol",
},
"line": 2,
"message": "<multicol> is deprecated",
"message": "<multicol> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "multicol",
......@@ -3915,7 +4002,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "html32",
"tagName": "nextid",
},
"line": 2,
"message": "<nextid> is deprecated",
"offset": 32,
......@@ -3943,9 +4033,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS \`white-space\` property instead.",
"message": "use CSS instead",
"source": "non-standard",
"tagName": "nobr",
},
"line": 2,
"message": "<nobr> is deprecated",
"message": "<nobr> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "nobr",
......@@ -3971,7 +4066,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "non-standard",
"tagName": "noembed",
},
"line": 2,
"message": "<noembed> is deprecated",
"offset": 32,
......@@ -3999,7 +4097,10 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"source": "html5",
"tagName": "noframes",
},
"line": 2,
"message": "<noframes> is deprecated",
"offset": 32,
......@@ -4037,7 +4138,7 @@ Array [
"size": 8,
},
Object {
"column": 2,
"column": 9,
"context": Object {
"allowed": Array [
/\\.\\+/,
......@@ -4047,12 +4148,12 @@ Array [
"value": "",
},
"line": 7,
"message": "Attribute \\"integrity\\" has invalid value \\"\\"",
"offset": 131,
"message": "Attribute \\"integrity\\" is missing value",
"offset": 138,
"ruleId": "attribute-allowed-values",
"selector": "script:nth-child(2)",
"severity": 2,
"size": 6,
"size": 9,
},
Object {
"column": 2,
......@@ -4456,9 +4557,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use the \`<pre>\` element or use CSS to set a monospace font.",
"message": "use <pre> or CSS instead",
"source": "html2",
"tagName": "plaintext",
},
"line": 2,
"message": "<plaintext> is deprecated",
"message": "<plaintext> is deprecated: use <pre> or CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "plaintext",
......@@ -5116,9 +5222,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use CSS margin or padding instead.",
"message": "use CSS instead",
"source": "non-standard",
"tagName": "spacer",
},
"line": 2,
"message": "<spacer> is deprecated",
"message": "<spacer> is deprecated: use CSS instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "spacer",
......@@ -5172,9 +5283,14 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use the \`<del>\` or \`<s>\` element instead.",
"message": "use <del> or <s> instead",
"source": "html5",
"tagName": "strike",
},
"line": 2,
"message": "<strike> is deprecated",
"message": "<strike> is deprecated: use <del> or <s> instead",
"offset": 32,
"ruleId": "deprecated",
"selector": "strike",
......@@ -6045,7 +6161,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use a more semantically correct element such as \`<code>\`, \`<var>\` or \`<pre>\`.",
"source": "html4",
"tagName": "tt",
},
"line": 2,
"message": "<tt> is deprecated",
"offset": 32,
......@@ -6315,7 +6435,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "Use \`<pre>\` or \`<code>\` and escape content using HTML entities instead.",
"source": "html32",
"tagName": "xmp",
},
"line": 2,
"message": "<xmp> is deprecated",
"offset": 32,
......
......@@ -25,6 +25,10 @@
"name",
"urn"
],
"attributes": {
"download": ["", "/.+/"],
"href": ["/.*/"]
},
"permittedDescendants": [{ "exclude": "@interactive" }]
},
......@@ -35,7 +39,11 @@
},
"acronym": {
"deprecated": true
"deprecated": {
"message": "use <abbr> instead",
"documentation": "`<abbr>` can be used as a replacement.",
"source": "html5"
}
},
"address": {
......@@ -47,7 +55,9 @@
},
"applet": {
"deprecated": true,
"deprecated": {
"source": "html5"
},
"deprecatedAttributes": ["datasrc", "datafld"]
},
......@@ -102,7 +112,11 @@
},
"basefont": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS `font-size` property instead.",
"source": "html4"
}
},
"bdi": {
......@@ -118,15 +132,26 @@
},
"bgsound": {
"deprecated": true
"deprecated": {
"message": "use <audio> instead",
"documentation": "Use the `<audio>` element instead but consider accessibility concerns with autoplaying sounds.",
"source": "non-standard"
}
},
"big": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS `font-size` property instead.",
"source": "html5"
}
},
"blink": {
"deprecated": true
"deprecated": {
"documentation": "`<blink>` has no direct replacement and blinking text is frowned upon by accessibility standards.",
"source": "non-standard"
}
},
"blockquote": {
......@@ -188,7 +213,11 @@
},
"center": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use the CSS `text-align` or `margin: auto` properties instead.",
"source": "html4"
}
},
"cite": {
......@@ -251,7 +280,10 @@
},
"dir": {
"deprecated": true
"deprecated": {
"documentation": "The non-standard `<dir>` element has no direct replacement but MDN recommends replacing with `<ul>` and CSS.",
"source": "html4"
}
},
"div": {
......@@ -314,7 +346,11 @@
},
"font": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS font properties instead.",
"source": "html4"
}
},
"footer": {
......@@ -337,13 +373,19 @@
},
"frame": {
"deprecated": true,
"deprecated": {
"documentation": "The `<frame>` element can be replaced with the `<iframe>` element but a better solution is to remove usage of frames entirely.",
"source": "html5"
},
"deprecatedAttributes": ["datasrc", "datafld"],
"requiredAttributes": ["title"]
},
"frameset": {
"deprecated": true
"deprecated": {
"documentation": "The `<frameset>` element can be replaced with the `<iframe>` element but a better solution is to remove usage of frames entirely.",
"source": "html5"
}
},
"h1": {
......@@ -543,7 +585,9 @@
},
"isindex": {
"deprecated": true
"deprecated": {
"source": "html4"
}
},
"kbd": {
......@@ -592,7 +636,9 @@
},
"listing": {
"deprecated": true
"deprecated": {
"source": "html32"
}
},
"main": {
......@@ -612,7 +658,10 @@
},
"marquee": {
"deprecated": true,
"deprecated": {
"documentation": "Marked as obsolete by both W3C and WHATWG standards but still implemented in most browsers. Animated text should be avoided for accessibility reasons as well.",
"source": "html5"
},
"deprecatedAttributes": ["datasrc", "datafld", "dataformatas"]
},
......@@ -643,7 +692,11 @@
},
"multicol": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS columns instead.",
"source": "html5"
}
},
"nav": {
......@@ -654,19 +707,29 @@
},
"nextid": {
"deprecated": true
"deprecated": {
"source": "html32"
}
},
"nobr": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS `white-space` property instead.",
"source": "non-standard"
}
},
"noembed": {
"deprecated": true
"deprecated": {
"source": "non-standard"
}
},
"noframes": {
"deprecated": true
"deprecated": {
"source": "html5"
}
},
"noscript": {
......@@ -788,7 +851,11 @@
},
"plaintext": {
"deprecated": true
"deprecated": {
"message": "use <pre> or CSS instead",
"documentation": "Use the `<pre>` element or use CSS to set a monospace font.",
"source": "html2"
}
},
"pre": {
......@@ -908,7 +975,11 @@
},
"spacer": {
"deprecated": true
"deprecated": {
"message": "use CSS instead",
"documentation": "Use CSS margin or padding instead.",
"source": "non-standard"
}
},
"span": {
......@@ -919,7 +990,11 @@
},
"strike": {
"deprecated": true
"deprecated": {
"message": "use <del> or <s> instead",
"documentation": "Use the `<del>` or `<s>` element instead.",
"source": "html5"
}
},
"strong": {
......@@ -1124,7 +1199,10 @@
},
"tt": {
"deprecated": true
"deprecated": {
"documentation": "Use a more semantically correct element such as `<code>`, `<var>` or `<pre>`.",
"source": "html4"
}
},
"u": {
......@@ -1166,6 +1244,9 @@
},
"xmp": {
"deprecated": true
"deprecated": {
"documentation": "Use `<pre>` or `<code>` and escape content using HTML entities instead.",
"source": "html32"
}
}
}
......@@ -153,8 +153,9 @@ describe("HTML elements", () => {
},
],
rules: {
/* allow any style of boolean attributes, some tests runs all of them */
/* allow any style of boolean/empty attributes, some tests runs all of them */
"attribute-boolean-style": "off",
"attribute-empty-style": "off",
/* messes with tests validating that elements with support implicit close
* does so */
......
This diff is collapsed.
{
"name": "html-validate",
"version": "2.17.1",
"version": "2.18.0",
"description": "html linter",
"keywords": [
"html",
......@@ -92,8 +92,8 @@
"minimist": "^1.2.0"
},
"devDependencies": {
"@babel/core": "7.8.6",
"@babel/preset-env": "7.8.6",
"@babel/core": "7.8.7",
"@babel/preset-env": "7.8.7",
"@commitlint/cli": "8.3.5",
"@html-validate/commitlint-config": "1.0.1",
"@html-validate/eslint-config": "1.1.4",
......@@ -103,7 +103,7 @@
"@types/estree": "0.0.42",
"@types/glob": "7.1.1",
"@types/inquirer": "6.5.0",
"@types/jest": "25.1.3",
"@types/jest": "25.1.4",
"@types/json-merge-patch": "0.0.4",
"@types/minimist": "1.2.0",
"@types/node": "11.15.7",
......
......@@ -8,7 +8,7 @@ exports[`toBeToken() should fail if token doesn't match 1`] = `
Expected token to equal:
ObjectContaining {\\"type\\": \\"TAG_CLOSE\\"}
Received:
{\\"data\\": [\\"<foo\\", \\"\\", \\"foo\\"], \\"location\\": {\\"column\\": 2, \\"filename\\": \\"inline\\", \\"line\\": 1, \\"offset\\": 1}, \\"type\\": 6}
{\\"data\\": [\\"<foo\\", \\"\\", \\"foo\\"], \\"location\\": {\\"column\\": 2, \\"filename\\": \\"inline\\", \\"line\\": 1, \\"offset\\": 1, \\"size\\": 1}, \\"type\\": 6}
Difference:
......@@ -28,6 +28,7 @@ Difference:
+ \\"filename\\": \\"inline\\",
+ \\"line\\": 1,
+ \\"offset\\": 1,
+ \\"size\\": 1,
+ },
+ \\"type\\": 6,
}"
......
......@@ -175,7 +175,11 @@ Array [
"messages": Array [
Object {
"column": 2,
"context": undefined,
"context": Object {
"documentation": "\`<blink>\` has no direct replacement and blinking text is frowned upon by accessibility standards.",
"source": "non-standard",
"tagName": "blink",
},
"line": 1,
"message": "<blink> is deprecated",
"offset": 1,
......@@ -291,7 +295,9 @@ Array [
"messages": Array [
Object {
"column": 3,
"context": undefined,
"context": Object {
"tagName": "deprecated",
},
"line": 2,
"message": "<deprecated> is deprecated",
"offset": 8,
......
export { Config } from "./config";
export { ConfigData, RuleConfig } from "./config-data";
export { ConfigLoader } from "./config-loader";
export { ConfigError } from "./error";
export { Severity } from "./severity";
......@@ -4,6 +4,7 @@ module.exports = {
"attr-quotes": "error",
"attribute-allowed-values": "error",
"attribute-boolean-style": "error",
"attribute-empty-style": "error",
"close-attr": "error",
"close-order": "error",
deprecated: "error",
......
......@@ -21,10 +21,10 @@ export interface Location {
readonly column: number;
/**
* If set it contains how many characters this location refers to. This
* includes any whitespace characters such as newlines.
* The number of characters this location refers to. This includes any
* whitespace characters such as newlines.
*/
readonly size?: number;
readonly size: number;
}
interface LocationRW {
......@@ -32,7 +32,7 @@ interface LocationRW {
offset: number;
line: number;
column: number;
size?: number;
size: number;
}
function sliceSize(size: number, begin: number, end?: number): number {
......
......@@ -655,6 +655,7 @@ describe("HtmlElement", () => {
offset: 0,
line: 1,
column: 1,
size: 1,
});
/* eslint-disable @typescript-eslint/no-unused-vars */
const a = new HtmlElement("a", root);
......
......@@ -31,6 +31,7 @@ class MockParser extends Parser {
line: 1,
column: 1,
offset: 0,
size: 1,
},
"invalid token error"
);
......@@ -41,6 +42,7 @@ class MockParser extends Parser {
line: 1,
column: 1,
offset: 0,
size: 1,
},
"parser error"
);
......@@ -110,7 +112,7 @@ describe("Engine", () => {
"ruleId": "parser-error",
"selector": null,
"severity": 2,
"size": 0,
"size": 1,
},
],
"source": "invalid-token-error",
......@@ -137,7 +139,7 @@ describe("Engine", () => {
"ruleId": "parser-error",
"selector": null,
"severity": 2,
"size": 0,
"size": 1,
},
],
"source": "parser-error",
......
......@@ -167,6 +167,7 @@ describe("toBeToken()", () => {
line: 1,
column: 2,
offset: 1,
size: 1,
},
};
......
......@@ -14,6 +14,12 @@ export interface PermittedAttribute {
[key: string]: Array<string | RegExp>;
}