Skip to content

Commit b64964d

Browse files
committed
Modified typescript codegen to not use namespace and to prefer ES6 modules
1 parent c62e7f6 commit b64964d

File tree

62 files changed

+2928
-2543
lines changed

Some content is hidden

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

62 files changed

+2928
-2543
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import tseslint from 'typescript-eslint';
4+
import { defineConfig } from 'eslint/config';
5+
6+
export default defineConfig([
7+
{ ignores: ['dist'] },
8+
{
9+
files: ['**/*.{ts,tsx}'],
10+
languageOptions: {
11+
parser: tseslint.parser,
12+
ecmaVersion: 'latest',
13+
sourceType: 'module',
14+
globals: { ...globals.browser, ...globals.node },
15+
},
16+
plugins: {
17+
'@typescript-eslint': tseslint.plugin,
18+
},
19+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
20+
rules: {
21+
'@typescript-eslint/no-explicit-any': 'off',
22+
'@typescript-eslint/no-namespace': 'error',
23+
'no-restricted-syntax': [
24+
'error',
25+
{
26+
selector: 'TSEnumDeclaration',
27+
message: 'Do not use enums; stick to JS-compatible types.',
28+
},
29+
{
30+
selector: 'TSEnumDeclaration[const=true]',
31+
message: 'Do not use const enum; use unions or objects.',
32+
},
33+
{ selector: 'Decorator', message: 'Do not use decorators.' },
34+
{
35+
selector: 'TSParameterProperty',
36+
message: 'Do not use parameter properties.',
37+
},
38+
],
39+
},
40+
},
41+
]);

crates/bindings-typescript/package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,26 @@
3737
"build": "tsc",
3838
"compile": "pnpm run build",
3939
"format": "prettier --write .",
40-
"lint": "prettier . --check --verbose",
40+
"lint": "eslint . && prettier . --check",
41+
"test": "vitest run",
42+
"coverage": "vitest run --coverage",
4143
"generate": "cargo run -p spacetimedb-codegen --example regen-typescript-moduledef && prettier --write src/autogen"
4244
},
4345
"dependencies": {
4446
"@zxing/text-encoding": "^0.9.0",
4547
"base64-js": "^1.5.1",
4648
"prettier": "^3.3.3"
49+
},
50+
"devDependencies": {
51+
"@eslint/js": "^9.17.0",
52+
"@typescript-eslint/eslint-plugin": "^8.18.2",
53+
"@typescript-eslint/parser": "^8.18.2",
54+
"eslint": "^9.33.0",
55+
"globals": "^15.14.0",
56+
"ts-node": "^10.9.2",
57+
"typescript": "^5.9.2",
58+
"typescript-eslint": "^8.18.2",
59+
"vite": "^7.1.3",
60+
"vitest": "^3.2.4"
4761
}
4862
}

0 commit comments

Comments
 (0)