@muxion/dev-config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,72 @@
1
+ # Muxion Repository Rules
2
+
3
+ Use ASD-STE100 when you write documentation, comments, errors, commit messages, and review notes.
4
+
5
+ ## Repository structure
6
+
7
+ - Use npm 11 workspaces and commit `package-lock.json`.
8
+ - Put workspace packages in `packages/`. Put runnable examples in `examples/`.
9
+ - Put shared integration tests in `tests/`. Put benchmarks or diagnostics in their named top-level directories.
10
+ - Keep generated files in the output directory that owns them. Do not edit generated files by hand.
11
+ - Use Turborepo for dependency-ordered `build`, `test`, and `lint` tasks.
12
+ - Do not use Yarn files, Yarn commands, or `workspace:*` dependency ranges.
13
+ - Use exact `0.1.0` versions for packages in the same repository. Use `^0.1.0` for packages from another Muxion repository.
14
+ - Keep development dependency versions in the root `package.json`. Child workspaces use `"*"` for those tools.
15
+ - Do not import another package's `src`, `dist`, `generated`, or other private files.
16
+
17
+ ## Shared development configuration
18
+
19
+ - Install `@muxion/dev-config`, TypeScript, Oxlint, and Oxfmt in the repository root.
20
+ - Extend the applicable `@muxion/dev-config/tsconfig/*.json` preset.
21
+ - In a local TypeScript config, set only `rootDir`, `outDir`, and `include`.
22
+ - Keep the root `.oxlintrc.json` limited to its schema and the shared `extends` entry.
23
+ - Keep the root `.oxfmtrc.mjs` limited to the shared configuration re-export.
24
+ - Do not copy or override shared TypeScript, Oxlint, or Oxfmt policy.
25
+ - Keep Rust `cargo fmt` and workspace Clippy settings in each repository that contains Rust.
26
+
27
+ ## Engineering rules
28
+
29
+ - Prioritize correctness, simple code, clear boundaries, and measured performance.
30
+ - Fix root causes. Do not add silent fallbacks or incomplete workarounds.
31
+ - Add an abstraction only for a current need. Remove it when the need no longer exists.
32
+ - Keep one explicit state for each lifecycle. Make cleanup idempotent and observable.
33
+ - Keep resource acquisition and release close together. Use structured cleanup for success and failure.
34
+ - Do not detach a promise without a rejection handler and a comment that explains why.
35
+ - Keep functions and classes at one level of abstraction.
36
+ - Preserve protocol wire formats, public APIs, ABI versions, protocol versions, and compatibility identifiers unless the task explicitly changes them.
37
+
38
+ ## TypeScript and JavaScript
39
+
40
+ - Use two-space indentation, ES modules, explicit type-only exports, and strict checks.
41
+ - Use `camelCase` for values and functions. Use `PascalCase` for types and classes.
42
+ - Use JavaScript `#` private fields and methods. Do not use the TypeScript `private` keyword.
43
+ - Do not use method overloads, `Object.freeze`, `Object.assign`, `Awaited`, or `ReturnType`.
44
+ - Use `bigint` for 64-bit values at TypeScript and native boundaries.
45
+ - Trust typed values. Validate untyped input only when it enters a typed boundary.
46
+ - Use integer discriminators across runtime and native boundaries.
47
+ - Keep lint suppressions on the smallest item and state the reason.
48
+
49
+ ## Rust and native boundaries
50
+
51
+ - Keep protocol cores deterministic and independent of runtimes and platforms.
52
+ - Confine handwritten `unsafe` code to ABI or generated boundary modules.
53
+ - Add a safety explanation to each handwritten `unsafe` block.
54
+ - Use `Drop` as fallback cleanup. Provide an explicit close operation when shutdown can fail.
55
+ - Keep native results borrowed only for the current operation. Copy data before the next native call.
56
+
57
+ ## Tests and verification
58
+
59
+ - Add a regression test for each behavior change.
60
+ - Prefer real implementations and integration tests when practical.
61
+ - Use Vitest `assert`. Do not use `expect`.
62
+ - Name TypeScript tests `*.test.ts`.
63
+ - Test partial construction failure, operation failure, repeated close, close during open, cancellation, and peer failure for resource owners.
64
+ - Before review, run `npm run build`, `npm test`, `npm run lint`, and `npm run format:check`.
65
+ - Confirm that generated files are current and Git status is clean.
66
+
67
+ ## Commits and releases
68
+
69
+ - Use a short, imperative, lowercase Conventional Commit subject.
70
+ - Keep each commit focused. Commit each substantial verified change.
71
+ - Run repository verification, package dry runs, content checks, and dependency checks before a public publish.
72
+ - Publish public packages with `npm publish --access public` in the documented dependency order.
package/oxfmt.js ADDED
@@ -0,0 +1,14 @@
1
+ export default {
2
+ printWidth: 100,
3
+ tabWidth: 2,
4
+ useTabs: false,
5
+ semi: false,
6
+ singleQuote: true,
7
+ trailingComma: 'all',
8
+ arrowParens: 'always',
9
+ endOfLine: 'lf',
10
+ insertFinalNewline: true,
11
+ sortImports: {},
12
+ sortPackageJson: true,
13
+ ignorePatterns: ['**/dist/**', '**/generated/**', '**/native/**', 'target/**'],
14
+ }
package/oxlint.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "categories": {
3
+ "correctness": "error",
4
+ "suspicious": "error",
5
+ "pedantic": "error",
6
+ "perf": "error",
7
+ "style": "error",
8
+ "restriction": "off",
9
+ "nursery": "off"
10
+ },
11
+ "plugins": ["import", "node", "oxc", "typescript", "unicorn", "eslint"],
12
+ "rules": {
13
+ "eslint/max-lines": "off",
14
+ "eslint/max-lines-per-function": "off",
15
+ "eslint/max-statements": "off",
16
+ "eslint/init-declarations": "off",
17
+ "eslint/no-magic-numbers": "off",
18
+ "eslint/one-var": "off",
19
+ "eslint/sort-imports": "off",
20
+ "import/consistent-type-specifier-style": ["error", "prefer-inline"],
21
+ "import/exports-last": "off",
22
+ "import/group-exports": "off",
23
+ "import/no-default-export": "error",
24
+ "import/no-named-export": "off",
25
+ "import/prefer-default-export": "off",
26
+ "prefer-readonly-parameter-types": "off",
27
+ "vitest/no-importing-vitest-globals": "off",
28
+ "vitest/prefer-expect-assertions": "off",
29
+ "unicorn/number-literal-case": "off",
30
+ "unicorn/prefer-ternary": "off"
31
+ },
32
+ "env": {
33
+ "es6": true,
34
+ "node": true,
35
+ "browser": true
36
+ },
37
+ "ignorePatterns": ["**/dist/**", "**/generated/**", "**/native/**"],
38
+ "options": {
39
+ "typeAware": true,
40
+ "typeCheck": true,
41
+ "maxWarnings": 0
42
+ }
43
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@muxion/dev-config",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/vietthang/muxion-common.git"
8
+ },
9
+ "files": [
10
+ "AGENTS.md",
11
+ "oxfmt.js",
12
+ "oxlint.json",
13
+ "tsconfig"
14
+ ],
15
+ "type": "module",
16
+ "exports": {
17
+ "./AGENTS.md": "./AGENTS.md",
18
+ "./oxfmt": "./oxfmt.js",
19
+ "./oxlint.json": "./oxlint.json",
20
+ "./tsconfig/base.json": "./tsconfig/base.json",
21
+ "./tsconfig/browser.json": "./tsconfig/browser.json",
22
+ "./tsconfig/checked-js-test.json": "./tsconfig/checked-js-test.json",
23
+ "./tsconfig/library.json": "./tsconfig/library.json",
24
+ "./tsconfig/node-json.json": "./tsconfig/node-json.json",
25
+ "./tsconfig/node.json": "./tsconfig/node.json",
26
+ "./tsconfig/test.json": "./tsconfig/test.json"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "peerDependencies": {
32
+ "oxfmt": "^0.64.0",
33
+ "oxlint": "^1.82.0",
34
+ "typescript": "^7.0.2"
35
+ }
36
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "module": "NodeNext",
6
+ "moduleResolution": "NodeNext",
7
+ "strict": true,
8
+ "erasableSyntaxOnly": true,
9
+ "allowImportingTsExtensions": true,
10
+ "rewriteRelativeImportExtensions": true,
11
+ "noUncheckedIndexedAccess": true,
12
+ "exactOptionalPropertyTypes": true,
13
+ "noImplicitOverride": true,
14
+ "noPropertyAccessFromIndexSignature": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noUnusedLocals": true,
17
+ "noUnusedParameters": true,
18
+ "verbatimModuleSyntax": true,
19
+ "isolatedModules": true,
20
+ "forceConsistentCasingInFileNames": true,
21
+ "declaration": true,
22
+ "declarationMap": true,
23
+ "sourceMap": true,
24
+ "skipLibCheck": true
25
+ }
26
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./library.json",
3
+ "compilerOptions": {
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"]
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./test.json",
3
+ "compilerOptions": {
4
+ "allowJs": true,
5
+ "checkJs": true
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "./base.json"
3
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./node.json",
3
+ "compilerOptions": {
4
+ "resolveJsonModule": true
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./library.json",
3
+ "compilerOptions": {
4
+ "types": ["node"]
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./library.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": ["node"]
6
+ }
7
+ }