Skip to content

Commit e4ad172

Browse files
Add formatter, linters, typecheck and enforce it all via CI (#33)
* Add formatters * run formatter * lint * Types * Added wide typecheck * add CI check * oopsie * we can do it
1 parent 8904003 commit e4ad172

102 files changed

Lines changed: 1992 additions & 848 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
check:
15+
name: Lint, format, typecheck, build
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version: 24
25+
cache: npm
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Format check
31+
run: npm run format:check
32+
33+
- name: Lint
34+
run: npm run lint:ci
35+
36+
- name: Workspace consistency
37+
run: npm run sherif
38+
39+
- name: Typecheck
40+
run: npm run typecheck
41+
42+
- name: Build
43+
run: npm run build

astro-alt-text-toolkit/__example__/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "example",
3-
"type": "module",
43
"version": "0.0.1",
54
"private": "true",
5+
"type": "module",
66
"scripts": {
77
"dev": "astro dev",
88
"build": "astro build",

astro-alt-text-toolkit/__example__/src/components/ImageWithAlt.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const getPathToAltTextMap = (
3333
},
3434
altTextModules: {
3535
[originalPath: string]: string;
36-
}
36+
},
3737
) => {
3838
const pathToAltTextMap = new Map<string, string>();
3939
for (const [originalPath, module] of Object.entries(imageModules)) {
@@ -58,7 +58,7 @@ const getFinalSrc = async (image: typeof Astro.props.src) => {
5858
5959
const finalPathToAltTextMap = getPathToAltTextMap(
6060
imageModules as any,
61-
altTextModules as any
61+
altTextModules as any,
6262
);
6363
6464
const alt =

astro-alt-text-toolkit/package.json

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
{
22
"name": "@fujocoded/astro-alt-text-toolkit",
33
"version": "0.0.1",
4+
"private": true,
45
"description": "",
5-
"main": "dist/index.js",
6+
"keywords": [
7+
"astro",
8+
"astro-integration",
9+
"withastro"
10+
],
11+
"homepage": "https://github.com/FujoWebDev/fujocoded-plugins#readme",
12+
"bugs": {
13+
"url": "https://github.com/FujoWebDev/fujocoded-plugins/issues"
14+
},
15+
"license": "MIT",
16+
"author": "FujoCoded LLC",
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
20+
},
21+
"files": [
22+
"dist",
23+
"LICENSE",
24+
"README.md",
25+
"package.json"
26+
],
627
"type": "module",
7-
"private": true,
28+
"main": "dist/index.js",
829
"exports": {
930
".": {
1031
"import": {
@@ -13,33 +34,13 @@
1334
}
1435
}
1536
},
16-
"files": [
17-
"dist",
18-
"LICENSE",
19-
"README.md",
20-
"package.json"
21-
],
2237
"scripts": {
2338
"build": "tsdown",
2439
"dev": "tsdown --watch",
2540
"validate": "npx publint",
26-
"test": "vitest"
41+
"test": "vitest",
42+
"typecheck": "tsc --noEmit"
2743
},
28-
"repository": {
29-
"type": "git",
30-
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
31-
},
32-
"keywords": [
33-
"astro",
34-
"withastro",
35-
"astro-integration"
36-
],
37-
"author": "FujoCoded LLC",
38-
"license": "MIT",
39-
"bugs": {
40-
"url": "https://github.com/FujoWebDev/fujocoded-plugins/issues"
41-
},
42-
"homepage": "https://github.com/FujoWebDev/fujocoded-plugins#readme",
4344
"dependencies": {},
4445
"devDependencies": {
4546
"tsdown": "^0.14.1"

astro-alt-text-toolkit/src/_image-service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ const imageService: LocalImageService<AstroConfig["image"]> = {
3434
};
3535

3636
Object.entries(params).forEach(([param, key]) => {
37-
options[key] && searchParams.append(param, options[key].toString());
37+
if (options[key]) {
38+
searchParams.append(param, options[key].toString());
39+
}
3840
});
3941

4042
const imageEndpoint = path.join(
4143
import.meta.env.BASE_URL,
42-
imageConfig.endpoint.route
44+
imageConfig.endpoint.route,
4345
);
4446
return `${imageEndpoint}?${searchParams}`;
4547
},

astro-alt-text-toolkit/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ const showAltTextPopup = (image: HTMLElement) => {
3232
dialog.open = false;
3333
}
3434
},
35-
{ signal }
35+
{ signal },
3636
);
3737
dialog.addEventListener(
3838
"close",
3939
() => {
4040
dialog.remove();
4141
controller.abort();
4242
},
43-
{ signal }
43+
{ signal },
4444
);
4545
};
4646

4747
const images = Array.from(
48-
document.querySelectorAll<HTMLImageElement>(`img[alt]:not(img[alt=""])`)
48+
document.querySelectorAll<HTMLImageElement>(`img[alt]:not(img[alt=""])`),
4949
);
5050
for (const image of images) {
5151
addBadgeToImage(image);

astro-alt-text-toolkit/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"declaration": true,
2121
"allowImportingTsExtensions": true,
2222
"noEmit": true,
23-
"types": ["./src/types.d.ts"]
23+
"types": ["vite/client"]
2424
},
25-
"include": ["./src/types.d.ts"],
25+
"include": ["./src/**/*"],
2626
"exclude": ["node_modules"]
2727
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
import { defineConfig } from 'astro/config';
2+
import { defineConfig } from "astro/config";
33

44
// https://astro.build/config
55
export default defineConfig({});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "astro-5",
3-
"type": "module",
43
"version": "0.0.1",
4+
"type": "module",
55
"scripts": {
66
"dev": "astro dev",
77
"build": "astro build",
88
"preview": "astro preview",
99
"astro": "astro"
1010
},
1111
"dependencies": {
12-
"astro": "^5.16.9",
13-
"@fujocoded/astro-ao3-loader": "file:../.."
12+
"@fujocoded/astro-ao3-loader": "file:../..",
13+
"astro": "^5.16.9"
1414
}
15-
}
15+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- 1728802
1+
- 1728802

0 commit comments

Comments
 (0)