Skip to content

Commit e168747

Browse files
authored
August 2025 maintenance (#35)
* Add `packageManager` field * Fix formatting on Windows * Fix format script * Update Prettier to latest * Add TS check pragma * Migrate to ESM * Update koa to v3 * Deduplicate dependencies * Migrate ESLint config to ESM * Fix ESLint issues * Upgrade ESLint to v8 * Deduplicate dependencies * Add lint script * Add .node-version file * Add CI workflow on GitHub Actions
1 parent e6ce023 commit e168747

File tree

7 files changed

+466
-497
lines changed

7 files changed

+466
-497
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
// @ts-check
2+
/** @type{import('eslint').Linter.LegacyConfig} */
13
module.exports = {
24
root: true,
35
extends: ['eslint:recommended'],
46
rules: {
57
eqeqeq: ['error', 'always']
68
},
7-
parserOptions: { ecmaVersion: 11 },
9+
parserOptions: { ecmaVersion: 11, sourceType: 'module' },
810
env: { es6: true, node: true }
911
};

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run CI
2+
on:
3+
push:
4+
branches:
5+
- ng
6+
pull_request:
7+
branches:
8+
- ng
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
cache: yarn
21+
- name: Install dependencies
22+
run: yarn install --frozen-lockfile
23+
- name: Run lint
24+
run: yarn lint

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.14.0

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"singleQuote": true,
44
"printWidth": 100,
55
"arrowParens": "always",
6-
"trailingComma": "none"
6+
"trailingComma": "none",
7+
"endOfLine": "auto"
78
}

index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const Koa = require('koa');
2-
const bodyParser = require('koa-bodyparser');
3-
const cors = require('@koa/cors');
4-
const websocket = require('koa-easy-ws');
5-
const WebSocketJSONStream = require('@teamwork/websocket-json-stream');
6-
const ShareDB = require('sharedb');
7-
const uuid = require('uuid').v4;
1+
// @ts-check
2+
import cors from '@koa/cors';
3+
import WebSocketJSONStream from '@teamwork/websocket-json-stream';
4+
import Koa from 'koa';
5+
import bodyParser from 'koa-bodyparser';
6+
import websocket from 'koa-easy-ws';
7+
import ShareDB from 'sharedb';
8+
import { v4 as uuid } from 'uuid';
89

910
const COLLECTION_NAME = 'sa';
1011

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22
"name": "sharedb-ace-backend",
33
"version": "0.0.1",
44
"description": "ShareDB-powered backend for collaborative editing in the Source Academy.",
5+
"type": "module",
56
"main": "index.js",
67
"repository": "https://github.com/source-academy/sharedb-ace-backend",
78
"license": "Apache-2.0",
89
"private": true,
910
"scripts": {
1011
"eslint": "eslint index.js",
11-
"format": "eslint --fix index.js && prettier index.js",
12+
"format": "eslint --fix index.js && prettier --write index.js",
13+
"lint": "eslint --report-unused-disable-directives --max-warnings 0 index.js && prettier --check index.js",
1214
"start": "node index.js"
1315
},
16+
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610",
1417
"dependencies": {
1518
"@koa/cors": "^5.0.0",
1619
"@teamwork/websocket-json-stream": "^2.0.0",
17-
"koa": "^2.16.1",
20+
"koa": "^3.0.1",
1821
"koa-bodyparser": "^4.4.1",
1922
"koa-easy-ws": "^2.1.0",
2023
"sharedb": "^5.1.1",
2124
"uuid": "^11.1.0",
2225
"ws": "^8.18.0"
2326
},
2427
"devDependencies": {
25-
"eslint": "^7.6.0",
26-
"prettier": "2.1.2"
28+
"eslint": "^8.57.1",
29+
"prettier": "^3.6.2"
2730
}
2831
}

0 commit comments

Comments
 (0)