Skip to content

[pre-commit.ci] pre-commit autoupdate, fix eslint hook for eslint 9 #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 14, 2025
Merged
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
15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

10 changes: 0 additions & 10 deletions .jshintrc

This file was deleted.

10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ repos:
rev: v6.2.1
hooks:
- id: beautysh
additional_dependencies:
- setuptools

# Autoformat: markdown, javacsript
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args:
Expand All @@ -26,9 +28,13 @@ repos:

# Lint
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.53.0
rev: v9.26.0
hooks:
- id: eslint
additional_dependencies:
- "eslint@^9.26.0"
- "@eslint/js@^9.26.0"
- "globals@^16.1.0"

# pre-commit.ci config reference: https://pre-commit.ci/#configuration
ci:
Expand Down
32 changes: 32 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const globals = require("globals");
const { defineConfig } = require("eslint/config");
const js = require("@eslint/js");

module.exports = defineConfig([
js.configs.recommended,
{
files: ["bin/*", "**/*.js"],
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.node,
},
},
rules: {
"no-unused-vars": ["error", { args: "none" }],
},
},
{
files: ["test/**/*.js"],
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.node,
...globals.jasmine,
},
},
rules: {
"no-unused-vars": "off",
},
},
]);
4 changes: 1 addition & 3 deletions lib/configproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ var http = require("http"),
path = require("path"),
EventEmitter = require("events").EventEmitter,
httpProxy = require("http-proxy-3"),
winston = require("winston"),
util = require("util"),
defaultLogger = require("./log").defaultLogger,
metrics = require("./metrics");

Expand Down Expand Up @@ -171,7 +169,7 @@ class ConfigurableProxy extends EventEmitter {
});
}
options.ws = true;
var proxy = (this.proxy = httpProxy.createProxyServer(options));
this.proxy = httpProxy.createProxyServer(options);

// tornado-style regex routing,
// because cross-language cargo-culting is always a good idea
Expand Down
18 changes: 7 additions & 11 deletions lib/testutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var defaultLogger = require("./log").defaultLogger;

var servers = [];

var addTarget = (exports.addTarget = function (proxy, path, port, websocket, targetPath) {
function addTarget(proxy, path, port, websocket, targetPath) {
var target = "http://127.0.0.1:" + port;
if (targetPath) {
target = target + targetPath;
Expand Down Expand Up @@ -48,15 +48,11 @@ var addTarget = (exports.addTarget = function (proxy, path, port, websocket, tar
// so that activity can more easily be measured
return proxy._routes.update(path, { last_activity: proxy._setup_timestamp });
});
});

var addTargetRedirecting = (exports.addTargetRedirecting = function (
proxy,
path,
port,
targetPath,
redirectTo
) {
}

exports.addTarget = addTarget;

exports.addTargetRedirecting = function (proxy, path, port, targetPath, redirectTo) {
// Like the above, but the server returns a redirect response with a Location header.
// Cannot use default arguments as they are apparently not supported.
var target = "http://127.0.0.1:" + port;
Expand All @@ -75,7 +71,7 @@ var addTargetRedirecting = (exports.addTargetRedirecting = function (
server.listen(port);
servers.push(server);
});
});
};

function addTargets(proxy, paths, port) {
if (paths.length === 0) {
Expand Down
Loading