node_modules/eslint/lib/linter/report-translator.js in immosquare-cleaner-0.1.32 vs node_modules/eslint/lib/linter/report-translator.js in immosquare-cleaner-0.1.38
- old
+ new
@@ -7,13 +7,13 @@
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
-const assert = require("assert");
+const assert = require("node:assert");
const ruleFixer = require("./rule-fixer");
-const interpolate = require("./interpolate");
+const { interpolate } = require("./interpolate");
//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
@@ -158,11 +158,11 @@
fixes.sort(compareFixesByRange);
const originalText = sourceCode.text;
const start = fixes[0].range[0];
- const end = fixes[fixes.length - 1].range[1];
+ const end = fixes.at(-1).range[1];
let text = "";
let lastPos = Number.MIN_SAFE_INTEGER;
for (const fix of fixes) {
assert(fix.range[0] >= lastPos, "Fix objects must not be overlapped in a report.");
@@ -341,10 +341,10 @@
const id = descriptor.messageId;
if (descriptor.message) {
throw new TypeError("context.report() called with a message and a messageId. Please only pass one.");
}
- if (!messages || !Object.prototype.hasOwnProperty.call(messages, id)) {
+ if (!messages || !Object.hasOwn(messages, id)) {
throw new TypeError(`context.report() called with a messageId of '${id}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`);
}
computedMessage = messages[id];
} else if (descriptor.message) {
computedMessage = descriptor.message;