node_modules/eslint/lib/rules/indent-legacy.js in immosquare-cleaner-0.1.32 vs node_modules/eslint/lib/rules/indent-legacy.js in immosquare-cleaner-0.1.38
- old
+ new
@@ -787,11 +787,11 @@
checkNodesIndent(elements, elementsIndent);
if (elements.length > 0) {
// Skip last block line check if last item in same line
- if (elements[elements.length - 1].loc.end.line === node.loc.end.line) {
+ if (elements.at(-1).loc.end.line === node.loc.end.line) {
return;
}
}
checkLastNodeLineIndent(node, nodeIndent +
@@ -828,11 +828,11 @@
checkIndentInFunctionBlock(node);
return;
}
let indent;
- let nodesToCheck = [];
+ let nodesToCheck;
/*
* For this statements we should check indent from statement beginning,
* not from the beginning of the block.
*/
@@ -871,11 +871,11 @@
* @param {ASTNode} node Variable declaration node
* @returns {ASTNode[]} Filtered elements
*/
function filterOutSameLineVars(node) {
return node.declarations.reduce((finalCollection, elem) => {
- const lastElem = finalCollection[finalCollection.length - 1];
+ const lastElem = finalCollection.at(-1);
if ((elem.loc.start.line !== node.loc.start.line && !lastElem) ||
(lastElem && lastElem.loc.start.line !== elem.loc.start.line)) {
finalCollection.push(elem);
}
@@ -890,11 +890,11 @@
* @returns {void}
*/
function checkIndentInVariableDeclarations(node) {
const elements = filterOutSameLineVars(node);
const nodeIndent = getNodeIndent(node).goodChar;
- const lastElement = elements[elements.length - 1];
+ const lastElement = elements.at(-1);
const elementsIndent = nodeIndent + indentSize * options.VariableDeclarator[node.kind];
checkNodesIndent(elements, elementsIndent);
@@ -997,10 +997,10 @@
blockIndentationCheck(node);
}
},
VariableDeclaration(node) {
- if (node.declarations[node.declarations.length - 1].loc.start.line > node.declarations[0].loc.start.line) {
+ if (node.declarations.at(-1).loc.start.line > node.declarations[0].loc.start.line) {
checkIndentInVariableDeclarations(node);
}
},
ObjectExpression(node) {