Skip to content

Commit a79a107

Browse files
committed
Setup prettier and eslint, format files
1 parent b6f415e commit a79a107

Some content is hidden

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

58 files changed

+1409
-1920
lines changed

.eslintcache

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

.prettierignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Dependencies
2+
node_modules/
3+
bun.lock
4+
5+
# Build outputs
6+
dist/
7+
.astro/
8+
.wrangler/
9+
10+
# Cache
11+
.cache/
12+
13+
# Logs
14+
*.log
15+
16+
# Environment files
17+
.env
18+
.env.*
19+
20+
# OS files
21+
.DS_Store
22+
Thumbs.db
23+
24+
# IDE files
25+
.vscode/
26+
.idea/
27+
28+
# Lock files
29+
package-lock.json
30+
yarn.lock
31+
pnpm-lock.yaml

.prettierrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"trailingComma": "es5",
7+
"printWidth": 140,
8+
"arrowParens": "always",
9+
"endOfLine": "lf",
10+
"plugins": ["prettier-plugin-astro", "prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
11+
"overrides": [
12+
{
13+
"files": "*.astro",
14+
"options": {
15+
"parser": "astro"
16+
}
17+
},
18+
{
19+
"files": "*.svelte",
20+
"options": {
21+
"parser": "svelte"
22+
}
23+
}
24+
]
25+
}

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ How to get the project running on your local machine for development.
1616

1717
1. Clone the repository. If you plan to make changes, create a fork first!
1818

19-
```bash
20-
git clone --branch feat/astro https://github.com/PaperMC/website.git
21-
cd website
22-
```
19+
```bash
20+
git clone --branch feat/astro https://github.com/PaperMC/website.git
21+
cd website
22+
```
2323

2424
2. Install all required dependencies.
2525

26-
```bash
27-
bun install
28-
```
26+
```bash
27+
bun install
28+
```
2929

3030
3. Start the development server.
3131

32-
```bash
33-
bun run dev
34-
```
32+
```bash
33+
bun run dev
34+
```
3535

36-
The site will be available at:
37-
👉 http://localhost:4321
36+
The site will be available at:
37+
👉 http://localhost:4321
3838

3939
### Building
4040

@@ -115,4 +115,4 @@ The supporting code is
115115
[MIT](https://github.com/PaperMC/website/blob/main/LICENSE) licensed.
116116

117117
The PaperMC logomark is subject to its [own terms](https://docs.papermc.io/misc/assets) and does not
118-
inherit a license from any of the projects it represents.
118+
inherit a license from any of the projects it represents.

astro.config.mjs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
11
// @ts-check
2-
import { defineConfig } from "astro/config";
2+
import { defineConfig } from 'astro/config';
33

4-
import tailwindcss from "@tailwindcss/vite";
5-
import { execSync } from "child_process";
4+
import tailwindcss from '@tailwindcss/vite';
5+
import { execSync } from 'child_process';
66

7-
import svelte from "@astrojs/svelte";
7+
import svelte from '@astrojs/svelte';
88

9-
import icon from "astro-icon";
9+
import icon from 'astro-icon';
1010

11-
import sitemap from "@astrojs/sitemap";
11+
import sitemap from '@astrojs/sitemap';
1212

13-
import cloudflare from "@astrojs/cloudflare";
13+
import cloudflare from '@astrojs/cloudflare';
1414

15-
process.env.GIT_COMMIT_HASH =
16-
(process.env.GITHUB_SHA || "").trim().substring(0, 7) || fetchGitCommitHash();
15+
process.env.GIT_COMMIT_HASH = (process.env.GITHUB_SHA || '').trim().substring(0, 7) || fetchGitCommitHash();
1716

1817
function fetchGitCommitHash() {
19-
return execSync("git rev-parse --short HEAD").toString().trim();
18+
return execSync('git rev-parse --short HEAD').toString().trim();
2019
}
2120

2221
export default defineConfig({
23-
site: "https://papermc.io",
22+
site: 'https://papermc.io',
2423

2524
vite: {
2625
plugins: [tailwindcss()],
2726
},
2827

2928
image: {
3029
responsiveStyles: true,
31-
layout: "full-width",
30+
layout: 'full-width',
3231
remotePatterns: [
3332
{
34-
protocol: "https",
35-
hostname: "**.githubusercontent.com",
33+
protocol: 'https',
34+
hostname: '**.githubusercontent.com',
3635
},
3736
{
38-
protocol: "https",
39-
hostname: "**.opencollective.com",
37+
protocol: 'https',
38+
hostname: '**.opencollective.com',
4039
},
4140
],
4241
},
4342

4443
integrations: [
4544
svelte(),
4645
icon({
47-
iconDir: "src/assets",
46+
iconDir: 'src/assets',
4847
}),
4948
sitemap(),
5049
],

bun.lock

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

eslint.config.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import eslintPluginAstro from 'eslint-plugin-astro';
2+
import eslintPluginSvelte from 'eslint-plugin-svelte';
3+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
4+
import typescriptParser from '@typescript-eslint/parser';
5+
import svelteParser from 'svelte-eslint-parser';
6+
import eslintConfigPrettier from 'eslint-config-prettier';
7+
8+
export default [
9+
// Ignore patterns
10+
{
11+
ignores: ['dist/**', 'node_modules/**', '.astro/**', '.wrangler/**', 'bun.lock', '*.config.js', '*.config.mjs', '*.config.ts'],
12+
},
13+
14+
// Base TypeScript configuration
15+
{
16+
files: ['**/*.ts', '**/*.tsx'],
17+
languageOptions: {
18+
parser: typescriptParser,
19+
parserOptions: {
20+
ecmaVersion: 'latest',
21+
sourceType: 'module',
22+
project: './tsconfig.json',
23+
},
24+
},
25+
plugins: {
26+
'@typescript-eslint': typescriptEslint,
27+
},
28+
rules: {
29+
'@typescript-eslint/no-unused-vars': [
30+
'warn',
31+
{
32+
argsIgnorePattern: '^_',
33+
varsIgnorePattern: '^_',
34+
},
35+
],
36+
'@typescript-eslint/no-explicit-any': 'warn',
37+
'@typescript-eslint/explicit-module-boundary-types': 'off',
38+
'@typescript-eslint/no-non-null-assertion': 'warn',
39+
},
40+
},
41+
42+
// Astro configuration
43+
...eslintPluginAstro.configs.recommended,
44+
{
45+
files: ['**/*.astro'],
46+
rules: {
47+
// Astro-specific rules
48+
'astro/no-set-html-directive': 'error',
49+
'astro/no-unused-css-selector': 'warn',
50+
},
51+
},
52+
53+
// Svelte configuration
54+
...eslintPluginSvelte.configs['flat/recommended'],
55+
{
56+
files: ['**/*.svelte'],
57+
languageOptions: {
58+
parser: svelteParser,
59+
parserOptions: {
60+
parser: typescriptParser,
61+
extraFileExtensions: ['.svelte'],
62+
},
63+
},
64+
rules: {
65+
// Svelte-specific rules
66+
'svelte/no-at-html-tags': 'warn',
67+
'svelte/no-unused-svelte-ignore': 'warn',
68+
'svelte/valid-compile': 'error',
69+
},
70+
},
71+
72+
// Prettier compatibility (must be last)
73+
eslintConfigPrettier,
74+
];

package.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
"dev": "astro dev",
77
"build": "astro build",
88
"preview": "astro preview",
9-
"astro": "astro"
9+
"astro": "astro",
10+
"lint": "eslint . --cache",
11+
"lint:fix": "eslint . --fix --cache",
12+
"format": "prettier --write .",
13+
"format:check": "prettier --check .",
14+
"check": "bun run format:check && bun run lint"
1015
},
1116
"dependencies": {
1217
"@astrojs/cloudflare": "^12.6.10",
@@ -23,6 +28,17 @@
2328
},
2429
"devDependencies": {
2530
"@types/node": "^24.8.1",
31+
"@typescript-eslint/eslint-plugin": "^8.46.1",
32+
"@typescript-eslint/parser": "^8.46.1",
33+
"eslint": "^9.37.0",
34+
"eslint-config-prettier": "^10.1.8",
35+
"eslint-plugin-astro": "^1.3.1",
36+
"eslint-plugin-svelte": "^3.12.4",
37+
"prettier": "^3.6.2",
38+
"prettier-plugin-astro": "^0.14.1",
39+
"prettier-plugin-svelte": "^3.4.0",
40+
"prettier-plugin-tailwindcss": "^0.7.1",
41+
"svelte-eslint-parser": "^1.3.3",
2642
"wrangler": "^4.43.0"
2743
}
28-
}
44+
}

renovate.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:recommended"
5-
],
3+
"extends": ["config:recommended"],
64
"packageRules": [
75
{
8-
"matchUpdateTypes": [
9-
"minor",
10-
"patch"
11-
],
6+
"matchUpdateTypes": ["minor", "patch"],
127
"groupName": "all non-major dependencies",
138
"groupSlug": "all-minor-patch",
14-
"matchPackageNames": [
15-
"*"
16-
]
9+
"matchPackageNames": ["*"]
1710
}
1811
]
19-
}
12+
}

src/components/IconButton.astro

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { Icon } from "astro-icon/components";
2+
import { Icon } from 'astro-icon/components';
33
44
export interface Props {
55
icon: string;
@@ -17,17 +17,14 @@ const { icon, label, href } = Astro.props;
1717
href={href}
1818
rel="noreferrer"
1919
target="_blank"
20-
class="inline-block h-min w-min rounded-full p-2 transition-colors hover:bg-gray-800/20 dark:hover:bg-gray-400/20 leading-0"
20+
class="inline-block h-min w-min rounded-full p-2 leading-0 transition-colors hover:bg-gray-800/20 dark:hover:bg-gray-400/20"
2121
aria-label={label}
2222
>
2323
<Icon name={icon} class="size-6 text-gray-700 dark:text-gray-300" />
2424
</a>
2525
) : (
26-
<button
27-
class="h-min w-min rounded-full p-2 transition-colors hover:bg-gray-800/20"
28-
aria-label={label}
29-
>
30-
<img src={icon} class="h-6 w-6 gray-700" alt="" />
26+
<button class="h-min w-min rounded-full p-2 transition-colors hover:bg-gray-800/20" aria-label={label}>
27+
<img src={icon} class="gray-700 h-6 w-6" alt="" />
3128
</button>
3229
)
3330
}

0 commit comments

Comments
 (0)