Implements linting, formatting, test config

This commit is contained in:
Alicia Sykes 2026-02-26 13:00:09 +00:00
parent 4f8ab87ea7
commit 8df08fcddf
15 changed files with 1527 additions and 71 deletions

14
web/.editorconfig Normal file
View file

@ -0,0 +1,14 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
[*.astro]
indent_style = tab
[*.{ts,js,svelte,scss,json}]
indent_style = space
indent_size = 2

2
web/.gitignore vendored
View file

@ -19,3 +19,5 @@ dist/
# macOS crap
.DS_Store
.vscode/

1
web/.nvmrc Normal file
View file

@ -0,0 +1 @@
24.11.0

17
web/.prettierignore Normal file
View file

@ -0,0 +1,17 @@
dist/
.astro/
node_modules/
.vercel/
yarn.lock
public/
*.md
# Astro files with adjacent JSX elements that prettier-plugin-astro cannot parse
src/components/things/DockerDetailedInfo.astro
src/components/things/GitHubDetailedInfo.astro
src/components/things/IosAppDetailedInfo.astro
src/components/things/ItemGitHubMetrics.astro
src/components/things/PrivacyPolicyDetails.astro
src/components/things/WebsiteDetailedInfo.astro
src/pages/*section*.astro
src/pages/all.astro

22
web/.prettierrc Normal file
View file

@ -0,0 +1,22 @@
{
"useTabs": true,
"singleQuote": true,
"semi": true,
"trailingComma": "all",
"plugins": ["prettier-plugin-astro", "prettier-plugin-svelte"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
},
{
"files": ["*.ts", "*.js", "*.svelte", "*.scss"],
"options": {
"useTabs": false,
"tabWidth": 2
}
}
]
}

View file

@ -1,4 +0,0 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

View file

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

View file

@ -1,9 +1,9 @@
npmScopes:
fortawesome:
npmAlwaysAuth: true
npmRegistryServer: "https://npm.fontawesome.com/"
npmRegistryServer: 'https://npm.fontawesome.com/'
npmAuthToken: ECB95473-FBAF-463F-905C-C9ED4C00D519
awesome:
npmAlwaysAuth: true
npmRegistryServer: "https://npm.fontawesome.com/"
npmRegistryServer: 'https://npm.fontawesome.com/'
npmAuthToken: ECB95473-FBAF-463F-905C-C9ED4C00D519

View file

@ -25,12 +25,12 @@ const integrations = [svelte(), partytown(), sitemap()];
// Set the appropriate adapter, based on the deploy target
const adapter = {
vercel: vercelAdapter,
netlify: netlifyAdapter,
cloudflare: cloudflareAdapter,
node: nodeAdapter({
mode: 'standalone',
}),
vercel: vercelAdapter,
netlify: netlifyAdapter,
cloudflare: cloudflareAdapter,
node: nodeAdapter({
mode: 'standalone',
}),
}[deployTarget]();
// Export Astro configuration

80
web/eslint.config.js Normal file
View file

@ -0,0 +1,80 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginAstro from 'eslint-plugin-astro';
import eslintPluginSvelte from 'eslint-plugin-svelte';
import svelteParser from 'svelte-eslint-parser';
import eslintConfigPrettier from 'eslint-config-prettier';
import globals from 'globals';
export default [
// Global ignores
{ ignores: ['dist/', '.astro/', 'node_modules/', '.vercel/'] },
// Base JS config
js.configs.recommended,
// TypeScript
...tseslint.configs.recommended,
// Astro
...eslintPluginAstro.configs.recommended,
// Svelte — with TypeScript parser for <script lang="ts">
...eslintPluginSvelte.configs['flat/recommended'].map((config) =>
config.files
? {
...config,
languageOptions: {
...config.languageOptions,
parser: svelteParser,
parserOptions: {
...config.languageOptions?.parserOptions,
parser: tseslint.parser,
},
},
}
: config,
),
// Global settings
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-unused-expressions': 'off',
'no-console': 'off',
'no-case-declarations': 'off',
'no-useless-assignment': 'warn',
},
},
// Allow triple-slash references in env.d.ts (Astro convention)
{
files: ['src/env.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
// Lenient Svelte rules — existing code uses these patterns intentionally
{
files: ['**/*.svelte'],
rules: {
'svelte/no-at-html-tags': 'warn',
'svelte/require-each-key': 'warn',
'svelte/no-dom-manipulating': 'warn',
},
},
// Prettier must be last to override conflicting rules
eslintConfigPrettier,
];

View file

@ -1,37 +1,57 @@
{
"name": "web",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro preview",
"build": "astro check && astro build",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.5.4",
"@astrojs/netlify": "^5.1.2",
"@astrojs/partytown": "^2.0.4",
"@astrojs/sitemap": "^3.1.0",
"@astrojs/svelte": "^5.0.3",
"@astrojs/vercel": "^7.3.2",
"@fortawesome/fontawesome-pro": "^6.5.1",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/pro-solid-svg-icons": "^6.5.1",
"@fortawesome/svelte-fontawesome": "^0.2.2",
"astro": "^4.3.6",
"fuse.js": "^7.0.0",
"js-yaml": "^4.1.0",
"marked": "^12.0.0",
"svelte": "^4.2.11",
"typescript": "^5.3.3"
},
"devDependencies": {
"@astrojs/cloudflare": "^9.0.1",
"@astrojs/node": "^8.2.1",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.11.19",
"sass": "^1.70.0"
}
"name": "web",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro preview",
"build": "astro check && astro build",
"astro": "astro",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check .",
"typecheck": "astro check",
"test": "vitest run",
"test:watch": "vitest",
"check:all": "astro check && eslint . && prettier --check . && vitest run"
},
"dependencies": {
"@astrojs/check": "^0.5.4",
"@astrojs/netlify": "^5.1.2",
"@astrojs/partytown": "^2.0.4",
"@astrojs/sitemap": "^3.1.0",
"@astrojs/svelte": "^5.0.3",
"@astrojs/vercel": "^7.3.2",
"@fortawesome/fontawesome-pro": "^6.5.1",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/pro-solid-svg-icons": "^6.5.1",
"@fortawesome/svelte-fontawesome": "^0.2.2",
"astro": "^4.3.6",
"fuse.js": "^7.0.0",
"js-yaml": "^4.1.0",
"marked": "^12.0.0",
"svelte": "^4.2.11",
"typescript": "^5.3.3"
},
"devDependencies": {
"@astrojs/cloudflare": "^9.0.1",
"@astrojs/node": "^8.2.1",
"@eslint/js": "^10.0.1",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.11.19",
"eslint": "^10.0.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-astro": "^1.6.0",
"eslint-plugin-svelte": "^3.15.0",
"globals": "^17.3.0",
"prettier": "^3.8.1",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-svelte": "^3.5.0",
"sass": "^1.70.0",
"svelte-eslint-parser": "^1.5.1",
"typescript-eslint": "^8.56.1",
"vitest": "^4.0.18"
}
}

View file

@ -1,5 +1,5 @@
import { vitePreprocess } from '@astrojs/svelte';
export default {
preprocess: vitePreprocess(),
preprocess: vitePreprocess(),
};

View file

@ -1,11 +1,11 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
"@layouts/*": ["src/layouts/*"],
"@utils/*": ["src/utils/*"]
}
}
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
"@layouts/*": ["src/layouts/*"],
"@utils/*": ["src/utils/*"]
}
}
}

16
web/vitest.config.ts Normal file
View file

@ -0,0 +1,16 @@
import { defineConfig } from 'vitest/config';
import { resolve } from 'path';
export default defineConfig({
test: {
environment: 'node',
include: ['src/**/*.test.ts'],
},
resolve: {
alias: {
'@components': resolve(__dirname, 'src/components'),
'@layouts': resolve(__dirname, 'src/layouts'),
'@utils': resolve(__dirname, 'src/utils'),
},
},
});

File diff suppressed because it is too large Load diff