refactor: Add lint rules for no unused vars and unused import (#9940)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
/**
|
||||
* @interface AnalyticsAdapter
|
||||
* @module Adapters
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
|
||||
/**
|
||||
* @interface ParseAuthResponse
|
||||
|
||||
@@ -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}`
|
||||
|
||||
@@ -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}`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
/**
|
||||
* @interface
|
||||
* @memberof module:Adapters
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
/**
|
||||
* @interface
|
||||
* @memberof module:Adapters
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -171,7 +171,7 @@ export class GridFSBucketAdapter extends FilesAdapter {
|
||||
fileNamesNotRotated = fileNamesNotRotated.filter(function (value) {
|
||||
return value !== fileName;
|
||||
});
|
||||
} catch (err) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
/**
|
||||
* @interface
|
||||
* @memberof module:Adapters
|
||||
|
||||
@@ -42,7 +42,7 @@ function configureTransports(options) {
|
||||
parseServerError.name = 'parse-server-error';
|
||||
transports.push(parseServerError);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export function configureLogger({
|
||||
}
|
||||
try {
|
||||
fs.mkdirSync(logsFolder);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
/* eslint-disable unused-imports/no-unused-vars */
|
||||
/**
|
||||
* @interface
|
||||
* @memberof module:Adapters
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ function moduleOrObjectParser(opt) {
|
||||
}
|
||||
try {
|
||||
return JSON.parse(opt);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
return opt;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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({});
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ export class PagesRouter extends PromiseRouter {
|
||||
let data;
|
||||
try {
|
||||
data = await this.readFile(path);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return this.notFound();
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ export class PagesRouter extends PromiseRouter {
|
||||
let data;
|
||||
try {
|
||||
data = await this.readFile(path);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return this.notFound();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class Utils {
|
||||
try {
|
||||
await fs.access(path);
|
||||
return true;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ function mountOnto(router) {
|
||||
function parseURL(urlString) {
|
||||
try {
|
||||
return new URL(urlString);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ try {
|
||||
hash: _bcrypt.hash,
|
||||
compare: _bcrypt.verify,
|
||||
};
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class HTTPResponse {
|
||||
if (!_data) {
|
||||
try {
|
||||
_data = JSON.parse(getText());
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user