Skip to content
Merged
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
136 changes: 136 additions & 0 deletions .github/workflows/autoformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Autoformat & Linting

# Note: For pull requests, GitHub Actions automatically creates a merge commit
# between your branch and the target branch (usually main), then runs checks on
# that merged state. This ensures the code will be properly formatted after merge.
# If this check fails, you may need to merge main into your branch first.

on:
push:
branches: ['main']
paths-ignore:
- 'website/**'
- '**/README.md'
pull_request:
paths-ignore:
- 'website/**'
- '**/README.md'

permissions:
contents: read

jobs:
typescript_formatting:
name: TypeScript formatting and linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'

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

- name: Check Prettier formatting
run: pnpm run format:check
continue-on-error: true
id: prettier_check

- name: Show formatting help message
if: steps.prettier_check.outcome == 'failure'
run: |
echo "::error::Prettier formatting check failed"
echo ""
echo "Note: For pull requests, this check runs on a merge commit between"
echo "your branch and main. If this fails but your branch is formatted correctly,"
echo "you may need to merge or rebase main into your branch first."
echo ""
echo "To fix formatting issues, run: pnpm run format"
exit 1

- name: Check ESLint (all packages)
run: pnpm run stylecheck-all
continue-on-error: true
id: eslint_check

- name: Show ESLint help message
if: steps.eslint_check.outcome == 'failure'
run: |
echo "::error::ESLint check failed"
echo ""
echo "Note: For pull requests, this check runs on a merge commit between"
echo "your branch and main. If this fails but your branch passes linting,"
echo "you may need to merge or rebase main into your branch first."
exit 1

elixir_formatting:
name: Elixir formatting and linting
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/sync-service
env:
MIX_ENV: test
MIX_OS_DEPS_COMPILE_PARTITION_COUNT: 4
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: '.tool-versions'

- name: Restore dependencies cache
uses: actions/cache/restore@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-

- name: Install dependencies
run: mix deps.get

- name: Check Elixir formatting
run: mix format --check-formatted
continue-on-error: true
id: elixir_format_check

- name: Show Elixir formatting help message
if: steps.elixir_format_check.outcome == 'failure'
run: |
echo "::error::Elixir formatting check failed"
echo ""
echo "Note: For pull requests, this check runs on a merge commit between"
echo "your branch and main. If this fails but your branch is formatted correctly,"
echo "you may need to merge or rebase main into your branch first."
echo ""
echo "To fix formatting issues, run: mix format"
exit 1

- name: Check Elixir compiles without warnings
run: mix compile --force --all-warnings --warnings-as-errors
continue-on-error: true
id: elixir_compile_check

- name: Show Elixir compilation help message
if: steps.elixir_compile_check.outcome == 'failure'
run: |
echo "::error::Elixir compilation warnings check failed"
echo ""
echo "Note: For pull requests, this check runs on a merge commit between"
echo "your branch and main. If this fails but your branch compiles cleanly,"
echo "you may need to merge or rebase main into your branch first."
exit 1
35 changes: 0 additions & 35 deletions .github/workflows/elixir_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,38 +136,3 @@ jobs:
# Upload all PR test results to single branch - requires overriding branch and commit
override_branch: ${{ github.event_name == 'pull_request' && 'codecov/pr-test-aggregation' || '' }}
override_commit: ${{ github.event_name == 'pull_request' && env.DUMMY_COMMIT_SHA || '' }}

formatting:
name: Check formatting for sync-service
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/sync-service
env:
MIX_ENV: test
MIX_OS_DEPS_COMPILE_PARTITION_COUNT: 4
steps:
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: '.tool-versions'

- name: Restore dependencies cache
uses: actions/cache/restore@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-

- run: mix deps.get

- name: Check formatting
run: mix format --check-formatted

- name: Compiles without warnings
run: mix compile --force --all-warnings --warnings-as-errors
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
working-directory: packages/sync-service

- name: Compile
run: mix compile --force --all-warnings --warnings-as-errors
run: mix compile
working-directory: packages/sync-service

- name: Setup lux
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ts_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ jobs:
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm run stylecheck
- run: pnpm run typecheck
- run: pnpm run format:check
working-directory: .

build_and_test_packages:
name: Test TS packages against sync-service
Expand Down Expand Up @@ -182,4 +179,3 @@ jobs:
- run: pnpm --if-present run typecheck
- run: pnpm --if-present run build
- run: pnpm --if-present run test
- run: pnpm --if-present run stylecheck
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ website/**/*.md
# Ignore CSS file with unstable Prettier formatting
website/.vitepress/theme/custom.css

# Ignore website partials (documentation code snippets)
website/src/partials/**

# Ignore Elixir projects
packages/sync-service
packages/elixir-client
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default [
`**/.vitepress/dist/**`,
`**/sst-env.d.ts`,
`**/sst.config.ts`,
`website/src/partials/**`,
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/tanstack-db-expo-starter/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ app.get(`/api/todos`, async (req, res) => {
const response = await fetch(electricUrl)

if (!response.ok) {
const errorText = await response.text()
const _errorText = await response.text()
res.writeHead(response.status, { 'Content-Type': `application/json` })
res.end(JSON.stringify({ error: `Electric error: ${response.status}` }))
return
Expand Down
5 changes: 1 addition & 4 deletions examples/tanstack-db-web-starter/src/lib/electric-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ export function prepareElectricUrl(requestUrl: string): URL {
// Add Electric Cloud authentication if configured
if (process.env.ELECTRIC_SOURCE_ID && process.env.ELECTRIC_SOURCE_SECRET) {
originUrl.searchParams.set(`source_id`, process.env.ELECTRIC_SOURCE_ID)
originUrl.searchParams.set(
`secret`,
process.env.ELECTRIC_SOURCE_SECRET
)
originUrl.searchParams.set(`secret`, process.env.ELECTRIC_SOURCE_SECRET)
}

return originUrl
Expand Down
1 change: 0 additions & 1 deletion examples/tanstack-db-web-starter/src/start.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// src/start.tsx
import * as React from "react"
import { createStart } from "@tanstack/react-start"

export const startInstance = createStart(() => {
Expand Down
Loading