eslint: enforce use of const when variable not modified
This commit is contained in:
@@ -281,11 +281,11 @@ class Editor extends EditorStartup {
|
||||
parentSelector = document;
|
||||
}
|
||||
|
||||
let parents = [];
|
||||
const parents = [];
|
||||
let p = el.parentNode;
|
||||
|
||||
while (p !== parentSelector) {
|
||||
let o = p;
|
||||
const o = p;
|
||||
parents.push(o);
|
||||
p = o.parentNode;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ class EditorStartup {
|
||||
});
|
||||
|
||||
function addListenerMulti(element, eventNames, listener) {
|
||||
let events = eventNames.split(' ');
|
||||
const events = eventNames.split(' ');
|
||||
for (let i=0, iLen=events.length; i<iLen; i++) {
|
||||
element.addEventListener(events[i], listener, false);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export function isObject(item) {
|
||||
}
|
||||
|
||||
export function mergeDeep(target, source) {
|
||||
let output = Object.assign({}, target);
|
||||
const output = Object.assign({}, target);
|
||||
if (isObject(target) && isObject(source)) {
|
||||
Object.keys(source).forEach((key) => {
|
||||
if (isObject(source[key])) {
|
||||
@@ -146,7 +146,7 @@ export function getParents(elem, selector) {
|
||||
}
|
||||
|
||||
export function getParentsUntil(elem, parent, selector) {
|
||||
let parents = [];
|
||||
const parents = [];
|
||||
let parentType;
|
||||
let selectorType;
|
||||
if ( parent ) {
|
||||
|
||||
@@ -1652,7 +1652,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc
|
||||
let iconColor = null; // iconColor for popup icon
|
||||
let iconAlpha = null; // iconAlpha for popup icon
|
||||
let iconImage = null; // iconImage popup icon
|
||||
let moveBar = null; // drag bar
|
||||
const moveBar = null; // drag bar
|
||||
Object.assign(that, {
|
||||
// public properties, methods, and callbacks
|
||||
commitCallback, // commitCallback function can be overridden to return the selected color to a method you specify when the user clicks "OK"
|
||||
|
||||
@@ -221,7 +221,7 @@ export default {
|
||||
// setSelectMode();
|
||||
});
|
||||
|
||||
let oldToolSourceCancel = $id('tool_source_cancel');
|
||||
const oldToolSourceCancel = $id('tool_source_cancel');
|
||||
const toolSourceCancel = oldToolSourceCancel.cloneNode(true);
|
||||
toolSourceCancel.style.display = 'none';
|
||||
toolSourceCancel.id = 'foreign_cancel';
|
||||
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
const y = opts.mouse_y / zoom;
|
||||
|
||||
// We do our own formatting
|
||||
let text = svgEditor.i18next.t(`${name}:text`, { x, y });
|
||||
const text = svgEditor.i18next.t(`${name}:text`, { x, y });
|
||||
// Show the text using the custom alert function
|
||||
alert(text);
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ export default {
|
||||
libOpts.style.display = 'none';
|
||||
back.style.display = 'block';
|
||||
});
|
||||
let span = document.createElement("span");
|
||||
const span = document.createElement("span");
|
||||
span.textContent = description;
|
||||
li.appendChild(span);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// can't use npm version as the dragmove is different.
|
||||
|
||||
let _loaded = false;
|
||||
let _callbacks = [];
|
||||
const _callbacks = [];
|
||||
const _isTouch = window.ontouchstart !== undefined;
|
||||
|
||||
export const dragmove = function(target, handler, parent, onStart, onEnd, onDrag) {
|
||||
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
const items = txt.split(';');
|
||||
selElems.forEach((elem) => {
|
||||
if (elem && elem.getAttribute('class').includes('placemark')) {
|
||||
let elements = elem.children;
|
||||
const elements = elem.children;
|
||||
Array.prototype.forEach.call(elements, function(i, _){
|
||||
const [ , , type, n ] = i.id.split('_');
|
||||
if (type === 'txt') {
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
font = font.join(' ');
|
||||
selElems.forEach((elem) => {
|
||||
if (elem && elem.getAttribute('class').includes('placemark')) {
|
||||
let elements = elem.children;
|
||||
const elements = elem.children;
|
||||
Array.prototype.forEach.call(elements, function(i, _){
|
||||
const [ , , type ] = i.id.split('_');
|
||||
if (type === 'txt') {
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
const filename = getFileNameFromTitle();
|
||||
|
||||
// $.post(saveSvgAction, { output_svg: svg, filename });
|
||||
let postData = { output_svg: svg, filename };
|
||||
const postData = { output_svg: svg, filename };
|
||||
fetch(saveSvgAction, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(postData)
|
||||
|
||||
Reference in New Issue
Block a user