Skip to content

Commit

Permalink
Apply biome fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jan 10, 2025
1 parent 6168b65 commit 6a5493d
Show file tree
Hide file tree
Showing 10 changed files with 1,093 additions and 829 deletions.
5 changes: 0 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
module.exports = {
settings: {
jest: {
version: 28,
},
},
env: {
es2022: true,
node: true,
Expand Down
107 changes: 107 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.1/schema.json",
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"files": {
"ignore": ["dist"]
},
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessSwitchCase": "off",
"useOptionalChain": "off"
},
"a11y": {
"useKeyWithClickEvents": "off",
"noAutofocus": "off",
"noSvgWithoutTitle": "off"
},
"performance": {
"noDelete": "off"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noUnknownFunction": "off",
"noUnusedImports": "warn",
"noSelfAssign": "error",
"useExhaustiveDependencies": "warn",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnsafeOptionalChaining": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": {
"noNonNullAssertion": "off",
"noRestrictedGlobals": {
"level": "error",
"options": {
"deniedGlobals": [
"location",
"event",
"name",
"alert",
"confirm",
"self",
"top",
"history"
]
}
},
"noParameterAssign": "off",
"noUselessElse": "off",
"useConst": "off"
},
"security": {
"noDangerouslySetInnerHtml": "off"
},
"suspicious": {
"noAssignInExpressions": "off",
"noDuplicateSelectorsKeyframeBlock": "off",
"noExplicitAny": "off",
"noArrayIndexKey": "off"
}
}
},
"overrides": [
{
"include": ["*.test.*", "test/**/*"],
"linter": {
"rules": {
"style": {
"noNonNullAssertion": "off"
},
"suspicious": {
"noImplicitAnyLet": "off"
}
}
}
}
],
"javascript": {
"formatter": {
"trailingCommas": "es5"
},
"globals": ["React", "JSX", "Deno"]
}
}
2 changes: 1 addition & 1 deletion deno-bootstrap/deno.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"lock": false}
{ "lock": false }
10 changes: 5 additions & 5 deletions deno-bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const scriptType = Deno.args[1];
const script = Deno.args[2];

const importURL =
scriptType == "import"
scriptType === "import"
? script
: "data:text/tsx," + encodeURIComponent(script);
: `data:text/tsx,${encodeURIComponent(script)}`;

const mod = await import(importURL);
if (!mod.default) {
Expand All @@ -17,11 +17,11 @@ if (typeof mod.default.fetch !== "function") {

const onError =
mod.default.onError ??
function (error: unknown) {
((error: unknown) => {
console.error(error);
return new Response("Internal Server Error", { status: 500 });
};
const onListen = mod.default.onListen ?? function (_localAddr: Deno.NetAddr) {};
});
const onListen = mod.default.onListen ?? ((_localAddr: Deno.NetAddr) => {});

// Use an empty onListen callback to prevent Deno from logging
const server = Deno.serve(
Expand Down
165 changes: 165 additions & 0 deletions package-lock.json

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

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"build": "tsc --build",
"prepare": "npm run lint && npm run build"
},
"files": [
"dist",
"deno-bootstrap"
],
"files": ["dist", "deno-bootstrap"],
"repository": {
"type": "git",
"url": "git+https://github.com/val-town/deno-http-worker.git"
Expand All @@ -32,11 +29,12 @@
},
"homepage": "https://github.com/val-town/deno-http-worker#readme",
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/eslint": "^8.44.4",
"@types/node": "^20.12.7",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"@types/eslint": "^8.44.4",
"typescript": "^5.4.5",
"vitest": "^2"
}
Expand Down
Loading

0 comments on commit 6a5493d

Please sign in to comment.