Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Install Node.js
uses: actions/setup-node@v6.4.0
with:
node-version: 22.20.0
- name: Install Dependencies
run: npm install --no-fund
- parallel:
- name: Typecheck
run: npm run test:types
- name: Lint
run: npm run lint
- name: Unit Test
run: npm run test:unit
- name: Build
run: npm run build
68 changes: 68 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { defineConfig } from 'eslint/config';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied from three-js

import globals from 'globals';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';

export default defineConfig([
tseslint.configs.recommended,
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['src/server/**/*.{ts,tsx,mjs,cjs,js}'],
languageOptions: {
ecmaVersion: 2023,
globals: globals.node,
parserOptions: {
project: ['./tools/tsconfig.server.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['src/shared/**/*.{ts,tsx,mjs,cjs,js}'],
languageOptions: {
ecmaVersion: 2023,
globals: globals.browser,
parserOptions: {
project: ['./tools/tsconfig.shared.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['src/client/**/*.{ts,tsx}'],
ignores: ['src/server/**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2023,
globals: globals.browser,
parserOptions: {
project: ['./tools/tsconfig.client.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unused-vars': ['off'],
'no-unused-vars': ['off'],
},
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'eslint.config.js',
'**/vite.config.ts',
'devvit.config.ts',
],
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
},
},
plugins: { js },
extends: ['js/recommended'],
},
]);
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"type": "module",
"scripts": {
"build": "vite build",
"deploy": "npm run type-check && npm run lint && devvit upload",
"deploy": "npm run test:types && npm run lint && devvit upload",
"dev": "devvit playtest",
"launch": "npm run deploy && devvit publish",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"login": "devvit login",
"prettier": "prettier --write .",
"type-check": "tsc --build"
"test:types": "tsc --build",
"test:unit": "node --experimental-strip-types --no-warnings=ExperimentalWarning --test \"src/**/*.test.ts\""
},
"engines": {
"node": ">=22.12.0"
Expand All @@ -30,7 +31,7 @@
"eslint": "10.8.0",
"globals": "17.8.0",
"prettier": "3.9.6",
"typescript": "7.0.2",
"typescript": "6.0.3",
"typescript-eslint": "8.65.0",
"vite": "8.1.5"
}
Expand Down