eslint/browser list/accessibility test

This commit is contained in:
JFH
2020-07-26 20:11:18 +02:00
parent 630a76c1b6
commit 89e20d49e6
114 changed files with 105155 additions and 93732 deletions

View File

@@ -1,4 +1,4 @@
/* eslint-disable import/unambiguous */
/* eslint-disable import/unambiguous, max-len */
/* globals SVGPathSeg, SVGPathSegMovetoRel, SVGPathSegMovetoAbs,
SVGPathSegMovetoRel, SVGPathSegLinetoRel, SVGPathSegLinetoAbs,
SVGPathSegLinetoHorizontalRel, SVGPathSegLinetoHorizontalAbs,
@@ -596,7 +596,7 @@ if (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.pro
return [];
}
const owningPathSegList = this; // eslint-disable-line consistent-this
const owningPathSegList = this;
class Builder {
constructor () {

View File

@@ -1,4 +1,3 @@
/* eslint-disable node/no-unsupported-features/node-builtins */
/* globals jQuery */
/**
* Miscellaneous utilities.
@@ -503,10 +502,10 @@ export const getPathBBox = function (path) {
const getCalc = function (j, P1, P2, P3) {
return function (t) {
return 1 - (t ** 3) * P0[j] +
3 * 1 - (t ** 2) * t * P1[j] +
3 * (1 - t) * (t ** 2) * P2[j] +
(t ** 3) * P3[j];
return 1 - Math.pow(t, 3) * P0[j] +
3 * 1 - Math.pow(t, 2) * t * P1[j] +
3 * (1 - t) * Math.pow(t, 2) * P2[j] +
Math.pow(t, 3) * P3[j];
};
};
@@ -539,7 +538,7 @@ export const getPathBBox = function (path) {
}
continue;
}
const b2ac = (b ** 2) - 4 * c * a;
const b2ac = Math.pow(b, 2) - 4 * c * a;
if (b2ac < 0) { continue; }
const t1 = (-b + Math.sqrt(b2ac)) / (2 * a);
if (t1 > 0 && t1 < 1) { bounds[j].push(calc(t1)); }

View File

@@ -222,7 +222,7 @@ export default {
const attrs = $(this).children().attr(['fill', 'd']);
if (attrs.fill === color && attrs.d === curD) {
// Found another marker with this color and this path
newMarker = this; // eslint-disable-line consistent-this
newMarker = this;
}
});
@@ -241,7 +241,7 @@ export default {
// Check if last marker can be removed
let remove = true;
$(S.svgcontent).find('line, polyline, path, polygon').each(function () {
const element = this; // eslint-disable-line consistent-this
const element = this;
$.each(mtypes, function (j, mtype) {
if ($(element).attr('marker-' + mtype) === 'url(#' + marker.id + ')') {
remove = false;

View File

@@ -17,7 +17,7 @@ export default {
// This populates the category list
const {categories} = strings;
/* eslint-disable max-len */
const library = {
basic: {
data: {
@@ -54,7 +54,7 @@ export default {
buttons: []
}
};
/* eslint-enable max-len */
const modeId = 'shapelib';
const startClientPos = {};

View File

@@ -328,6 +328,7 @@ export default function jQueryPluginJGraduate ($) {
}
$this.addClass('jGraduate_Picker');
/* eslint-disable max-len */
$this.html(
'<ul class="jGraduate_tabs">' +
'<li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li>' +
@@ -434,7 +435,7 @@ export default function jQueryPluginJGraduate ($) {
'<input type="button" id="' + id + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/>' +
'</div>'
);
/* eslint-enable max-len */
// --------------
// Set up all the SVG elements (the gradient, stops and rectangle)
const MAX = 256,
@@ -689,7 +690,7 @@ export default function jQueryPluginJGraduate ($) {
return false;
}).data('stop', stop).data('bg', pathbg).dblclick(function () {
$('div.jGraduate_LightBox').show();
const colorhandle = this; // eslint-disable-line consistent-this
const colorhandle = this;
let stopOpacity = Number(stop.getAttribute('stop-opacity')) || 1;
let stopColor = stop.getAttribute('stop-color') || 1;
let thisAlpha = (Number.parseFloat(stopOpacity) * 255).toString(16);

View File

@@ -1,4 +1,4 @@
/* eslint-disable no-bitwise */
/* eslint-disable no-bitwise, max-len */
/**
* @file jPicker (Adapted from version 1.1.6)
*

View File

@@ -54,14 +54,14 @@
* @example
// Create group of settings to initialise spinbutton(s). (Optional)
const myOptions = {
min: 0, // Set lower limit.
max: 100, // Set upper limit.
step: 1, // Set increment size.
smallStep: 0.5, // Set shift-click increment size.
stateObj: {tool_scale: 1}, // Object to allow passing in live-updating scale
spinClass: mySpinBtnClass, // CSS class to style the spinbutton. (Class also specifies url of the up/down button image.)
upClass: mySpinUpClass, // CSS class for style when mouse over up button.
downClass: mySpinDnClass // CSS class for style when mouse over down button.
min: 0, // Set lower limit.
max: 100, // Set upper limit.
step: 1, // Set increment size.
smallStep: 0.5, // Set shift-click increment size.
stateObj: {tool_scale: 1}, // Object to allow passing in live-updating scale
spinClass: mySpinBtnClass, // CSS class to style the spinbutton. (Class also specifies url of the up/down button image.)
upClass: mySpinUpClass, // CSS class for style when mouse over up button.
downClass: mySpinDnClass // CSS class for style when mouse over down button.
};
$(function () {

View File

@@ -21,7 +21,6 @@ import {isWebkit, isChrome, isGecko, isIE, isMac, isTouch} from '../common/brows
// Until we split this into smaller files, this helps distinguish utilities
// from local methods
// eslint-disable-next-line import/no-namespace
import * as Utils from '../common/utilities.js';
import {getTypeMap, convertUnit, isValidUnit} from '../common/units.js';
import {
@@ -4124,7 +4123,7 @@ editor.init = function () {
};
$('#svg_editor').find('button, select, input:not(#text)').focus(function () {
inp = this; // eslint-disable-line consistent-this
inp = this;
uiContext = 'toolbars';
workarea.mousedown(unfocus);
}).blur(function () {

View File

@@ -35,53 +35,53 @@ This will return the icon (as jQuery object) with a given ID.
* @copyright (c) 2009 Alexis Deveria
* {@link http://a.deveria.com}
* @example
$(function () {
$.svgIcons('my_icon_set.svg'); // The SVG file that contains all icons
// No options have been set, so all icons will automatically be inserted
// into HTML elements that match the same IDs.
});
* @example
$(function () {
// The SVG file that contains all icons
$.svgIcons('my_icon_set.svg', {
callback (icons) { // Custom callback function that sets click
// events for each icon
$.each(icons, function (id, icon) {
icon.click(function () {
alert('You clicked on the icon with id ' + id);
});
});
}
$(function () {
$.svgIcons('my_icon_set.svg'); // The SVG file that contains all icons
// No options have been set, so all icons will automatically be inserted
// into HTML elements that match the same IDs.
});
});
* @example
$(function () {
// The SVGZ file that contains all icons
$.svgIcons('my_icon_set.svgz', {
w: 32, // All icons will be 32px wide
h: 32, // All icons will be 32px high
fallback_path: 'icons/', // All fallback files can be found here
fallback: {
'#open_icon': 'open.png', // The "open.png" will be appended to the
// HTML element with ID "open_icon"
'#close_icon': 'close.png',
'#save_icon': 'save.png'
},
placement: {'.open_icon': 'open'}, // The "open" icon will be added
// to all elements with class "open_icon"
resize: {
'#save_icon .svg_icon': 64 // The "save" icon will be resized to 64 x 64px
},
* @example
$(function () {
// The SVG file that contains all icons
$.svgIcons('my_icon_set.svg', {
callback (icons) { // Custom callback function that sets click
// events for each icon
$.each(icons, function (id, icon) {
icon.click(function () {
alert('You clicked on the icon with id ' + id); // eslint-disable-line no-alert
});
});
}
});
});
callback (icons) { // Sets background color for "close" icon
icons.close.css('background', 'red');
},
* @example
$(function () {
// The SVGZ file that contains all icons
$.svgIcons('my_icon_set.svgz', {
w: 32, // All icons will be 32px wide
h: 32, // All icons will be 32px high
fallback_path: 'icons/', // All fallback files can be found here
fallback: {
'#open_icon': 'open.png', // The "open.png" will be appended to the
// HTML element with ID "open_icon"
'#close_icon': 'close.png',
'#save_icon': 'save.png'
},
placement: {'.open_icon': 'open'}, // The "open" icon will be added
// to all elements with class "open_icon"
resize: {
'#save_icon .svg_icon': 64 // The "save" icon will be resized to 64 x 64px
},
svgz: true // Indicates that an SVGZ file is being used
});
});
callback (icons) { // Sets background color for "close" icon
icons.close.css('background', 'red');
},
svgz: true // Indicates that an SVGZ file is being used
});
});
*/
// Todo: Move to own module (and have it import a modular base64 encoder)

File diff suppressed because one or more lines are too long

View File

@@ -25,12 +25,12 @@ import {
* The following will record history: insert, batch, insert.
* @example
* hrService = new HistoryRecordingService(this.undoMgr);
* hrService.insertElement(elem, text); // add simple command to history.
* hrService.insertElement(elem, text); // add simple command to history.
* hrService.startBatchCommand('create two elements');
* hrService.changeElement(elem, attrs, text); // add to batchCommand
* hrService.changeElement(elem, attrs, text); // add to batchCommand
* hrService.changeElement(elem, attrs2, text); // add to batchCommand
* hrService.endBatchCommand(); // add batch command with two change commands to history.
* hrService.insertElement(elem, text); // add simple command to history.
* hrService.endBatchCommand(); // add batch command with two change commands to history.
* hrService.insertElement(elem, text); // add simple command to history.
*
* @example
* // Note that all functions return this, so commands can be chained, like so:

View File

@@ -897,7 +897,7 @@ export class Path {
this.elem = elem;
this.segs = [];
this.selected_pts = [];
path = this; // eslint-disable-line consistent-this
path = this;
this.init();
}
@@ -2152,7 +2152,7 @@ export const pathActions = (function () {
} else {
path.selected_pts = [];
path.eachSeg(function (i) {
const seg = this; // eslint-disable-line consistent-this
const seg = this;
if (!seg.next && !seg.prev) { return; }
// const {item} = seg;

View File

@@ -18,6 +18,7 @@ const REVERSE_NS = getReverseNS();
* don't remove).
* @type {PlainObject}
*/
/* eslint-disable max-len */
const svgWhiteList_ = {
// SVG Elements
a: ['class', 'clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'id', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform', 'xlink:href', 'xlink:title'],
@@ -87,6 +88,7 @@ const svgWhiteList_ = {
none: [],
semantics: []
};
/* eslint-enable max-len */
// Produce a Namespace-aware version of svgWhitelist
const svgWhiteListNS_ = {};

View File

@@ -142,7 +142,7 @@ if (config) {
// Array with width/height of canvas
const {dimensions} = curConfig;
const canvas = this; // eslint-disable-line consistent-this
const canvas = this;
// "document" element associated with the container (same as window.document using default svg-editor.js)
// NOTE: This is not actually a SVG document, but an HTML document.
@@ -4287,7 +4287,7 @@ const convertGradients = this.convertGradients = function (elem) {
}
elems.each(function () {
const grad = this; // eslint-disable-line consistent-this
const grad = this;
if ($(grad).attr('gradientUnits') === 'userSpaceOnUse') {
// TODO: Support more than one element with this ref by duplicating parent grad
const fillStrokeElems = $(svgcontent).find('[fill="url(#' + grad.id + ')"],[stroke="url(#' + grad.id + ')"]');
@@ -4538,7 +4538,7 @@ this.setSvgString = function (xmlString, preventUndo) {
// change image href vals if possible
content.find('image').each(function () {
const image = this; // eslint-disable-line consistent-this
const image = this;
preventClickDefault(image);
const val = getHref(this);
if (val) {
@@ -6917,7 +6917,7 @@ this.moveUpDownSelected = function (dir) {
}
return true;
}
closest = this; // eslint-disable-line consistent-this
closest = this;
return false;
});
if (!closest) { return; }