Skip to content

Commit b4b4a1b

Browse files
authored
chore: enable reportUnusedDisableDirectives for eslint (#4085)
1 parent 9b7ae7b commit b4b4a1b

File tree

13 files changed

+8
-27
lines changed

13 files changed

+8
-27
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
sourceType: "script",
88
ecmaVersion: 2018,
99
},
10+
reportUnusedDisableDirectives: true,
1011
env: {
1112
node: true,
1213
es6: true,

client-src/socket.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import { log } from "./utils/log.js";
66
// this WebsocketClient is here as a default fallback, in case the client is not injected
77
/* eslint-disable camelcase */
88
const Client =
9-
// eslint-disable-next-line camelcase, no-nested-ternary
9+
// eslint-disable-next-line no-nested-ternary
1010
typeof __webpack_dev_server_client__ !== "undefined"
11-
? // eslint-disable-next-line camelcase
12-
typeof __webpack_dev_server_client__.default !== "undefined"
11+
? typeof __webpack_dev_server_client__.default !== "undefined"
1312
? __webpack_dev_server_client__.default
1413
: __webpack_dev_server_client__
1514
: WebSocketClient;
@@ -39,7 +38,7 @@ const socket = function initSocket(url, handlers, reconnect) {
3938
if (retries < maxRetries) {
4039
// Exponentially increase timeout to reconnect.
4140
// Respectfully copied from the package `got`.
42-
// eslint-disable-next-line no-mixed-operators, no-restricted-properties
41+
// eslint-disable-next-line no-restricted-properties
4342
const retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
4443

4544
retries += 1;

examples/general/proxy-hot-reload/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fs.watch("./proxy-config.js", () => {
2727
};
2828
}
2929
} catch (e) {
30-
// eslint-disable-line
30+
// ignore
3131
}
3232
});
3333

lib/Server.js

-5
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,6 @@ class Server {
11611161
);
11621162
} else {
11631163
try {
1164-
// eslint-disable-next-line import/no-dynamic-require
11651164
ClientImplementation = require.resolve(clientTransport);
11661165
} catch (e) {
11671166
clientImplementationFound = false;
@@ -1308,7 +1307,6 @@ class Server {
13081307
signals.forEach((signal) => {
13091308
const listener = () => {
13101309
if (needForceShutdown) {
1311-
// eslint-disable-next-line no-process-exit
13121310
process.exit();
13131311
}
13141312

@@ -1321,11 +1319,9 @@ class Server {
13211319
this.stopCallback(() => {
13221320
if (typeof this.compiler.close === "function") {
13231321
this.compiler.close(() => {
1324-
// eslint-disable-next-line no-process-exit
13251322
process.exit();
13261323
});
13271324
} else {
1328-
// eslint-disable-next-line no-process-exit
13291325
process.exit();
13301326
}
13311327
});
@@ -1838,7 +1834,6 @@ class Server {
18381834
return open(openTarget, item.options).catch(() => {
18391835
this.logger.warn(
18401836
`Unable to open "${openTarget}" page${
1841-
// eslint-disable-next-line no-nested-ternary
18421837
item.options.app
18431838
? ` in "${item.options.app.name}" app${
18441839
item.options.app.arguments

lib/servers/SockJSServer.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"use strict";
22

3-
/* eslint-disable
4-
class-methods-use-this
5-
*/
63
const sockjs = require("sockjs");
74
const BaseServer = require("./BaseServer");
85

lib/servers/WebsocketServer.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"use strict";
22

3-
/* eslint-disable
4-
class-methods-use-this
5-
*/
63
const WebSocket = require("ws");
74
const BaseServer = require("./BaseServer");
85

test/e2e/entry.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ describe("entry", () => {
371371
});
372372

373373
new webpack.EntryPlugin(compiler.context, entryFirst, {
374-
// eslint-disable-next-line no-undefined
375374
name: "main",
376375
}).apply(compiler);
377376

test/e2e/overlay.test.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class ErrorPlugin {
1717
this.counter = 0;
1818
}
1919

20-
// eslint-disable-next-line class-methods-use-this
2120
apply(compiler) {
2221
compiler.hooks.thisCompilation.tap(
2322
"errors-webpack-plugin",
@@ -44,7 +43,6 @@ class WarningPlugin {
4443
this.counter = 0;
4544
}
4645

47-
// eslint-disable-next-line class-methods-use-this
4846
apply(compiler) {
4947
compiler.hooks.thisCompilation.tap(
5048
"warnings-webpack-plugin",

test/e2e/static-directory.test.js

-2
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ describe("static.directory option", () => {
486486
it("Should throw exception (external url)", (done) => {
487487
expect.assertions(1);
488488

489-
// eslint-disable-next-line no-unused-vars
490489
server = testServer.start(
491490
config,
492491
{
@@ -547,7 +546,6 @@ describe("static.directory option", () => {
547546
});
548547

549548
it("Should throw exception (array with absolute url)", (done) => {
550-
// eslint-disable-next-line no-unused-vars
551549
server = testServer.start(
552550
config,
553551
{

test/fixtures/custom-client/CustomSockJSClient.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"use strict";
22

3-
/* eslint-disable
4-
no-unused-vars
5-
*/
63
const SockJS = require("sockjs-client/dist/sockjs");
74

85
module.exports = class SockJSClient {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"use strict";
22

3-
console.log("Hey."); // eslint-disable-line
3+
console.log("Hey.");

test/fixtures/historyapifallback-3-config/foo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
require("./bar.html");
44

5-
console.log("Hey."); // eslint-disable-line
5+
console.log("Hey.");

test/fixtures/historyapifallback-config/foo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
require("./index.html");
44
require("./bar.html");
55

6-
console.log("Hey."); // eslint-disable-line
6+
console.log("Hey.");

0 commit comments

Comments
 (0)