Skip to content

Commit

Permalink
Update ESLint and use new config format
Browse files Browse the repository at this point in the history
Closes #412.
  • Loading branch information
domenic committed Aug 2, 2024
1 parent feb8266 commit a3d37a8
Show file tree
Hide file tree
Showing 10 changed files with 668 additions and 701 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// The sample config should suffice for just starting up the server.
// We may need something fancier if the integration tests get more in-depth.
jest.mock("../private-config.json", () => {
// eslint-disable-next-line global-require
return require("../private-config.sample.json");
}, { virtual: true });

Expand Down
31 changes: 31 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import domenicConfig from "@domenic/eslint-config";
import globals from "globals";

export default [
{
ignores: ["coverage/**/*"]
},
{
files: ["**/*.js"],
languageOptions: {
sourceType: "commonjs",
globals: globals.node
}
},
...domenicConfig,
{
rules: {
camelcase: ["error", { properties: "never" }]
}
},
{
files: ["__tests__/**/*.js"],
languageOptions: {
globals: globals.jest
},
rules: {
// Plays poorly with how we set up mocks.
"no-loop-func": "off"
}
}
];
2 changes: 1 addition & 1 deletion lib/get-user-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async function isOrgMember(org, username) {
try {
await gitHubAPI.orgs.checkPublicMembershipForUser({ org, username });
return true;
} catch (e) {
} catch {
return false;
}
}
1 change: 0 additions & 1 deletion lib/helpers/private-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use strict";
/* eslint-disable global-require */

let privateConfig;
const privateConfigFromEnv = process.env.PRIVATE_CONFIG_JSON;
Expand Down
2 changes: 1 addition & 1 deletion lib/process-agreement.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function getEntityInfo(body) {

try {
info.url = (new URL(info.url)).href;
} catch (e) {
} catch {
throw new BadRequest("The given 'url' could not be parsed as a URL");
}

Expand Down
2 changes: 1 addition & 1 deletion lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = [
let parsedURL;
try {
parsedURL = new URL(pr);
} catch (e) {
} catch {
throw new BadRequest("The pull request URL parameter must be a valid URL.");
}

Expand Down
Loading

0 comments on commit a3d37a8

Please sign in to comment.