mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
lint: Fix ESLint errors (mostly camelcase warnings)
This commit is contained in:
parent
34cfff4e4c
commit
044f6543a5
2 changed files with 19 additions and 23 deletions
|
@ -1233,12 +1233,10 @@ const handleChangesetRequest = async (socket, message) => {
|
||||||
*/
|
*/
|
||||||
const getChangesetInfo = async (padId, startNum, endNum, granularity) => {
|
const getChangesetInfo = async (padId, startNum, endNum, granularity) => {
|
||||||
const pad = await padManager.getPad(padId);
|
const pad = await padManager.getPad(padId);
|
||||||
const head_revision = pad.getHeadRevisionNumber();
|
const headRevision = pad.getHeadRevisionNumber();
|
||||||
|
|
||||||
// calculate the last full endnum
|
// calculate the last full endnum
|
||||||
if (endNum > head_revision + 1) {
|
if (endNum > headRevision + 1) endNum = headRevision + 1;
|
||||||
endNum = head_revision + 1;
|
|
||||||
}
|
|
||||||
endNum = Math.floor(endNum / granularity) * granularity;
|
endNum = Math.floor(endNum / granularity) * granularity;
|
||||||
|
|
||||||
const compositesChangesetNeeded = [];
|
const compositesChangesetNeeded = [];
|
||||||
|
@ -1300,9 +1298,7 @@ const getChangesetInfo = async (padId, startNum, endNum, granularity) => {
|
||||||
|
|
||||||
for (let compositeStart = startNum; compositeStart < endNum; compositeStart += granularity) {
|
for (let compositeStart = startNum; compositeStart < endNum; compositeStart += granularity) {
|
||||||
const compositeEnd = compositeStart + granularity;
|
const compositeEnd = compositeStart + granularity;
|
||||||
if (compositeEnd > endNum || compositeEnd > head_revision + 1) {
|
if (compositeEnd > endNum || compositeEnd > headRevision + 1) break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const forwards = composedChangesets[`${compositeStart}/${compositeEnd}`];
|
const forwards = composedChangesets[`${compositeStart}/${compositeEnd}`];
|
||||||
const backwards = Changeset.inverse(forwards, lines.textlines, lines.alines, pad.apool());
|
const backwards = Changeset.inverse(forwards, lines.textlines, lines.alines, pad.apool());
|
||||||
|
|
|
@ -530,15 +530,15 @@ exports.textLinesMutator = (lines) => {
|
||||||
* It is called when leaving the splice
|
* It is called when leaving the splice
|
||||||
* @param {Array} s curSplice
|
* @param {Array} s curSplice
|
||||||
*/
|
*/
|
||||||
const lines_applySplice = (s) => {
|
const linesApplySplice = (s) => {
|
||||||
lines.splice.apply(lines, s);
|
lines.splice(...s);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a line from lines at given index
|
* Get a line from lines at given index
|
||||||
* @param {Number} idx an index
|
* @param {Number} idx an index
|
||||||
*/
|
*/
|
||||||
const lines_get = (idx) => {
|
const linesGet = (idx) => {
|
||||||
if (lines.get) {
|
if (lines.get) {
|
||||||
return lines.get(idx);
|
return lines.get(idx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -552,7 +552,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
* @param {Number} start the start index
|
* @param {Number} start the start index
|
||||||
* @param {Number} end the end index
|
* @param {Number} end the end index
|
||||||
*/
|
*/
|
||||||
const lines_slice = (start, end) => {
|
const linesSlice = (start, end) => {
|
||||||
if (lines.slice) {
|
if (lines.slice) {
|
||||||
return lines.slice(start, end);
|
return lines.slice(start, end);
|
||||||
} else {
|
} else {
|
||||||
|
@ -563,7 +563,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
/**
|
/**
|
||||||
* Return the length of lines array
|
* Return the length of lines array
|
||||||
*/
|
*/
|
||||||
const lines_length = () => {
|
const linesLength = () => {
|
||||||
if ((typeof lines.length) === 'number') {
|
if ((typeof lines.length) === 'number') {
|
||||||
return lines.length;
|
return lines.length;
|
||||||
} else {
|
} else {
|
||||||
|
@ -591,7 +591,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
* This is called via close or TODO(doc)
|
* This is called via close or TODO(doc)
|
||||||
*/
|
*/
|
||||||
const leaveSplice = () => {
|
const leaveSplice = () => {
|
||||||
lines_applySplice(curSplice);
|
linesApplySplice(curSplice);
|
||||||
curSplice.length = 2;
|
curSplice.length = 2;
|
||||||
curSplice[0] = curSplice[1] = 0;
|
curSplice[0] = curSplice[1] = 0;
|
||||||
inSplice = false;
|
inSplice = false;
|
||||||
|
@ -614,7 +614,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
*/
|
*/
|
||||||
const putCurLineInSplice = () => {
|
const putCurLineInSplice = () => {
|
||||||
if (!isCurLineInSplice()) {
|
if (!isCurLineInSplice()) {
|
||||||
curSplice.push(lines_get(curSplice[0] + curSplice[1]));
|
curSplice.push(linesGet(curSplice[0] + curSplice[1]));
|
||||||
curSplice[1]++;
|
curSplice[1]++;
|
||||||
}
|
}
|
||||||
return 2 + curLine - curSplice[0]; // TODO should be the same as curSplice.length - 1
|
return 2 + curLine - curSplice[0]; // TODO should be the same as curSplice.length - 1
|
||||||
|
@ -698,7 +698,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
*/
|
*/
|
||||||
const nextKLinesText = (k) => {
|
const nextKLinesText = (k) => {
|
||||||
const m = curSplice[0] + curSplice[1];
|
const m = curSplice[0] + curSplice[1];
|
||||||
return lines_slice(m, m + k).join('');
|
return linesSlice(m, m + k).join('');
|
||||||
};
|
};
|
||||||
if (isCurLineInSplice()) {
|
if (isCurLineInSplice()) {
|
||||||
if (curCol === 0) {
|
if (curCol === 0) {
|
||||||
|
@ -712,7 +712,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
const sline = curSplice.length - 1;
|
const sline = curSplice.length - 1;
|
||||||
removed = curSplice[sline].substring(curCol) + removed;
|
removed = curSplice[sline].substring(curCol) + removed;
|
||||||
curSplice[sline] = curSplice[sline].substring(0, curCol) +
|
curSplice[sline] = curSplice[sline].substring(0, curCol) +
|
||||||
lines_get(curSplice[0] + curSplice[1]);
|
linesGet(curSplice[0] + curSplice[1]);
|
||||||
curSplice[1] += 1;
|
curSplice[1] += 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -803,7 +803,7 @@ exports.textLinesMutator = (lines) => {
|
||||||
* @return {Boolean} indicates if there are lines left
|
* @return {Boolean} indicates if there are lines left
|
||||||
*/
|
*/
|
||||||
const hasMore = () => {
|
const hasMore = () => {
|
||||||
let docLines = lines_length();
|
let docLines = linesLength();
|
||||||
if (inSplice) {
|
if (inSplice) {
|
||||||
docLines += curSplice.length - 2 - curSplice[1];
|
docLines += curSplice.length - 2 - curSplice[1];
|
||||||
}
|
}
|
||||||
|
@ -1826,7 +1826,7 @@ exports.inverse = (cs, lines, alines, pool) => {
|
||||||
// They may be arrays or objects with .get(i) and .length methods.
|
// They may be arrays or objects with .get(i) and .length methods.
|
||||||
// They include final newlines on lines.
|
// They include final newlines on lines.
|
||||||
|
|
||||||
const lines_get = (idx) => {
|
const linesGet = (idx) => {
|
||||||
if (lines.get) {
|
if (lines.get) {
|
||||||
return lines.get(idx);
|
return lines.get(idx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1834,7 +1834,7 @@ exports.inverse = (cs, lines, alines, pool) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const alines_get = (idx) => {
|
const alinesGet = (idx) => {
|
||||||
if (alines.get) {
|
if (alines.get) {
|
||||||
return alines.get(idx);
|
return alines.get(idx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1855,7 +1855,7 @@ exports.inverse = (cs, lines, alines, pool) => {
|
||||||
const consumeAttribRuns = (numChars, func /* (len, attribs, endsLine)*/) => {
|
const consumeAttribRuns = (numChars, func /* (len, attribs, endsLine)*/) => {
|
||||||
if ((!curLineOpIter) || (curLineOpIterLine !== curLine)) {
|
if ((!curLineOpIter) || (curLineOpIterLine !== curLine)) {
|
||||||
// create curLineOpIter and advance it to curChar
|
// create curLineOpIter and advance it to curChar
|
||||||
curLineOpIter = exports.opIterator(alines_get(curLine));
|
curLineOpIter = exports.opIterator(alinesGet(curLine));
|
||||||
curLineOpIterLine = curLine;
|
curLineOpIterLine = curLine;
|
||||||
let indexIntoLine = 0;
|
let indexIntoLine = 0;
|
||||||
let done = false;
|
let done = false;
|
||||||
|
@ -1876,7 +1876,7 @@ exports.inverse = (cs, lines, alines, pool) => {
|
||||||
curChar = 0;
|
curChar = 0;
|
||||||
curLineOpIterLine = curLine;
|
curLineOpIterLine = curLine;
|
||||||
curLineNextOp.chars = 0;
|
curLineNextOp.chars = 0;
|
||||||
curLineOpIter = exports.opIterator(alines_get(curLine));
|
curLineOpIter = exports.opIterator(alinesGet(curLine));
|
||||||
}
|
}
|
||||||
if (!curLineNextOp.chars) {
|
if (!curLineNextOp.chars) {
|
||||||
curLineOpIter.next(curLineNextOp);
|
curLineOpIter.next(curLineNextOp);
|
||||||
|
@ -1909,13 +1909,13 @@ exports.inverse = (cs, lines, alines, pool) => {
|
||||||
const nextText = (numChars) => {
|
const nextText = (numChars) => {
|
||||||
let len = 0;
|
let len = 0;
|
||||||
const assem = exports.stringAssembler();
|
const assem = exports.stringAssembler();
|
||||||
const firstString = lines_get(curLine).substring(curChar);
|
const firstString = linesGet(curLine).substring(curChar);
|
||||||
len += firstString.length;
|
len += firstString.length;
|
||||||
assem.append(firstString);
|
assem.append(firstString);
|
||||||
|
|
||||||
let lineNum = curLine + 1;
|
let lineNum = curLine + 1;
|
||||||
while (len < numChars) {
|
while (len < numChars) {
|
||||||
const nextString = lines_get(lineNum);
|
const nextString = linesGet(lineNum);
|
||||||
len += nextString.length;
|
len += nextString.length;
|
||||||
assem.append(nextString);
|
assem.append(nextString);
|
||||||
lineNum++;
|
lineNum++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue