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

Fix/timeouts #1331

Closed
wants to merge 11 commits into from
3 changes: 2 additions & 1 deletion packages/configuration-development/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"summary"
],
"hints": {
"apple-touch-icons": "off",
"axe": "error",
"babel-config/is-valid": "error",
"disown-opener": "error",
Expand All @@ -25,7 +26,7 @@
"typescript-config/target": "error",
"webpack-config/is-installed": "error",
"webpack-config/is-valid": "error",
"webpack-config/module-esnext-typescript": "error",
"webpack-config/module-esnext-typescript": "off",
"webpack-config/modules/false-babel": "error",
"webpack-config/no-devtool-in-prod": "error"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration-development/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@hint/hint-typescript-config": "^1.1.0",
"@hint/hint-webpack-config": "^1.0.0",
"@hint/parser-babel-config": "^1.1.0",
"@hint/parser-html": "^1.0.1",
"@hint/parser-html": "^1.0.2",
"@hint/parser-typescript-config": "^1.1.0",
"@hint/parser-webpack-config": "^1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration-web-recommended/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hint/hint-stylesheet-limits": "^1.0.1",
"@hint/hint-validate-set-cookie-header": "^1.0.2",
"@hint/hint-x-content-type-options": "^1.0.3",
"@hint/parser-html": "^1.0.1"
"@hint/parser-html": "^1.0.2"
},
"description": "webhint's recommended hints configuration for live websites",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/connector-chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"timeout": "1m"
},
"dependencies": {
"@hint/utils-debugging-protocol-common": "^1.0.5",
"@hint/utils-debugging-protocol-common": "^1.0.6",
"chrome-launcher": "^0.10.4",
"is-ci": "^1.2.1",
"lockfile": "^1.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connector-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"description": "hint local connector",
"devDependencies": {
"@hint/parser-html": "^1.0.1",
"@hint/parser-html": "^1.0.2",
"@types/chokidar": "^1.7.5",
"@types/mock-require": "^2.0.0",
"ava": "^0.25.0",
Expand Down
11 changes: 8 additions & 3 deletions packages/hint/src/lib/types/jsdom-async-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ export class JSDOMAsyncHTMLElement implements IAsyncHTMLElement {
/* istanbul ignore next */
public getLocation(): ProblemLocation {
try {
const location = this._dom && this._dom.nodeLocation(this._htmlelement);
/*
* TODO: Depending on the install (yarn vs npm) we get a different version of `jsdom`
* that has a different version of `parse5`. This takes care of this issue but should
* be fixed once we migrate completely to jsdom 12 (https://github.com/webhintio/hint/pull/1274)
*/
const location: any = this._dom && this._dom.nodeLocation(this._htmlelement);

return location && {
column: location.startTag.col,
line: location.startTag.line - 1
column: location.startTag.col || location.startTag.startCol,
line: (location.startTag.line || location.startTag.startLine) - 1
} || null;
} catch (e) {
// JSDOM throws an exception if `includeNodeLocations` wasn't set.
Expand Down
7 changes: 7 additions & 0 deletions packages/parser-html/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.2 (September 20, 2018)

## Bug fixes / Improvements

* [[`537bbbbd98`](https://github.com/webhintio/hint/commit/537bbbbd98c2269d95ecda08e54aa4a086468183)] - Fix: Use JSDOM locations for elements if available (by [`Tony Ross`](https://github.com/antross)).


# 1.0.1 (September 6, 2018)

## Bug fixes / Improvements
Expand Down
2 changes: 1 addition & 1 deletion packages/parser-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@
"watch:test": "ava --watch",
"watch:ts": "npm run build:ts -- --watch"
},
"version": "1.0.1"
"version": "1.0.2"
}
7 changes: 7 additions & 0 deletions packages/utils-debugging-protocol-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.6 (September 20, 2018)

## Bug fixes / Improvements

* [[`ea56a95ce4`](https://github.com/webhintio/hint/commit/ea56a95ce452c136c872dadd9c790b2cc5f9cd06)] - Fix: Several issues with the Debugging Protocol (by [`Antón Molleda`](https://github.com/molant) / see also: [`#1325`](https://github.com/webhintio/hint/issues/1325)).


# 1.0.5 (September 20, 2018)

## Bug fixes / Improvements
Expand Down
4 changes: 3 additions & 1 deletion packages/utils-debugging-protocol-common/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"dependencies": {
"@hint/utils-connector-tools": "^1.0.5",
"abab": "^2.0.0",
"chrome-remote-interface": "^0.26.1",
"lodash": "^4.17.11"
},
"description": "hint debugging protocol common functionality",
"devDependencies": {
"@types/lodash": "^4.14.115",
"chrome-remote-debug-protocol": "^1.2.20180422",
"eslint": "^5.6.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-markdown": "^1.0.0-beta.7",
Expand Down Expand Up @@ -52,5 +54,5 @@
"watch": "npm run build && npm-run-all --parallel -c watch:*",
"watch:ts": "npm run build:ts -- --watch"
},
"version": "1.0.5"
"version": "1.0.6"
}
10 changes: 6 additions & 4 deletions packages/utils-debugging-protocol-common/src/cdp-async-html.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Crdp } from 'chrome-remote-debug-protocol';

import { IAsyncHTMLDocument, IAsyncHTMLElement } from 'hint/dist/src/lib/types/async-html'; //eslint-disable-line
import { debug as d } from 'hint/dist/src/lib/utils/debug';
import { ProblemLocation } from 'hint/dist/src/lib/types';
Expand All @@ -7,7 +9,7 @@ const debug: debug.IDebugger = d(__filename);
/** An implementation of AsyncHTMLDocument on top of the Chrome Debugging Protocol */
export class CDPAsyncHTMLDocument implements IAsyncHTMLDocument {
/** The DOM domain of the CDP client. */
private _DOM;
private _DOM: Crdp.DOMClient;
/** The root element of the real DOM. */
private _dom;
/** A map with all the nodes accessible using `nodeId`. */
Expand All @@ -25,7 +27,7 @@ export class CDPAsyncHTMLDocument implements IAsyncHTMLDocument {
* initially, we store them in a Map using the `nodeId` as the key so we can access to them
* later.
*/
private trackNodes(root) {
private trackNodes(root: Crdp.DOM.Node) {
this._nodes.set(root.nodeId, root);
if (!root.children) {
return;
Expand All @@ -36,7 +38,7 @@ export class CDPAsyncHTMLDocument implements IAsyncHTMLDocument {
});
}

private getHTMLChildren(children: Array<any>) {
private getHTMLChildren(children: Array<Crdp.DOM.Node>) {
return children.find((item) => {
return item.nodeType === 1 && item.nodeName === 'HTML';
});
Expand Down Expand Up @@ -128,7 +130,7 @@ export class AsyncHTMLElement implements IAsyncHTMLElement {
private _attributesArray: Array<{ name: string; value: string; }> = [];
private _attributesMap: Map<string, string> = new Map();

public constructor(htmlelement, ownerDocument, DOM) {
public constructor(htmlelement: Crdp.DOM.Node, ownerDocument: CDPAsyncHTMLDocument, DOM: Crdp.DOMClient) {
if (typeof htmlelement === 'number') {
throw new Error();
}
Expand Down
Loading