Skip to content

Commit 69a9258

Browse files
authored
refactor: Add lint rules for no unused vars and unused import (#9940)
1 parent 9ed9af4 commit 69a9258

32 files changed

+66
-36
lines changed

benchmark/performance.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
* Run with: npm run benchmark
99
*/
1010

11-
/* eslint-disable no-console */
12-
1311
const core = require('@actions/core');
1412
const Parse = require('parse/node');
15-
const { performance, PerformanceObserver } = require('perf_hooks');
13+
const { performance } = require('node:perf_hooks');
1614
const { MongoClient } = require('mongodb');
1715
const { wrapMongoDBWithLatency } = require('./MongoLatencyWrapper');
1816

ci/nodeEngineCheck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class NodeEngineCheck {
8686
file: file,
8787
nodeVersion: version
8888
});
89-
} catch(e) {
89+
} catch {
9090
// eslint-disable-next-line no-console
9191
console.log(`Ignoring file because it is not valid JSON: ${file}`);
9292
core.warning(`Ignoring file because it is not valid JSON: ${file}`);

eslint.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const js = require("@eslint/js");
22
const babelParser = require("@babel/eslint-parser");
33
const globals = require("globals");
4+
const unusedImports = require("eslint-plugin-unused-imports");
5+
46
module.exports = [
57
{
68
ignores: ["**/lib/**", "**/coverage/**", "**/out/**", "**/types/**"],
@@ -19,8 +21,13 @@ module.exports = [
1921
requireConfigFile: false,
2022
},
2123
},
24+
plugins: {
25+
"unused-imports": unusedImports,
26+
},
2227
rules: {
2328
indent: ["error", 2, { SwitchCase: 1 }],
29+
"unused-imports/no-unused-imports": "error",
30+
"unused-imports/no-unused-vars": "error",
2431
"linebreak-style": ["error", "unix"],
2532
"no-trailing-spaces": "error",
2633
"eol-last": "error",

package-lock.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"deep-diff": "1.0.2",
9090
"eslint": "9.27.0",
9191
"eslint-plugin-expect-type": "0.6.2",
92+
"eslint-plugin-unused-imports": "4.3.0",
9293
"flow-bin": "0.271.0",
9394
"form-data": "4.0.4",
9495
"globals": "16.2.0",

src/Adapters/Analytics/AnalyticsAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*eslint no-unused-vars: "off"*/
1+
/* eslint-disable unused-imports/no-unused-vars */
22
/**
33
* @interface AnalyticsAdapter
44
* @module Adapters

src/Adapters/Auth/AuthAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*eslint no-unused-vars: "off"*/
1+
/* eslint-disable unused-imports/no-unused-vars */
22

33
/**
44
* @interface ParseAuthResponse

src/Adapters/Auth/apple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const getAppleKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => {
6363
let key;
6464
try {
6565
key = await authUtils.getSigningKey(client, keyId);
66-
} catch (error) {
66+
} catch {
6767
throw new Parse.Error(
6868
Parse.Error.OBJECT_NOT_FOUND,
6969
`Unable to find matching key for Key ID: ${keyId}`

src/Adapters/Auth/facebook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const getFacebookKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => {
122122
let key;
123123
try {
124124
key = await authUtils.getSigningKey(client, keyId);
125-
} catch (error) {
125+
} catch {
126126
throw new Parse.Error(
127127
Parse.Error.OBJECT_NOT_FOUND,
128128
`Unable to find matching key for Key ID: ${keyId}`

src/Adapters/Cache/CacheAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*eslint no-unused-vars: "off"*/
1+
/* eslint-disable unused-imports/no-unused-vars */
22
/**
33
* @interface
44
* @memberof module:Adapters

0 commit comments

Comments
 (0)