Skip to content

Commit 599b46c

Browse files
committed
Chore: Update docs to webhint 6.1.10
1 parent fed6c65 commit 599b46c

File tree

158 files changed

+590
-699
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+590
-699
lines changed

docs/docs/contributor-guide/getting-started/events/index.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<span class="hljs-keyword">export</span> <span class="hljs-keyword">type</span> <span class="hljs-title class_">StyleParse</span> = <span class="hljs-title class_">Event</span> &amp; &#123;
88
<span class="hljs-attr">ast</span>: <span class="hljs-title class_">Root</span>;
99
<span class="hljs-attr">code</span>: <span class="hljs-built_in">string</span>;
10-
<span class="hljs-attr">element</span>: HTMLElement | <span class="hljs-literal">null</span>;
10+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span> | <span class="hljs-literal">null</span>;
1111
&#125;;
1212

1313
<span class="hljs-keyword">export</span> <span class="hljs-keyword">type</span> <span class="hljs-title class_">StyleEvents</span> = <span class="hljs-title class_">Events</span> &amp; &#123;
@@ -47,13 +47,13 @@ <h2 id=elementltelement-typegt><code>element::&lt;element-type&gt;</code><a href
4747
<span class="hljs-comment">/** The URI of the resource firing this event. */</span>
4848
<span class="hljs-attr">resource</span>: <span class="hljs-built_in">string</span>;
4949
<span class="hljs-comment">/** The visited element. */</span>
50-
<span class="hljs-attr">element</span>: HTMLElement;
50+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span>;
5151
&#125;</pre></td></tr></table></figure><h2 id=fetchendltresource-typegt><code>fetch::end::&lt;resource-type&gt;</code><a href="#fetchendltresource-typegt" class="headerlink" title="fetch::end::&lt;resource-type&gt;"></a></h2><p>Event is emitted <strong>when</strong> the content of a <code>resource</code> (<code>js</code>, <code>css</code>,
5252
<code>image</code>, etc.) has finished downloading.</p>
5353
<p><strong>Format:</strong></p>
5454
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">type</span> <span class="hljs-title class_">FetchEnd</span> = &#123;
5555
<span class="hljs-comment">/** The element that initiated the request. */</span>
56-
<span class="hljs-attr">element</span>: HTMLElement;
56+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span>;
5757
<span class="hljs-comment">/** The URL of the target */</span>
5858
<span class="hljs-attr">resource</span>: <span class="hljs-built_in">string</span>;
5959
<span class="hljs-comment">/** The request made to fetch the target. */</span>
@@ -67,7 +67,7 @@ <h2 id=elementltelement-typegt><code>element::&lt;element-type&gt;</code><a href
6767
<span class="hljs-comment">/** The URL of the target. */</span>
6868
<span class="hljs-attr">resource</span>: <span class="hljs-built_in">string</span>;
6969
<span class="hljs-comment">/** The element that initiated the request. */</span>
70-
<span class="hljs-attr">element</span>: HTMLElement;
70+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span>;
7171
<span class="hljs-comment">/** The error found. */</span>
7272
<span class="hljs-attr">error</span>: <span class="hljs-built_in">any</span>;
7373
<span class="hljs-comment">/** The redirects performed for the url. */</span>
@@ -101,7 +101,7 @@ <h2 id=traversedown><code>traverse::down</code><a href="#traversedown" class="he
101101
<p><strong>Format:</strong></p>
102102
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">type</span> <span class="hljs-title class_">TraverseDown</span> = &#123;
103103
<span class="hljs-comment">/** The parent element to be traversed. */</span>
104-
<span class="hljs-attr">element</span>: HTMLElement;
104+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span>;
105105
<span class="hljs-comment">/** The URL of the target. */</span>
106106
<span class="hljs-attr">resource</span>: <span class="hljs-built_in">string</span>;
107107
&#125;</pre></td></tr></table></figure><h2 id=traverseend><code>traverse::end</code><a href="#traverseend" class="headerlink" title="traverse::end"></a></h2><p>Event is emitted <strong>when</strong> the <code>connector</code> has finished traversing
@@ -122,7 +122,7 @@ <h2 id=traversedown><code>traverse::down</code><a href="#traversedown" class="he
122122
<p><strong>Format:</strong></p>
123123
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">type</span> <span class="hljs-title class_">TraverseUp</span> = &#123;
124124
<span class="hljs-comment">/** The parent element that was traversed. */</span>
125-
<span class="hljs-attr">element</span>: HTMLElement;
125+
<span class="hljs-attr">element</span>: <span class="hljs-title class_">HTMLElement</span>;
126126
<span class="hljs-comment">/** The URL of the target. */</span>
127127
<span class="hljs-attr">resource</span>: <span class="hljs-built_in">string</span>;
128128
&#125;</pre></td></tr></table></figure><h2 id=can-evaluatescript><code>can-evaluate::script</code><a href="#can-evaluatescript" class="headerlink" title="can-evaluate::script"></a></h2><p>Event is emitted <strong>when</strong> the <code>connector</code> is ready to evaluate

docs/docs/contributor-guide/guides/create-custom-hint/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h2 id=how-do-we-write-the-hint>How do we write the hint?<a href="#how-do-we-wri
8282
footer element in the page and use that for our check - if the HTML doesn’t
8383
include the target string, we simply file a report by calling <code>context.report</code>
8484
with the <em>resource</em> (URL), the <em>element</em> (footer), and the <em>error message</em>.</p>
85-
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">FooterHint</span> <span class="hljs-keyword">implements</span> IHint &#123;
85+
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">FooterHint</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">IHint</span> &#123;
8686
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">readonly</span> <span class="hljs-attr">meta</span>: <span class="hljs-title class_">HintMetadata</span> = &#123;
8787
<span class="hljs-attr">docs</span>: &#123;
8888
<span class="hljs-attr">category</span>: <span class="hljs-title class_">Category</span>.<span class="hljs-property">other</span>,
@@ -133,7 +133,7 @@ <h2 id=how-do-we-config-the-hint>How do we config the hint?<a href="#how-do-we-c
133133
Meanwhile, we also need to specify the JSON schema of the configurable options
134134
in the <code>meta</code> part of the hint constructor. This helps the hint to decide if a
135135
config option is valid before using it.</p>
136-
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">CopyrightHint</span> <span class="hljs-keyword">implements</span> IHint &#123;
136+
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">CopyrightHint</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">IHint</span> &#123;
137137
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">readonly</span> <span class="hljs-attr">meta</span>: <span class="hljs-title class_">HintMetadata</span> = &#123;
138138
<span class="hljs-attr">docs</span>: &#123;
139139
<span class="hljs-attr">category</span>: <span class="hljs-title class_">Category</span>.<span class="hljs-property">other</span>,
@@ -158,7 +158,7 @@ <h2 id=how-do-we-config-the-hint>How do we config the hint?<a href="#how-do-we-c
158158
stringToBeIncluded = (context.<span class="hljs-property">hintOptions</span> &amp;&amp; context.<span class="hljs-property">hintOptions</span>.<span class="hljs-property">stringToBeIncluded</span>) || <span class="hljs-string">`(c) webhint`</span>;
159159
&#125;;
160160

161-
<span class="hljs-keyword">const</span> validateFooter = <span class="hljs-keyword">async</span> (<span class="hljs-attr">elementFound</span>: <span class="hljs-title class_">ElementFound</span>) =&gt; &#123; <span class="hljs-comment">/* ... */</span> &#125;;
161+
<span class="hljs-keyword">const</span> <span class="hljs-title function_">validateFooter</span> = <span class="hljs-keyword">async</span> (<span class="hljs-params">elementFound: ElementFound</span>) =&gt; &#123; <span class="hljs-comment">/* ... */</span> &#125;;
162162

163163
<span class="hljs-title function_">loadHintConfigs</span>();
164164

docs/docs/contributor-guide/how-to/common-hint-scenarios/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2 id=evaluate-javascript-in-the-page-context>Evaluate JavaScript in the page c
4848

4949
context.evaluate(script);</pre></td></tr></table></figure><h2 id=ignore-connectors>Ignore connectors<a href="#ignore-connectors" class="headerlink" title="Ignore connectors"></a></h2><p>If your hint does not work properly with certain connectors you can
5050
use the property <code>ignoreConnectors</code> so it is not run when they are used.</p>
51-
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyHint</span> <span class="hljs-keyword">implements</span> IHint &#123;
51+
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyHint</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">IHint</span> &#123;
5252
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">readonly</span> <span class="hljs-attr">meta</span>: <span class="hljs-title class_">HintMetadata</span> = &#123;
5353
<span class="hljs-attr">id</span>: <span class="hljs-string">&#x27;my-hint&#x27;</span>,
5454
<span class="hljs-attr">ignoredConnectors</span>: [<span class="hljs-string">&#x27;jsdom&#x27;</span>]
@@ -64,7 +64,7 @@ <h2 id=evaluate-javascript-in-the-page-context>Evaluate JavaScript in the page c
6464
and then collect the results as late as possible. This means you
6565
will have to listen to <code>scan::start</code> and <code>scan::end</code> events respectively.
6666
The <code>create</code> method of your hint should be similar to the following:</p>
67-
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyHint</span> <span class="hljs-keyword">implements</span> IHint &#123;
67+
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyHint</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">IHint</span> &#123;
6868
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">readonly</span> <span class="hljs-attr">meta</span>: <span class="hljs-title class_">HintMetadata</span> = &#123; <span class="hljs-attr">id</span>: <span class="hljs-string">&#x27;my-hint&#x27;</span> &#125;
6969

7070
<span class="hljs-keyword">public</span> <span class="hljs-title function_">constructor</span>(<span class="hljs-params">context: HintContext</span>) &#123;
@@ -102,7 +102,7 @@ <h2 id=validate-javascript>Validate JavaScript<a href="#validate-javascript" cla
102102
<p>Here is an example hint that use the parser:</p>
103103
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> eslint <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;eslint&#x27;</span>;
104104

105-
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">ScriptSemiColonHint</span> <span class="hljs-keyword">implements</span> IHint &#123;
105+
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">ScriptSemiColonHint</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">IHint</span> &#123;
106106
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">readonly</span> <span class="hljs-attr">meta</span>: <span class="hljs-title class_">HintMetadata</span> = &#123;
107107
<span class="hljs-attr">docs</span>: &#123;
108108
<span class="hljs-attr">category</span>: <span class="hljs-title class_">Category</span>.<span class="hljs-property">compatibility</span>,

docs/docs/contributor-guide/how-to/configuration/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h2 id=quick-example>Quick example<a href="#quick-example" class="headerlink" ti
3232
</ul>
3333
<p>Imagine you want to create a configuration that focuses only on security.
3434
First you will create a new package in an empty folder:</p>
35-
<figure class="highlight bash"><table><tr><td class="code"><pre>mkdir webhint-configuration-security
35+
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="hljs-built_in">mkdir</span> webhint-configuration-security
3636
<span class="hljs-built_in">cd</span> webhint-configuration-security
3737
npm init</pre></td></tr></table></figure><p>Answer all the questions from the wizard making sure to:</p>
3838
<ul>

docs/docs/contributor-guide/how-to/connector/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h2 id=develop-a-full-connector>Develop a “full” connector<a href="#develop-
5050
<p>For more details about how the events look like and the properties they
5151
should implement, see the <a href="../../getting-started/events/" >events page</a>.</p>
5252
<p>Also, connectors need to expose some methods:</p>
53-
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> IConnector &#123;
53+
<figure class="highlight ts"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> <span class="hljs-title class_">IConnector</span> &#123;
5454
<span class="hljs-comment">/** The original DOM of the resource collected. */</span>
5555
<span class="hljs-attr">dom</span>: <span class="hljs-built_in">object</span>;
5656
<span class="hljs-comment">/** The original HTML of the resource collected. */</span>
@@ -66,7 +66,7 @@ <h2 id=develop-a-full-connector>Develop a “full” connector<a href="#develop-
6666
<span class="hljs-comment">/** Evaluates the given JavaScript `code` asynchronously in the target. */</span>
6767
evaluate(<span class="hljs-attr">code</span>: <span class="hljs-built_in">string</span>): <span class="hljs-title class_">Promise</span>&lt;<span class="hljs-built_in">any</span>&gt;;
6868
<span class="hljs-comment">/** Finds all the nodes that match the given query. */</span>
69-
<span class="hljs-title function_">querySelectorAll</span>(<span class="hljs-attr">query</span>: <span class="hljs-built_in">string</span>): HTMLElement[];
69+
<span class="hljs-title function_">querySelectorAll</span>(<span class="hljs-attr">query</span>: <span class="hljs-built_in">string</span>): <span class="hljs-title class_">HTMLElement</span>[];
7070
&#125;</pre></td></tr></table></figure><h2 id=how-to-test-a-full-connector>How to test a “full” connector<a href="#how-to-test-a-full-connector" class="headerlink" title="How to test a “full” connector"></a></h2><p>To make sure your connector is a “full” connector, it has to pass the
7171
following tests:</p>
7272
<ol>

docs/docs/contributor-guide/how-to/formatter/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<p>The following is a basic <code>formatter</code> that <code>.stringify()</code>s the results:</p>
77
<!-- eslint-disable require-await -->
88

9-
<figure class="highlight js"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">JSONFormatter</span> implements IFormatter &#123;
9+
<figure class="highlight js"><table><tr><td class="code"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">JSONFormatter</span> implements <span class="hljs-title class_">IFormatter</span> &#123;
1010
public <span class="hljs-keyword">async</span> <span class="hljs-title function_">format</span>(<span class="hljs-params">messages: Problem[], options: FormatterOptions = &#123;&#125;</span>) &#123;
11-
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-variable constant_">JSON</span>.<span class="hljs-title function_">stringify</span>(messages, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>));
11+
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(messages, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>));
1212
&#125;
1313
&#125;</pre></td></tr></table></figure><!-- eslint-enable require-await -->
1414

@@ -32,7 +32,7 @@
3232

3333
<figure class="highlight js"><table><tr><td class="code"><pre><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> _ <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;lodash&#x27;</span>;
3434

35-
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">JSONFormatter</span> implements IFormatter &#123;
35+
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">JSONFormatter</span> implements <span class="hljs-title class_">IFormatter</span> &#123;
3636
<span class="hljs-comment">/** Format the problems grouped by `resource` name and sorted by line and column number */</span>
3737
public <span class="hljs-keyword">async</span> <span class="hljs-title function_">format</span>(<span class="hljs-params">messages: Problem[], options: FormatterOptions = &#123;&#125;</span>) &#123;
3838
<span class="hljs-keyword">const</span> resources = _.<span class="hljs-title function_">groupBy</span>(messages, <span class="hljs-string">&#x27;resource&#x27;</span>);
@@ -41,7 +41,7 @@
4141
<span class="hljs-keyword">const</span> sortedMessages = _.<span class="hljs-title function_">sortBy</span>(msgs, [<span class="hljs-string">&#x27;location.line&#x27;</span>, <span class="hljs-string">&#x27;location.column&#x27;</span>]);
4242

4343
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`<span class="hljs-subst">$&#123;resource&#125;</span>: <span class="hljs-subst">$&#123;msgs.length&#125;</span> issues`</span>);
44-
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-variable constant_">JSON</span>.<span class="hljs-title function_">stringify</span>(sortedMessages, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>));
44+
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>(sortedMessages, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>));
4545
&#125;);
4646
&#125;
4747
&#125;</pre></td></tr></table></figure><!-- eslint-enable require-await -->

0 commit comments

Comments
 (0)