Skip to content

Commit 377ff44

Browse files
committed
lint
1 parent a74fcfb commit 377ff44

File tree

5 files changed

+55
-48
lines changed

5 files changed

+55
-48
lines changed

examples/hackernews.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ function Pager({page}) {
117117
async function List({page, start = (page - 1) * 30 + 1}) {
118118
const result = await fetch(`https://api.hnpwa.com/v0/news/${page}.json`);
119119
const stories = await result.json();
120-
const items = stories.map((story) => (
121-
<Story story={story} key={story.id} />
122-
));
120+
const items = stories.map((story) => <Story story={story} key={story.id} />);
123121
return (
124122
<Fragment>
125123
<Pager page={page} />

examples/password-strength.js

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,55 @@ import {renderer} from "@b9g/crank/dom";
33
// Adapted from https://backbonenotbad.hyperclay.com/
44
// https://gist.github.com/panphora/8f4d620ae92e8b28dcb4f20152185749
55
function* PasswordStrength() {
6-
const requirements = [
7-
{label: '8+ characters', check: (pwd) => pwd.length >= 8},
8-
{label: '12+ characters', check: (pwd) => pwd.length >= 12},
9-
{label: 'Lowercase letter', check: (pwd) => /[a-z]/.test(pwd)},
10-
{label: 'Uppercase letter', check: (pwd) => /[A-Z]/.test(pwd)},
11-
{label: 'Number', check: (pwd) => /\d/.test(pwd)},
12-
{label: 'Special character', check: (pwd) => /[^a-zA-Z0-9]/.test(pwd)},
13-
];
6+
const requirements = [
7+
{label: "8+ characters", check: (pwd) => pwd.length >= 8},
8+
{label: "12+ characters", check: (pwd) => pwd.length >= 12},
9+
{label: "Lowercase letter", check: (pwd) => /[a-z]/.test(pwd)},
10+
{label: "Uppercase letter", check: (pwd) => /[A-Z]/.test(pwd)},
11+
{label: "Number", check: (pwd) => /\d/.test(pwd)},
12+
{label: "Special character", check: (pwd) => /[^a-zA-Z0-9]/.test(pwd)},
13+
];
1414

15-
let password = '';
15+
let password = "";
1616

17-
for ({} of this) {
18-
yield (
19-
<div class="w-80 p-6 bg-white rounded-xl shadow-lg space-y-4">
20-
<input
21-
type="password"
22-
value={password}
23-
oninput={(e) => this.refresh(() => password = e.target.value)}
24-
placeholder="Enter password"
25-
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2"
26-
/>
27-
<div class="space-y-2">
28-
{requirements.map((req, idx) => {
29-
const isMet = req.check(password);
30-
return (
31-
<div key={idx} class="flex items-center gap-2">
32-
<div class={`w-5 h-5 rounded-full flex items-center justify-center text-xs font-bold ${isMet ? 'bg-green-500 text-white' : 'bg-gray-200 text-gray-400'}`}>
33-
{isMet ? '✓' : ''}
34-
</div>
35-
<span class={`text-sm ${isMet ? 'text-green-600 font-medium' : 'text-gray-500'}`}>
36-
{req.label}
37-
</span>
38-
</div>
39-
);
40-
})}
41-
</div>
42-
</div>
43-
);
44-
}
17+
for ({} of this) {
18+
yield (
19+
<div class="w-80 p-6 bg-white rounded-xl shadow-lg space-y-4">
20+
<input
21+
type="password"
22+
value={password}
23+
oninput={(e) => this.refresh(() => (password = e.target.value))}
24+
placeholder="Enter password"
25+
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2"
26+
/>
27+
<div class="space-y-2">
28+
{requirements.map((req, idx) => {
29+
const isMet = req.check(password);
30+
return (
31+
<div key={idx} class="flex items-center gap-2">
32+
<div
33+
class={`w-5 h-5 rounded-full flex items-center justify-center text-xs font-bold ${isMet ? "bg-green-500 text-white" : "bg-gray-200 text-gray-400"}`}
34+
>
35+
{isMet ? "✓" : ""}
36+
</div>
37+
<span
38+
class={`text-sm ${isMet ? "text-green-600 font-medium" : "text-gray-500"}`}
39+
>
40+
{req.label}
41+
</span>
42+
</div>
43+
);
44+
})}
45+
</div>
46+
</div>
47+
);
48+
}
4549
}
4650

47-
const script = document.createElement('script');
48-
script.src = 'https://cdn.tailwindcss.com';
51+
const script = document.createElement("script");
52+
script.src = "https://cdn.tailwindcss.com";
4953
document.head.appendChild(script);
50-
await new Promise((resolve) => script.addEventListener("load", () => resolve(), {once: true}));
54+
await new Promise((resolve) =>
55+
script.addEventListener("load", () => resolve(), {once: true}),
56+
);
5157
renderer.render(<PasswordStrength />, document.body);

examples/todomvc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ link.href = "https://unpkg.com/[email protected]/index.css";
263263
// remove default stylesheet for playground
264264
document.head.querySelector("link").remove();
265265
document.head.appendChild(link);
266-
await new Promise((resolve) => link.addEventListener("load", () => resolve(), {once: true}));
266+
await new Promise((resolve) =>
267+
link.addEventListener("load", () => resolve(), {once: true}),
268+
);
267269

268270
renderer.render(<App />, document.body);

website/src/utils/color-scheme.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ export function getColorSchemeScript(): string {
9090
export function syncIframes(scheme: ColorScheme): void {
9191
if (typeof window === "undefined") return;
9292

93-
const iframes = document.querySelectorAll<HTMLIFrameElement>(
94-
".playground-iframe",
95-
);
93+
const iframes =
94+
document.querySelectorAll<HTMLIFrameElement>(".playground-iframe");
9695

9796
for (const iframe of iframes) {
9897
// Send message to iframe

website/src/views/home.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ function CallToAction() {
173173

174174
function AntiHero() {
175175
return jsx`
176-
<div class=${css`height: 100vh`} />
176+
<div class=${css`
177+
height: 100vh;
178+
`} />
177179
`;
178180
}
179181

0 commit comments

Comments
 (0)