Skip to content

Commit d4168ae

Browse files
chore: enabled ESLint's no-unused-vars (#5399)
1 parent 6ee5b48 commit d4168ae

18 files changed

+42
-48
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = [
2323
},
2424
rules: {
2525
'n/prefer-node-protocol': 'error',
26+
'no-unused-vars': 'error',
2627
strict: ['error', 'global'],
2728

2829
'no-var': 'off',

lib/cli/collect-files.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
const fs = require('node:fs');
43
const path = require('node:path');
54
const pc = require('picocolors');
65
const debug = require('debug')('mocha:cli:run:helpers');

lib/cli/run-helpers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const {format} = require('node:util');
1717
const {createInvalidLegacyPluginError} = require('../errors');
1818
const {requireOrImport} = require('../nodejs/esm-utils');
1919
const PluginLoader = require('../plugin-loader');
20-
const {UnmatchedFile} = require('./collect-files');
2120

2221
/**
2322
* Exits Mocha when tests + code under test has finished execution (default)

lib/errors.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,9 @@ function createTimeoutError(msg, timeout, file) {
507507
* @public
508508
* @static
509509
* @param {string} message - Error message to be displayed.
510-
* @param {string} filename - File name
511510
* @returns {Error} Error with code {@link constants.UNPARSABLE_FILE}
512511
*/
513-
function createUnparsableFileError(message, filename) {
512+
function createUnparsableFileError(message) {
514513
var err = new Error(message);
515514
err.code = constants.UNPARSABLE_FILE;
516515
return err;

lib/reporters/html.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function HTML(runner, options) {
9292
items[progressIndex].getElementsByClassName('ring-flatlight')[0],
9393
items[progressIndex].getElementsByClassName('ring-highlight')[0]
9494
];
95-
var progressRingRadius = null; // computed CSS unavailable now, so set later
9695
var root = document.getElementById('mocha');
9796

9897
if (!root) {

lib/reporters/tap.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function title(test) {
9797
* @param {string} format - `printf`-like format string
9898
* @param {...*} [varArgs] - Format string arguments
9999
*/
100-
function println(format, varArgs) {
100+
function println() {
101101
var vargs = Array.from(arguments);
102102
vargs[0] += '\n';
103103
process.stdout.write(sprintf.apply(null, vargs));
@@ -184,9 +184,8 @@ TAPProducer.prototype.writePending = function (n, test) {
184184
* @abstract
185185
* @param {number} n - Index of test that failed.
186186
* @param {Test} test - Instance containing test information.
187-
* @param {Error} err - Reason the test failed.
188187
*/
189-
TAPProducer.prototype.writeFail = function (n, test, err) {
188+
TAPProducer.prototype.writeFail = function (n, test) {
190189
println('not ok %d %s', n, title(test));
191190
};
192191

lib/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ Runner.prototype.run = function (fn, opts = {}) {
11661166
* }
11671167
* }
11681168
*/
1169-
Runner.prototype.linkPartialObjects = function (value) {
1169+
Runner.prototype.linkPartialObjects = function () {
11701170
return this;
11711171
};
11721172

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ exports.noop = function () {};
543543
* @param {...*} [obj] - Arguments to `Object.assign()`.
544544
* @returns {Object} An object with no prototype, having `...obj` properties
545545
*/
546-
exports.createMap = function (obj) {
546+
exports.createMap = function () {
547547
return Object.assign.apply(
548548
null,
549549
[Object.create(null)].concat(Array.prototype.slice.call(arguments))

test/integration/hook-err.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function onlyConsoleOutput() {
292292
};
293293
}
294294

295-
function onlyErrorTitle(line) {
295+
function onlyErrorTitle() {
296296
let foundErrorTitle = false;
297297
let foundError = false;
298298
return line => {

test/integration/options/posixExitCodes.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var helpers = require('../helpers');
44
var runMocha = helpers.runMocha;
55
var os = require('node:os');
66

7-
const EXIT_SUCCESS = 0;
87
const EXIT_FAILURE = 1;
98
const SIGNAL_OFFSET = 128;
109

0 commit comments

Comments
 (0)