Skip to content

Commit

Permalink
Fix ESLint config
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorabito-woolpert committed Jan 14, 2025
1 parent eab109b commit 103d9a1
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 50 deletions.
30 changes: 0 additions & 30 deletions application/backend/.eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions application/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
**/*.js
**/*.map

!eslint.config.js
6 changes: 2 additions & 4 deletions application/backend/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ app.disable("x-powered-by");

// compression
app.use(
compression({
filter: (req: Request, res: Response) => true
})
compression()
);

// cors
Expand Down Expand Up @@ -71,7 +69,7 @@ app.get("/config.json", async (req: Request, res: Response) => {
// get config.json from angular app when proxied
if (process.env.FRONTEND_PROXY) {
try {
const axios = (await import("axios")) as any;
const axios = (await import("axios") as any);
const response = await axios.get(
process.env.FRONTEND_PROXY + "config.json"
);
Expand Down
21 changes: 21 additions & 0 deletions application/backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
[
{
ignores: [
"node_modules/**",
"lib/**",
"**/*.js"
],
},
eslint.configs.recommended,
tseslint.configs.recommended,
],
{
rules: {
"@typescript-eslint/no-explicit-any": "warn"
}
}
);
4 changes: 2 additions & 2 deletions application/backend/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ if (!process.env.LOG_FORMAT || process.env.LOG_FORMAT === "google") {

return object;
},
log: (o: any) => {
log: (o: Record<string, unknown>) => {
const { err, ...reshaped } = o;
if (err) {
if (err instanceof Error) {
reshaped.stack_trace = err.stack;
}
return { serviceContext, ...reshaped };
Expand Down
39 changes: 36 additions & 3 deletions application/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions application/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
"@types/node": "^22.10.6",
"@types/pako": "^2.0.3",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"axios": "^1.7.9",
"concurrently": "^9.1.2",
"eslint": "^9.18.0",
Expand All @@ -43,6 +41,7 @@
"pino-pretty": "^13.0.0",
"supertest": "^7.0.0",
"typescript": "^5.7.3",
"typescript-eslint": "^8.20.0",
"ts-node": "^10.9.2",
"ts-jest": "^29.2.5"
}
Expand Down
9 changes: 5 additions & 4 deletions application/backend/routes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const router = express.Router();

import { generateFileName, shortName, storage } from "../services/storage";
import { log } from "../logging";
import { GetFilesOptions } from "@google-cloud/storage";

router.get("/healthz", async (req: Request, res: Response) => {
log.logger.debug("Health check (API)");
Expand Down Expand Up @@ -61,14 +62,14 @@ router.get("/status/:date?/:name", async (req: Request, res: Response) => {
router.get("/scenarios", async (req: Request, res: Response) => {
const queryObject = url.parse(req.url, true).query;

const options: { [k: string]: any } = {};
const options: GetFilesOptions = {};

if ("limit" in queryObject) {
options.maxResults = parseInt(queryObject.limit as string);
options.autoPaginate = false;
}
if ("pageToken" in queryObject) {
options.pageToken = queryObject.pageToken;
options.pageToken = queryObject.pageToken as string;
}

if ("startsWith" in queryObject) {
Expand All @@ -87,14 +88,14 @@ router.get("/scenarios", async (req: Request, res: Response) => {
router.get("/solutions", async (req: Request, res: Response) => {
const queryObject = url.parse(req.url, true).query;

const options: { [k: string]: any } = {};
const options: GetFilesOptions = {};

if ("limit" in queryObject || "pageToken" in queryObject) {
options.maxResults = parseInt(queryObject.limit as string);
options.autoPaginate = true;

if ("pageToken" in queryObject) {
options.pageToken = queryObject.pageToken;
options.pageToken = queryObject.pageToken as string;
}
}

Expand Down
12 changes: 7 additions & 5 deletions application/backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"lib": ["ESNext"],
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "Node",
"sourceMap": true,
"target": "ESNext",

"forceConsistentCasingInFileNames": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"removeComments": true
"noImplicitAny": true,
"removeComments": true,
},
"include": [
"**/*.ts"
Expand Down

0 comments on commit 103d9a1

Please sign in to comment.