- Linting: Comment out unused var.

- Maintenance: Add `.editorconfig`
- npm: Update jml, core-js-bundle, devDeps
This commit is contained in:
Brett Zamir
2019-11-12 22:11:46 +08:00
parent c54444c08b
commit d808cc22de
8 changed files with 1189 additions and 926 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
; EditorConfig file: https://EditorConfig.org
; Install the "EditorConfig" plugin into your editor to use
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
; [app/public/css/**.styl]
; indent_style = tab
; indent_size = 2

View File

@@ -16,6 +16,7 @@
- Testing: Accessibility test API update - Testing: Accessibility test API update
- Docs: Clarify need for Node.js/npm being installed - Docs: Clarify need for Node.js/npm being installed
- Build: Remove `types-docs` script as being handled in ESLint - Build: Remove `types-docs` script as being handled in ESLint
- Maintenance: Add `.editorconfig`
- npm: Add script to fix eslint errors - npm: Add script to fix eslint errors
- npm: Update devDeps (including switching from deprecated opn-cli - npm: Update devDeps (including switching from deprecated opn-cli
package to open-cli); update core-js-bundle copy; add new package to open-cli); update core-js-bundle copy; add new

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -49,20 +49,35 @@ function _defineProperty(obj, key, value) {
return obj; return obj;
} }
function _objectSpread(target) { function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) { for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {}; var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') { if (i % 2) {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { ownKeys(source, true).forEach(function (key) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable; _defineProperty(target, key, source[key]);
})); });
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
} }
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} }
return target; return target;
@@ -238,6 +253,10 @@ function _iterableToArray(iter) {
} }
function _iterableToArrayLimit(arr, i) { function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = []; var _arr = [];
var _n = true; var _n = true;
var _d = false; var _d = false;
@@ -430,7 +449,7 @@ function _appendNode(parent, child) {
* @static * @static
* @param {Element} el DOM element to which to attach the event * @param {Element} el DOM element to which to attach the event
* @param {string} type The DOM event (without 'on') to attach to the element * @param {string} type The DOM event (without 'on') to attach to the element
* @param {Function} handler The event handler to attach to the element * @param {EventListener} handler The event handler to attach to the element
* @param {boolean} [capturing] Whether or not the event should be * @param {boolean} [capturing] Whether or not the event should be
* capturing (W3C-browsers only); default is false; NOT IN USE * capturing (W3C-browsers only); default is false; NOT IN USE
* @returns {void} * @returns {void}
@@ -472,7 +491,7 @@ function _upperCase(n0, n1) {
} // Todo: Make as public utility } // Todo: Make as public utility
/** /**
* @param {*} o * @param {any} o
* @returns {boolean} * @returns {boolean}
*/ */
@@ -484,7 +503,7 @@ function _isNullish(o) {
/** /**
* @private * @private
* @static * @static
* @param {string|object|Array|Element|DocumentFragment} item * @param {string|JamilihAttributes|JamilihArray|Element|DocumentFragment} item
* @returns {"string"|"null"|"array"|"element"|"fragment"|"object"} * @returns {"string"|"null"|"array"|"element"|"fragment"|"object"}
*/ */
@@ -580,7 +599,7 @@ function _jmlSingleArg(arg) {
return jml(arg); return jml(arg);
} }
/** /**
* @typedef {Array} AttributeArray * @typedef {JamilihAttributes} AttributeArray
* @property {string} 0 The key * @property {string} 0 The key
* @property {string} 1 The value * @property {string} 1 The value
*/ */
@@ -668,10 +687,10 @@ function _appendJMLOrText(node) {
* @private * @private
* @static * @static
function _DOMfromJMLOrString (childNodeJML) { function _DOMfromJMLOrString (childNodeJML) {
if (typeof childNodeJML === 'string') { if (typeof childNodeJML === 'string') {
return doc.createTextNode(childNodeJML); return doc.createTextNode(childNodeJML);
} }
return jml(...childNodeJML); return jml(...childNodeJML);
} }
*/ */
@@ -679,12 +698,16 @@ function _DOMfromJMLOrString (childNodeJML) {
* @typedef {Element|DocumentFragment} JamilihReturn * @typedef {Element|DocumentFragment} JamilihReturn
*/ */
/**
* @typedef {PlainObject} JamilihAttributes
*/
/** /**
* @typedef {GenericArray} JamilihArray * @typedef {GenericArray} JamilihArray
* @property {string} 0 The element to create (by lower-case name) * @property {string} 0 The element to create (by lower-case name)
* @property {Object} [1] Attributes to add with the key as the attribute name * @property {JamilihAttributes} [1] Attributes to add with the key as the
* and value as the attribute value; important for IE where the input * attribute name and value as the attribute value; important for IE where
* element's type cannot be added later after already added to the page * the input element's type cannot be added later after already added to the page
* @param {Element[]} [children] The optional children of this element * @param {Element[]} [children] The optional children of this element
* (but raw DOM elements required to be specified within arrays since * (but raw DOM elements required to be specified within arrays since
* could not otherwise be distinguished from siblings being added) * could not otherwise be distinguished from siblings being added)
@@ -746,9 +769,9 @@ var jml = function jml() {
0. {$xmlDocument: []} // doc.implementation.createDocument 0. {$xmlDocument: []} // doc.implementation.createDocument
0. Accept array for any attribute with first item as prefix and second as value? 0. Accept array for any attribute with first item as prefix and second as value?
0. {$: ['xhtml', 'div']} for prefixed elements 0. {$: ['xhtml', 'div']} for prefixed elements
case '$': // Element with prefix? case '$': // Element with prefix?
nodes[nodes.length] = elem = doc.createElementNS(attVal[0], attVal[1]); nodes[nodes.length] = elem = doc.createElementNS(attVal[0], attVal[1]);
break; break;
*/ */
case '#': case '#':
{ {
@@ -1034,7 +1057,7 @@ var jml = function jml() {
/* /*
// Todo: // Todo:
if (attVal.internalSubset) { if (attVal.internalSubset) {
node = {}; node = {};
} }
else else
*/ */
@@ -1067,13 +1090,13 @@ var jml = function jml() {
/* /*
// Todo: Should we auto-copy another node's properties/methods (like DocumentType) excluding or changing its non-entity node values? // Todo: Should we auto-copy another node's properties/methods (like DocumentType) excluding or changing its non-entity node values?
const node = { const node = {
nodeName: attVal.name, nodeName: attVal.name,
nodeValue: null, nodeValue: null,
publicId: attVal.publicId, publicId: attVal.publicId,
systemId: attVal.systemId, systemId: attVal.systemId,
notationName: attVal.notationName, notationName: attVal.notationName,
nodeType: 6, nodeType: 6,
childNodes: attVal.childNodes.map(_DOMfromJMLOrString) childNodes: attVal.childNodes.map(_DOMfromJMLOrString)
}; };
*/ */
break; break;
@@ -1219,9 +1242,9 @@ var jml = function jml() {
/* /*
// The following reorders which is troublesome for serialization, e.g., as used in our testing // The following reorders which is troublesome for serialization, e.g., as used in our testing
if (elem.style.cssText !== undefined) { if (elem.style.cssText !== undefined) {
elem.style.cssText += attVal; elem.style.cssText += attVal;
} else { // Opera } else { // Opera
elem.style += attVal; elem.style += attVal;
} }
*/ */
@@ -1316,8 +1339,6 @@ var jml = function jml() {
obj = dataVal[1] || defaultMap[1]; obj = dataVal[1] || defaultMap[1];
} // Map } // Map
/* eslint-disable-next-line unicorn/no-unsafe-regex */
} else if (/^\[object (?:Weak)?Map\]$/.test([].toString.call(dataVal))) { } else if (/^\[object (?:Weak)?Map\]$/.test([].toString.call(dataVal))) {
map = dataVal; map = dataVal;
obj = defaultMap[1]; // Non-map data object obj = defaultMap[1]; // Non-map data object
@@ -1570,11 +1591,11 @@ var jml = function jml() {
/** /**
* Converts a DOM object or a string of HTML into a Jamilih object (or string). * Converts a DOM object or a string of HTML into a Jamilih object (or string).
* @param {string|HTMLElement} [dom=document.documentElement] Defaults to converting the current document. * @param {string|HTMLElement} [dom=document.documentElement] Defaults to converting the current document.
* @param {object} [config={stringOutput:false}] Configuration object * @param {PlainObject} [config] Configuration object
* @param {boolean} [config.stringOutput=false] Whether to output the Jamilih object as a string. * @param {boolean} [config.stringOutput=false] Whether to output the Jamilih object as a string.
* @returns {Array|string} Array containing the elements which represent a Jamilih object, or, * @returns {JamilihArray|string} Array containing the elements which represent
if `stringOutput` is true, it will be the stringified version of * a Jamilih object, or, if `stringOutput` is true, it will be the stringified
such an object * version of such an object
*/ */
@@ -1636,7 +1657,7 @@ jml.toJML = function (dom, config) {
} }
/** /**
* *
* @param {*} val * @param {any} val
* @returns {void} * @returns {void}
*/ */
@@ -1684,11 +1705,11 @@ jml.toJML = function (dom, config) {
/* /*
if ((node.prefix && node.prefix.includes(':')) || (node.localName && node.localName.includes(':'))) { if ((node.prefix && node.prefix.includes(':')) || (node.localName && node.localName.includes(':'))) {
invalidStateError(); invalidStateError();
} }
*/ */
var type = 'nodeType' in node ? node.nodeType : null; var type = 'nodeType' in node ? node.nodeType : null;
namespaces = _objectSpread({}, namespaces); namespaces = _objectSpread2({}, namespaces);
var xmlChars = /([\t\n\r -\uD7FF\uE000-\uFFFD]|(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF]))(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))*$/; // eslint-disable-line no-control-regex var xmlChars = /([\t\n\r -\uD7FF\uE000-\uFFFD]|(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF]))(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))*$/; // eslint-disable-line no-control-regex
if ([2, 3, 4, 7, 8].includes(type) && !xmlChars.test(node.nodeValue)) { if ([2, 3, 4, 7, 8].includes(type) && !xmlChars.test(node.nodeValue)) {
@@ -1764,7 +1785,7 @@ jml.toJML = function (dom, config) {
break; break;
} }
case undefined: // Treat as attribute node until this is fixed: https://github.com/tmpvar/jsdom/issues/1641 / https://github.com/tmpvar/jsdom/pull/1822 case undefined: // Treat as attribute node until this is fixed: https://github.com/jsdom/jsdom/issues/1641 / https://github.com/jsdom/jsdom/pull/1822
case 2: case 2:
// ATTRIBUTE (should only get here if passing in an attribute node) // ATTRIBUTE (should only get here if passing in an attribute node)
@@ -2248,8 +2269,8 @@ jml.getXMLSerializer = function () {
}; };
/** /**
* Does not run Jamilih so can be further processed. * Does not run Jamilih so can be further processed.
* @param {Array} jmlArray * @param {JamilihArray} jmlArray
* @param {string|Array|Element} glu * @param {string|JamilihArray|Element} glu
* @returns {Element} * @returns {Element}
*/ */

View File

@@ -340,14 +340,14 @@ export const recalculateDimensions = function (selected) {
const angle = getRotationAngle(child); const angle = getRotationAngle(child);
oldStartTransform = context_.getStartTransform(); oldStartTransform = context_.getStartTransform();
const childxforms = []; // const childxforms = [];
context_.setStartTransform(child.getAttribute('transform')); context_.setStartTransform(child.getAttribute('transform'));
if (angle || hasMatrixTransform(childTlist)) { if (angle || hasMatrixTransform(childTlist)) {
const e2t = svgroot.createSVGTransform(); const e2t = svgroot.createSVGTransform();
e2t.setMatrix(matrixMultiply(tm, sm, tmn, m)); e2t.setMatrix(matrixMultiply(tm, sm, tmn, m));
childTlist.clear(); childTlist.clear();
childTlist.appendItem(e2t); childTlist.appendItem(e2t);
childxforms.push(e2t); // childxforms.push(e2t);
// if not rotated or skewed, push the [T][S][-T] down to the child // if not rotated or skewed, push the [T][S][-T] down to the child
} else { } else {
// update the transform list with translate,scale,translate // update the transform list with translate,scale,translate
@@ -377,9 +377,9 @@ export const recalculateDimensions = function (selected) {
childTlist.appendItem(translateBack); childTlist.appendItem(translateBack);
childTlist.appendItem(scale); childTlist.appendItem(scale);
childTlist.appendItem(translateOrigin); childTlist.appendItem(translateOrigin);
childxforms.push(translateBack); // childxforms.push(translateBack);
childxforms.push(scale); // childxforms.push(scale);
childxforms.push(translateOrigin); // childxforms.push(translateOrigin);
// logMatrix(translateBack.matrix); // logMatrix(translateBack.matrix);
// logMatrix(scale.matrix); // logMatrix(scale.matrix);
} // not rotated } // not rotated

1925
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -77,36 +77,36 @@
], ],
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@babel/core": "^7.6.4", "@babel/core": "^7.7.2",
"@babel/node": "^7.6.3", "@babel/node": "^7.7.0",
"@babel/plugin-transform-modules-commonjs": "^7.6.0", "@babel/plugin-transform-modules-commonjs": "^7.7.0",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.6.3", "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0",
"@babel/preset-env": "^7.6.3", "@babel/preset-env": "^7.7.1",
"@mysticatea/eslint-plugin": "^12.0.0", "@mysticatea/eslint-plugin": "^13.0.0",
"axe-core": "^3.3.2", "axe-core": "^3.4.0",
"axe-testcafe": "^3.0.0", "axe-testcafe": "^3.0.0",
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3", "babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
"core-js-bundle": "^3.3.2", "core-js-bundle": "^3.4.1",
"eslint": "6.5.1", "eslint": "6.6.0",
"eslint-config-ash-nazg": "11.0.1", "eslint-config-ash-nazg": "11.3.0",
"eslint-config-standard": "14.1.0", "eslint-config-standard": "14.1.0",
"eslint-plugin-array-func": "^3.1.3", "eslint-plugin-array-func": "^3.1.3",
"eslint-plugin-compat": "^3.3.0", "eslint-plugin-compat": "^3.3.0",
"eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-html": "^6.0.0", "eslint-plugin-html": "^6.0.0",
"eslint-plugin-import": "2.18.2", "eslint-plugin-import": "2.18.2",
"eslint-plugin-jsdoc": "^15.12.0", "eslint-plugin-jsdoc": "^17.1.1",
"eslint-plugin-markdown": "^1.0.0", "eslint-plugin-markdown": "^1.0.1",
"eslint-plugin-no-use-extend-native": "^0.4.1", "eslint-plugin-no-use-extend-native": "^0.4.1",
"eslint-plugin-node": "10.0.0", "eslint-plugin-node": "10.0.0",
"eslint-plugin-promise": "4.2.1", "eslint-plugin-promise": "4.2.1",
"eslint-plugin-qunit": "^4.0.0", "eslint-plugin-qunit": "^4.0.0",
"eslint-plugin-sonarjs": "^0.4.0", "eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-standard": "4.0.1", "eslint-plugin-standard": "4.0.1",
"eslint-plugin-testcafe": "^0.2.1", "eslint-plugin-testcafe": "^0.2.1",
"eslint-plugin-unicorn": "^12.1.0", "eslint-plugin-unicorn": "^12.1.0",
"imageoptim-cli": "^3.0.0", "imageoptim-cli": "^3.0.2",
"jamilih": "^0.45.0", "jamilih": "^0.46.0",
"jsdoc": "^3.6.3", "jsdoc": "^3.6.3",
"load-stylesheets": "^0.9.0", "load-stylesheets": "^0.9.0",
"node-static": "^0.7.11", "node-static": "^0.7.11",
@@ -116,15 +116,15 @@
"query-result": "https://github.com/WebReflection/query-result", "query-result": "https://github.com/WebReflection/query-result",
"qunit": "^2.9.3", "qunit": "^2.9.3",
"regenerator-runtime": "^0.13.3", "regenerator-runtime": "^0.13.3",
"remark-cli": "^7.0.0", "remark-cli": "^7.0.1",
"remark-lint-ordered-list-marker-value": "^1.0.3", "remark-lint-ordered-list-marker-value": "^1.0.3",
"rollup": "1.25.1", "rollup": "1.26.5",
"rollup-plugin-babel": "^4.3.3", "rollup-plugin-babel": "^4.3.3",
"rollup-plugin-re": "^1.0.7", "rollup-plugin-re": "^1.0.7",
"rollup-plugin-terser": "^5.1.2", "rollup-plugin-terser": "^5.1.2",
"sinon": "^7.5.0", "sinon": "^7.5.0",
"sinon-test": "^2.4.0", "sinon-test": "^2.4.0",
"stackblur-canvas": "^2.2.0", "stackblur-canvas": "^2.2.0",
"testcafe": "^1.6.0" "testcafe": "^1.6.1"
} }
} }