Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions benchmark/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
* Run with: npm run benchmark
*/

/* eslint-disable no-console */

const core = require('@actions/core');
const Parse = require('parse/node');
const { performance, PerformanceObserver } = require('perf_hooks');
const { performance } = require('node:perf_hooks');
const { MongoClient } = require('mongodb');
const { wrapMongoDBWithLatency } = require('./MongoLatencyWrapper');

Expand Down
2 changes: 1 addition & 1 deletion ci/nodeEngineCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class NodeEngineCheck {
file: file,
nodeVersion: version
});
} catch(e) {
} catch {
// eslint-disable-next-line no-console
console.log(`Ignoring file because it is not valid JSON: ${file}`);
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
Expand Down
7 changes: 7 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const js = require("@eslint/js");
const babelParser = require("@babel/eslint-parser");
const globals = require("globals");
const unusedImports = require("eslint-plugin-unused-imports");

module.exports = [
{
ignores: ["**/lib/**", "**/coverage/**", "**/out/**", "**/types/**"],
Expand All @@ -19,8 +21,13 @@ module.exports = [
requireConfigFile: false,
},
},
plugins: {
"unused-imports": unusedImports,
},
rules: {
indent: ["error", 2, { SwitchCase: 1 }],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "error",
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": "error",
"eol-last": "error",
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"deep-diff": "1.0.2",
"eslint": "9.27.0",
"eslint-plugin-expect-type": "0.6.2",
"eslint-plugin-unused-imports": "4.3.0",
"flow-bin": "0.271.0",
"form-data": "4.0.4",
"globals": "16.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Analytics/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
/**
* @interface AnalyticsAdapter
* @module Adapters
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Auth/AuthAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */

/**
* @interface ParseAuthResponse
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Auth/apple.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const getAppleKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => {
let key;
try {
key = await authUtils.getSigningKey(client, keyId);
} catch (error) {
} catch {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
`Unable to find matching key for Key ID: ${keyId}`
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Auth/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const getFacebookKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => {
let key;
try {
key = await authUtils.getSigningKey(client, keyId);
} catch (error) {
} catch {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
`Unable to find matching key for Key ID: ${keyId}`
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Cache/CacheAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
/**
* @interface
* @memberof module:Adapters
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Email/MailAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
/**
* @interface
* @memberof module:Adapters
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Files/FilesAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
// Files Adapter
//
// Allows you to change the file storage mechanism.
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Files/GridFSBucketAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class GridFSBucketAdapter extends FilesAdapter {
fileNamesNotRotated = fileNamesNotRotated.filter(function (value) {
return value !== fileName;
});
} catch (err) {
} catch {
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Logger/LoggerAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
/**
* @interface
* @memberof module:Adapters
Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Logger/WinstonLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function configureTransports(options) {
parseServerError.name = 'parse-server-error';
transports.push(parseServerError);
}
} catch (e) {
} catch {
/* */
}

Expand Down Expand Up @@ -86,7 +86,7 @@ export function configureLogger({
}
try {
fs.mkdirSync(logsFolder);
} catch (e) {
} catch {
/* */
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/PubSub/PubSubAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
/**
* @interface
* @memberof module:Adapters
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Push/PushAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unused-imports/no-unused-vars */
// @flow
/*eslint no-unused-vars: "off"*/
// Push Adapter
//
// Allows you to change the push notification mechanism.
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/WebSocketServer/WSAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
import { WSSAdapter } from './WSSAdapter';
const WebSocketServer = require('ws').Server;

Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/WebSocketServer/WSSAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: "off"*/
/* eslint-disable unused-imports/no-unused-vars */
// WebSocketServer Adapter
//
// Adapter classes must implement the following functions:
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/HooksController.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function wrapToHTTPRequest(hook, key) {
if (typeof body === 'string') {
try {
body = JSON.parse(body);
} catch (e) {
} catch {
err = {
error: 'Malformed response',
code: -1,
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export function getDatabaseAdapter(databaseURI, collectionPrefix, databaseOption
try {
const parsedURI = new URL(databaseURI);
protocol = parsedURI.protocol ? parsedURI.protocol.toLowerCase() : null;
} catch (e) {
} catch {
/* */
}
switch (protocol) {
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/loaders/filesMutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const handleUpload = async (upload, config) => {
res.on('end', () => {
try {
resolve(JSON.parse(data));
} catch (e) {
} catch {
reject(new Parse.Error(Parse.error, data));
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/Options/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function moduleOrObjectParser(opt) {
}
try {
return JSON.parse(opt);
} catch (e) {
} catch {
/* */
}
return opt;
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/ClassesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class ClassesRouter extends PromiseRouter {
for (const [key, value] of _.entries(query)) {
try {
json[key] = JSON.parse(value);
} catch (e) {
} catch {
json[key] = value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/FilesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class FilesRouter {
const data = await filesController.getMetadata(filename);
res.status(200);
res.json(data);
} catch (e) {
} catch {
res.status(200);
res.json({});
}
Expand Down
6 changes: 3 additions & 3 deletions src/Routers/PagesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class PagesRouter extends PromiseRouter {
let data;
try {
data = await this.readFile(path);
} catch (e) {
} catch {
return this.notFound();
}

Expand Down Expand Up @@ -474,7 +474,7 @@ export class PagesRouter extends PromiseRouter {
let data;
try {
data = await this.readFile(path);
} catch (e) {
} catch {
return this.notFound();
}

Expand Down Expand Up @@ -517,7 +517,7 @@ export class PagesRouter extends PromiseRouter {
try {
const json = require(path.resolve('./', this.pagesConfig.localizationJsonPath));
this.jsonParameters = json;
} catch (e) {
} catch {
throw errors.jsonFailedFileLoading;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Utils {
try {
await fs.access(path);
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function mountOnto(router) {
function parseURL(urlString) {
try {
return new URL(urlString);
} catch (error) {
} catch {
return undefined;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function logStartupOptions(options) {
if (typeof value === 'object') {
try {
value = JSON.stringify(value);
} catch (e) {
} catch {
if (value && value.constructor && value.constructor.name) {
value = value.constructor.name;
}
Expand Down
6 changes: 3 additions & 3 deletions src/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export async function handleParseHeaders(req, res, next) {
if (Object.prototype.toString.call(context) !== '[object Object]') {
throw 'Context is not an object';
}
} catch (e) {
} catch {
return malformedContext(req, res);
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@ export async function handleParseHeaders(req, res, next) {
// to provide x-parse-app-id in header and parse a binary file will fail
try {
req.body = JSON.parse(req.body);
} catch (e) {
} catch {
return invalidRequest(req, res);
}
fileViaJSON = true;
Expand Down Expand Up @@ -173,7 +173,7 @@ export async function handleParseHeaders(req, res, next) {
if (Object.prototype.toString.call(info.context) !== '[object Object]') {
throw 'Context is not an object';
}
} catch (e) {
} catch {
return malformedContext(req, res);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ try {
hash: _bcrypt.hash,
compare: _bcrypt.verify,
};
} catch (e) {
} catch {
/* */
}

Expand Down
2 changes: 1 addition & 1 deletion src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HTTPResponse {
if (!_data) {
try {
_data = JSON.parse(getText());
} catch (e) {
} catch {
/* */
}
}
Expand Down
Loading