Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Dec 21, 2024
1 parent 5365793 commit 2fb80b3
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions www/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
const rulePat = new URLPattern("https://lint.deno.land/rules/:rule", { ignoreCase: true});
const rulePat = new URLPattern("https://lint.deno.land/rules/:rule", {
ignoreCase: true,
});

Deno.serve((req) => {
const url = new URL(req.url);
const url = new URL(req.url);

const ruleMatch = rulePat.exec(req.url);
const maybeRule = ruleMatch?.pathname.groups.rule;
const ruleMatch = rulePat.exec(req.url);
const maybeRule = ruleMatch?.pathname.groups.rule;

if (maybeRule) {
return Response.redirect(`https://docs.deno.com/lint/rules/${maybeRule}`, 301);
}
if (maybeRule) {
return Response.redirect(
`https://docs.deno.com/lint/rules/${maybeRule}`,
301,
);
}

if (url.pathname.startsWith("/ignoring-rules")) {
// TODO(bartlomieju): verify the anchor is not changed or use
// "go" url
return Response.redirect(`https://docs.deno.com/runtime/reference/cli/lint/#ignore-directives`, 301);
}
if (url.pathname.startsWith("/ignoring-rules")) {
// TODO(bartlomieju): verify the anchor is not changed or use
// "go" url
return Response.redirect(
`https://docs.deno.com/runtime/reference/cli/lint/#ignore-directives`,
301,
);
}

return Response.redirect("https://docs.deno.com/runtime/reference/cli/lint/", 304);
})
return Response.redirect(
"https://docs.deno.com/runtime/reference/cli/lint/",
304,
);
});

0 comments on commit 2fb80b3

Please sign in to comment.