refactor: Upgrade to eslint 9.19.0 (#9580)

This commit is contained in:
Daniel
2025-02-02 01:32:43 +11:00
committed by GitHub
parent 239e692145
commit 889dbb5aee
18 changed files with 1265 additions and 770 deletions

View File

@@ -28,7 +28,6 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
}
}
} else if (typeof adapter === 'string') {
/* eslint-disable */
adapter = require(adapter);
// If it's define as a module, get the default
if (adapter.default) {

View File

@@ -189,9 +189,7 @@ const handleDotFields = object => {
if (value && value.__op === 'Delete') {
value = undefined;
}
/* eslint-disable no-cond-assign */
while ((next = components.shift())) {
/* eslint-enable no-cond-assign */
currentObj[next] = currentObj[next] || {};
if (components.length === 0) {
currentObj[next] = value;
@@ -819,6 +817,7 @@ const buildWhereClause = ({ schema, query, index, caseInsensitive }): WhereClaus
if (parserResult.status === 'success') {
postgresValue = toPostgresValue(parserResult.result);
} else {
// eslint-disable-next-line no-console
console.error('Error while parsing relative date', parserResult);
throw new Parse.Error(
Parse.Error.INVALID_JSON,
@@ -917,6 +916,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
this._stream
.none('NOTIFY $1~, $2', ['schema.change', { senderId: this._uuid }])
.catch(error => {
// eslint-disable-next-line no-console
console.log('Failed to Notify:', error); // unlikely to ever happen
});
}
@@ -2376,7 +2376,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
debug(`initializationDone in ${ctx.duration}`);
})
.catch(error => {
/* eslint-disable no-console */
// eslint-disable-next-line no-console
console.error(error);
});
}

View File

@@ -50,6 +50,7 @@ const getObject = async (
options.keys = keys;
}
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
if (include) {

View File

@@ -201,6 +201,7 @@ class ParseServer {
Config.put(this.config);
return this;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
this.config.state = 'error';
throw error;
@@ -370,6 +371,7 @@ class ParseServer {
try {
await this.start();
} catch (e) {
// eslint-disable-next-line no-console
console.error('Error on ParseServer.startApp: ', e);
throw e;
}
@@ -482,6 +484,7 @@ class ParseServer {
};
const url = `${Parse.serverURL.replace(/\/$/, '')}/health`;
if (!isValidHttpUrl(url)) {
// eslint-disable-next-line no-console
console.warn(
`\nWARNING, Unable to connect to '${Parse.serverURL}' as the URL is invalid.` +
` Cloud code and push notifications may be unavailable!\n`
@@ -543,6 +546,7 @@ function injectDefaults(options: ParseServerOptions) {
if (options.appId) {
const regex = /[!#$%'()*+&/:;=?@[\]{}^,|<>]/g;
if (options.appId.match(regex)) {
// eslint-disable-next-line no-console
console.warn(
`\nWARNING, appId that contains special characters can cause issues while using with urls.\n`
);

View File

@@ -387,7 +387,7 @@ export class DefinedSchemas {
logger.warn(`classLevelPermissions not provided for ${localSchema.className}.`);
}
// Use spread to avoid read only issue (encountered by Moumouls using directAccess)
const clp = ({ ...localSchema.classLevelPermissions } || {}: Parse.CLP.PermissionsMap);
const clp = ({ ...localSchema.classLevelPermissions || {} }: Parse.CLP.PermissionsMap);
// To avoid inconsistency we need to remove all rights on addField
clp.addField = {};
newLocalSchema.setCLP(clp);

View File

@@ -505,7 +505,7 @@ function urlFormat(obj) {
if (typeof obj === 'string') { obj = urlParse(obj); }
else if (typeof obj !== 'object' || obj === null)
{ throw new TypeError(
'Parameter "urlObj" must be an object, not ' + obj === null ? 'null' : typeof obj
'Parameter "urlObj" must be an object, not ' + (obj === null ? 'null' : typeof obj)
); }
else if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }