Skip to content

Commit e084dfc

Browse files
committed
docs: update 'Used by' and 'Also available in' on readme and website
1 parent d648de6 commit e084dfc

File tree

8 files changed

+211
-0
lines changed

8 files changed

+211
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default tseslint.config({
114114
### Also available in
115115

116116
- [`antfu/eslint-config`](https://github.com/antfu/eslint-config) - Anthony's ESLint config preset.
117+
- [`eslint-config-rebeccastevens`](https://github.com/RebeccaStevens/eslint-config-rebeccastevens) - Rebecca's ESLint config preset.
117118
- [`eslint-config-sheriff`](https://github.com/AndreaPontrandolfo/sheriff) - A comprehensive and opinionated Typescript-first ESLint configuration.
118119
- [`eslint-config-sukka`](https://github.com/SukkaW/eslint-config-sukka) - Sukka's ESLint config preset.
119120

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@eslint/config-inspector": "^0.7.1",
5656
"@eslint/js": "^9.17.0",
5757
"@eslint/markdown": "^6.2.1",
58+
"@napi-rs/canvas": "^0.1.65",
5859
"@stylistic/eslint-plugin": "^2.12.1",
5960
"@susisu/eslint-plugin-safe-typescript": "^0.9.2",
6061
"@swc/core": "^1.10.6",
@@ -90,6 +91,7 @@
9091
"importx": "^0.5.1",
9192
"lefthook": "^1.10.1",
9293
"markdownlint": "^0.37.3",
94+
"ofetch": "^1.4.1",
9395
"picocolors": "^1.1.1",
9496
"publint": "^0.3.0",
9597
"react": "^19.0.0",

packages/plugins/eslint-plugin/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default tseslint.config({
114114
### Also available in
115115

116116
- [`antfu/eslint-config`](https://github.com/antfu/eslint-config) - Anthony's ESLint config preset.
117+
- [`eslint-config-rebeccastevens`](https://github.com/RebeccaStevens/eslint-config-rebeccastevens) - Rebecca's ESLint config preset.
117118
- [`eslint-config-sheriff`](https://github.com/AndreaPontrandolfo/sheriff) - A comprehensive and opinionated Typescript-first ESLint configuration.
118119
- [`eslint-config-sukka`](https://github.com/SukkaW/eslint-config-sukka) - Sukka's ESLint config preset.
119120

pnpm-lock.yaml

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build-used-by.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* eslint-disable no-mixed-operators */
2+
import fs from "node:fs/promises";
3+
4+
import { createCanvas, loadImage } from "@napi-rs/canvas";
5+
import { ofetch } from "ofetch";
6+
7+
const projects = [
8+
"ant-design/ant-design",
9+
"DimensionDev/Maskbook",
10+
"dream-num/univer",
11+
"electric-sql/pglite",
12+
"ensdomains/ensdomains-landing",
13+
"flirtual/flirtual",
14+
"hashintel/hash",
15+
"npmgraph/npmgraph",
16+
"react-navigation/react-navigation",
17+
"refined-github/refined-github",
18+
"RSSNext/Follow",
19+
"TanStack/query",
20+
"toss/suspensive",
21+
"upleveled/eslint-config-upleveled",
22+
"XYOracleNetwork/sdk-xyo-react-js",
23+
"zolplay-cn/config-monorepo",
24+
];
25+
26+
interface GitHubRepo {
27+
owner: {
28+
avatar_url: string;
29+
};
30+
}
31+
32+
async function fetchGitHubAvatar(repo: string, token?: string): Promise<string> {
33+
if (token == null) {
34+
throw new Error("GitHub token is required");
35+
}
36+
const data = await ofetch<GitHubRepo>(`https://api.github.com/repos/${repo}`, {
37+
headers: {
38+
Authorization: `token ${token}`,
39+
},
40+
});
41+
return data.owner.avatar_url;
42+
}
43+
44+
async function buildUsedByImage(users: string[]) {
45+
const gap = 64;
46+
const width = 3840;
47+
const height = Math.ceil(users.length / 8) * (width / 8);
48+
const getItemX = (index: number) => index % 8 * (width / 8) + gap / 2;
49+
const getItemY = (index: number) => Math.floor(index / 8) * (width / 8) + gap / 2;
50+
const canvas = createCanvas(width, height);
51+
const ctx = canvas.getContext("2d", { alpha: true, colorSpace: "srgb" });
52+
ctx.fillStyle = "#FFFFFF00";
53+
ctx.fillRect(0, 0, width, height);
54+
for (const [index, avatar] of users.entries()) {
55+
const x = getItemX(index);
56+
const y = getItemY(index);
57+
const image = await loadImage(avatar);
58+
ctx.save();
59+
ctx.beginPath();
60+
ctx.arc(x + (width / 8 - gap) / 2, y + (width / 8 - gap) / 2, (width / 8 - gap) / 2, 0, Math.PI * 2);
61+
ctx.closePath();
62+
ctx.clip();
63+
ctx.fillStyle = "#ffffff";
64+
ctx.fillRect(x, y, width / 8 - gap, width / 8 - gap);
65+
ctx.drawImage(image, x, y, width / 8 - gap, width / 8 - gap);
66+
ctx.strokeStyle = "#d1d9e080";
67+
ctx.lineWidth = 4;
68+
ctx.stroke();
69+
ctx.restore();
70+
}
71+
const displayWidth = width / 2;
72+
const displayHeight = height / 2;
73+
const displayCanvas = createCanvas(displayWidth, displayHeight);
74+
const displayCtx = displayCanvas.getContext("2d", { alpha: true, colorSpace: "srgb" });
75+
displayCtx.drawImage(canvas, 0, 0, displayWidth, displayHeight);
76+
return displayCanvas.encode("png");
77+
}
78+
79+
const token = process.env["GITHUB_TOKEN"];
80+
const avatars = await Promise.all(projects.map(async (repo) => fetchGitHubAvatar(repo, token)));
81+
const avatarsDeDup = Array.from(new Set(avatars));
82+
const img = await buildUsedByImage(avatarsDeDup);
83+
await fs.writeFile("website/assets/used_by.png", img);
84+
await fs.writeFile("website/public/used_by.png", img);

website/assets/used_by.png

-73.6 KB
Loading

website/pages/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ A set of composable ESLint rules for libraries and frameworks that use React as
3434
### Also available in
3535

3636
- [`antfu/eslint-config`](https://github.com/antfu/eslint-config) - Anthony's ESLint config preset.
37+
- [`eslint-config-rebeccastevens`](https://github.com/RebeccaStevens/eslint-config-rebeccastevens) - Rebecca's ESLint config preset.
3738
- [`eslint-config-sheriff`](https://github.com/AndreaPontrandolfo/sheriff) - A comprehensive and opinionated Typescript-first ESLint configuration.
3839
- [`eslint-config-sukka`](https://github.com/SukkaW/eslint-config-sukka) - Sukka's ESLint config preset.
3940

website/public/used_by.png

-73.6 KB
Loading

0 commit comments

Comments
 (0)