Skip to content

Commit

Permalink
Disallow unused variables & imports
Browse files Browse the repository at this point in the history
  • Loading branch information
flenter committed Jun 5, 2024
1 parent 1833002 commit 40eb83d
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 16 deletions.
15 changes: 9 additions & 6 deletions api/biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"extends": ["../biome.jsonc"],
"css": {
"linter": {
"enabled": true
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
"recommended": true,
"correctness": {
"noUnusedImports": {
"level": "error"
},
"noUnusedVariables": {
"level": "error"
}
}
}
},
"files": {
Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/find-source-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async function findFunctionByDefinition(
});

return foundLocation;
} catch (error) {
} catch {
console.error("Error reading or parsing file:", jsFilePath);
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function tryParseJsonObjectMessage(str: unknown) {
}
try {
return JSON.parse(str);
} catch (e) {
} catch {
return str;
}
}
1 change: 0 additions & 1 deletion api/src/routes/issues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from "node:fs";
import { githubIssues, newGithubIssueSchema } from "@/db/schema";
import * as schema from "@/db/schema";
import type { Bindings, Variables } from "@/lib/types";
Expand Down
2 changes: 1 addition & 1 deletion api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@/*": ["src/*"]
}
},
"include": ["src"],
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "scripts"]
}
18 changes: 16 additions & 2 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true
"recommended": true,
"correctness": {
"noUnusedImports": {
"level": "error"
},
"noUnusedVariables": {
"level": "error"
}
}
}
}
},
Expand All @@ -37,6 +45,12 @@
}
],
"files": {
"ignore": ["meta/*.json", "dist/*.js", "test-content/*.*", "fpx/*.*"]
"ignore": [
"meta/*.json",
"dist/*.js",
"dist/*.d.ts",
"test-content/*.*",
"fpx/*.*"
]
}
}
5 changes: 3 additions & 2 deletions client-library/src/honoMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export function createHonoMiddleware(options: {
libraryDebugMode,
monitor: {
fetch: monitorFetch,
logging: monitorLogging,
requests: monitorRequests,
// TODO - implement these controls/features
// logging: monitorLogging,
// requests: monitorRequests,
},
} = options.createConfig(c);
const ctx = c.executionCtx;
Expand Down
2 changes: 1 addition & 1 deletion client-library/src/request-logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from "hono";
import type { MiddlewareHandler, RouterRoute } from "hono/types";
import type { RouterRoute } from "hono/types";
import { getPath } from "hono/utils/url";

export const RECORDED_CONSOLE_METHODS = [
Expand Down
2 changes: 1 addition & 1 deletion client-library/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function tryPrettyPrintLoggerLog(fn: PrintFunc, message: string) {
if (out) {
fn.apply(fn, [out]);
}
} catch (error) {
} catch {
// Fail silently
}
}
Expand Down

0 comments on commit 40eb83d

Please sign in to comment.