Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further dev setup #1

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/astro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Astro check

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
lint-and-prettier:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run astro check
run: pnpm run astrocheck
52 changes: 52 additions & 0 deletions .github/workflows/prettier-eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Prettier Eslint

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
lint-and-prettier:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm run lint

- name: Prettier write
run: pnpm run prettier --write .
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style fixes by prettier'
commit_options: '--no-verify'

- name: Lint fix
run: pnpm run lint --quiet --fix
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style fixes by eslint'
commit_options: '--no-verify'
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.18.0
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public/

node_modules/

*.lock
pnpm-lock.yaml

*.md

assets/**
18 changes: 18 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {
plugins: ['prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
printWidth: 100,
tabWidth: 2,
singleQuote: true,
bracketSameLine: true,
trailingComma: 'es5',
arrowParens: 'avoid',
endOfLine: 'auto',
};
45 changes: 24 additions & 21 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';

import tailwind from '@astrojs/tailwind';

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: 'My Docs',
social: {
github: 'https://github.com/withastro/starlight',
},
sidebar: [
{
label: 'Guides',
items: [
// Each item here is one entry in the navigation menu.
{ label: 'Example Guide', slug: 'guides/example' },
],
},
{
label: 'Reference',
autogenerate: { directory: 'reference' },
},
],
}),
],
integrations: [
starlight({
title: 'My Docs',
social: {
github: 'https://github.com/withastro/starlight',
},
sidebar: [
{
label: 'Guides',
items: [
// Each item here is one entry in the navigation menu.
{ label: 'Example Guide', slug: 'guides/example' },
],
},
{
label: 'Reference',
autogenerate: { directory: 'reference' },
},
],
}),
tailwind(),
],
});
52 changes: 52 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginAstro from 'eslint-plugin-astro';
import eslintPluginTailwind from 'eslint-plugin-tailwindcss';
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintConfigPrettier from 'eslint-config-prettier';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,ts}'] },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginPrettierRecommended,
...eslintPluginTailwind.configs['flat/recommended'],
...eslintPluginAstro.configs.recommended,
eslintConfigPrettier,
{
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['ts', 'tsx'],
},
},
rules: {
'prettier/prettier': ['error'],
'@typescript-eslint/no-explicit-any': [0, {}],
'no-constant-condition': [1],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
vars: 'local',
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
},
},
{
ignores: ['**/*.d.ts'],
},
];
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,37 @@
"type": "module",
"version": "0.0.1",
"scripts": {
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"prettier": "prettier . --write",
"astrocheck": "astro check --minimumFailingSeverity warning"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/starlight": "^0.28.4",
"@astrojs/tailwind": "^5.1.2",
"astro": "^4.15.3",
"sharp": "^0.32.5",
"@astrojs/check": "^0.9.4",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@types/react": "^18.3.12",
"@typescript-eslint/parser": "^8.12.2",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^1.3.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tailwindcss": "^3.17.5",
"globals": "^15.11.0",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"typescript-eslint": "^8.12.2"
}
}
Loading
Loading