Skip to content

Commit 4fb4607

Browse files
Add ESLint
1 parent a2dc0ee commit 4fb4607

File tree

7 files changed

+799
-41
lines changed

7 files changed

+799
-41
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint & Tests
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 22
16+
- name: Install dependencies
17+
run: npm install -g pnpm && pnpm install
18+
- name: Run linting
19+
run: pnpm lint
20+
- name: Run unit tests
21+
run: pnpm test:unit run
22+
- name: Install Playwright Browsers
23+
run: pnpm exec playwright install --with-deps
24+
- name: Run Playwright tests
25+
run: pnpm exec playwright test
26+
- uses: actions/upload-artifact@v4
27+
if: always()
28+
with:
29+
name: playwright-report
30+
path: playwright-report/
31+
retention-days: 30

.github/workflows/playwright.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ dist/
88
# dependencies
99
node_modules/
1010

11+
# eslint
12+
.eslintcache
13+
1114
# logs
1215
npm-debug.log*
1316
yarn-debug.log*

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import js from '@eslint/js';
2+
import eslintPluginAstro from 'eslint-plugin-astro';
3+
import globals from 'globals';
4+
5+
export default [
6+
js.configs.recommended,
7+
...eslintPluginAstro.configs.recommended,
8+
{
9+
ignores: ['.astro/**', '.vercel/**', 'dist/**', 'node_modules/**']
10+
},
11+
{
12+
languageOptions: {
13+
globals: {
14+
...globals.browser
15+
}
16+
},
17+
rules: {
18+
// override/add rules settings here, such as:
19+
// "astro/no-set-html-directive": "error"
20+
}
21+
}
22+
];

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
},
99
"license": "MIT",
1010
"scripts": {
11-
"dev": "astro dev",
12-
"start": "astro dev",
13-
"build": "astro check && astro build --remote",
14-
"preview": "astro preview",
1511
"astro": "astro",
12+
"build": "astro check && astro build --remote",
1613
"db:seed": "pnpm astro db execute db/seed.ts --remote",
17-
"test": "vitest",
18-
"test:run": "vitest run",
19-
"test:e2e": "pnpm exec playwright test"
14+
"dev": "astro dev",
15+
"lint": "eslint . --cache",
16+
"lint:fix": "eslint . --fix",
17+
"preview": "astro preview",
18+
"start": "astro dev",
19+
"test": "concurrently \"pnpm:test:*(!fix)\" --names \"test:\"",
20+
"test:e2e": "pnpm exec playwright test",
21+
"test:unit": "vitest"
2022
},
2123
"dependencies": {
2224
"@astrojs/check": "^0.9.4",
@@ -36,6 +38,7 @@
3638
"valibot": "^0.31.1"
3739
},
3840
"devDependencies": {
41+
"@eslint/js": "^9.37.0",
3942
"@playwright/test": "^1.56.1",
4043
"@tailwindcss/forms": "^0.5.10",
4144
"@tailwindcss/typography": "^0.5.19",
@@ -44,6 +47,11 @@
4447
"@testing-library/preact": "^3.2.4",
4548
"@types/html-to-text": "^9.0.4",
4649
"@types/node": "^22.18.11",
50+
"@typescript-eslint/parser": "^8.46.2",
51+
"concurrently": "^9.2.1",
52+
"eslint": "^9.38.0",
53+
"eslint-plugin-astro": "^1.3.1",
54+
"globals": "^16.4.0",
4755
"html-to-text": "^9.0.5",
4856
"jsdom": "^27.0.1",
4957
"prettier": "^3.6.2",

0 commit comments

Comments
 (0)