mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Enable no-prototype-builtins lint
This commit is contained in:
@@ -1643,7 +1643,7 @@ PromptManagerModule.prototype.import = function (importData) {
|
||||
*/
|
||||
PromptManagerModule.prototype.validateObject = function (controlObj, object) {
|
||||
for (let key in controlObj) {
|
||||
if (!object.hasOwnProperty(key)) {
|
||||
if (!Object.hasOwn(object, key)) {
|
||||
if (controlObj[key] === null) continue;
|
||||
else return false;
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ function showKeysButton() {
|
||||
|
||||
function loadSettings() {
|
||||
for (const key in defaultSettings) {
|
||||
if (!extension_settings.translate.hasOwnProperty(key)) {
|
||||
if (!Object.hasOwn(extension_settings.translate, key)) {
|
||||
extension_settings.translate[key] = defaultSettings[key];
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ var speechUtteranceChunker = function (utt, settings, callback) {
|
||||
newUtt = new SpeechSynthesisUtterance(chunk);
|
||||
var x;
|
||||
for (x in utt) {
|
||||
if (utt.hasOwnProperty(x) && x !== 'text') {
|
||||
if (Object.hasOwn(utt, x) && x !== 'text') {
|
||||
newUtt[x] = utt[x];
|
||||
}
|
||||
}
|
||||
|
@@ -145,7 +145,7 @@ const hashCache = {};
|
||||
*/
|
||||
function getStringHash(str) {
|
||||
// Check if the hash is already in the cache
|
||||
if (hashCache.hasOwnProperty(str)) {
|
||||
if (Object.hasOwn(hashCache, str)) {
|
||||
return hashCache[str];
|
||||
}
|
||||
|
||||
|
@@ -87,11 +87,11 @@ export function loadKoboldSettings(preset) {
|
||||
$(slider.counterId).val(formattedValue);
|
||||
}
|
||||
|
||||
if (preset.hasOwnProperty('streaming_kobold')) {
|
||||
if (Object.hasOwn(preset, 'streaming_kobold')) {
|
||||
kai_settings.streaming_kobold = preset.streaming_kobold;
|
||||
$('#streaming_kobold').prop('checked', kai_settings.streaming_kobold);
|
||||
}
|
||||
if (preset.hasOwnProperty('use_default_badwordsids')) {
|
||||
if (Object.hasOwn(preset, 'use_default_badwordsids')) {
|
||||
kai_settings.use_default_badwordsids = preset.use_default_badwordsids;
|
||||
$('#use_default_badwordsids').prop('checked', kai_settings.use_default_badwordsids);
|
||||
}
|
||||
|
@@ -2832,7 +2832,8 @@ async function onLogitBiasPresetImportFileChange(e) {
|
||||
|
||||
for (const entry of importedFile) {
|
||||
if (typeof entry == 'object' && entry !== null) {
|
||||
if (entry.hasOwnProperty('text') && entry.hasOwnProperty('value')) {
|
||||
if (Object.hasOwn(entry, 'text') &&
|
||||
Object.hasOwn(entry, 'value')) {
|
||||
validEntries.push(entry);
|
||||
}
|
||||
}
|
||||
|
@@ -270,7 +270,7 @@ class PresetManager {
|
||||
const settings = Object.assign({}, getSettingsByApiId(this.apiId));
|
||||
|
||||
for (const key of filteredKeys) {
|
||||
if (settings.hasOwnProperty(key)) {
|
||||
if (Object.hasOwn(settings, key)) {
|
||||
delete settings[key];
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ class SlashCommandParser {
|
||||
addCommand(command, callback, aliases, helpString = '', interruptsGeneration = false, purgeFromMessage = true) {
|
||||
const fnObj = { callback, helpString, interruptsGeneration, purgeFromMessage };
|
||||
|
||||
if ([command, ...aliases].some(x => this.commands.hasOwnProperty(x))) {
|
||||
if ([command, ...aliases].some(x => Object.hasOwn(this.commands, x))) {
|
||||
console.trace('WARN: Duplicate slash command registered!');
|
||||
}
|
||||
|
||||
|
@@ -778,7 +778,7 @@ function setOriginalDataValue(data, uid, key, value) {
|
||||
for (let i = 0; i < keyParts.length - 1; i++) {
|
||||
const part = keyParts[i];
|
||||
|
||||
if (!currentObject.hasOwnProperty(part)) {
|
||||
if (!Object.hasOwn(currentObject, part)) {
|
||||
currentObject[part] = {};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user