Skip to content

Commit 0cba1d2

Browse files
committed
Import files with .ts extensions
We have at least one passionate user (because they contributed!) using Bun, so there's probably others. Bun and Deno can run .ts files directly - but if we confuse them with import paths that don't resolve until after a transpile step, they can break. This PR ensures all files are imported as .ts files and then rewritten at build time for compatibility with non-TypeScript runtimes.
1 parent 4bc27d7 commit 0cba1d2

Some content is hidden

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

60 files changed

+2107
-260
lines changed

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import tseslint from "typescript-eslint";
44
import globals from "globals";
55
import jsdoc from "eslint-plugin-jsdoc";
66
import prettier from "eslint-plugin-prettier";
7+
import importPlugin from "eslint-plugin-import";
78

89
export default defineConfig(
910
eslint.configs.recommended,
@@ -22,6 +23,7 @@ export default defineConfig(
2223
},
2324
plugins: {
2425
prettier,
26+
import: importPlugin,
2527
},
2628
rules: {
2729
"prettier/prettier": [2, { endOfLine: "auto" }],
@@ -39,6 +41,7 @@ export default defineConfig(
3941
"Prefer arrow functions over invoking Function.prototype.bind",
4042
},
4143
],
44+
"import/extensions": 2,
4245
},
4346
},
4447
{

examples/node_simple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
// Connecting to ROS
4-
import * as ROSLIB from "../src/RosLib";
4+
import * as ROSLIB from "../src/RosLib.ts";
55

66
const ros = new ROSLIB.Ros({
77
url: "ws://localhost:9090",

0 commit comments

Comments
 (0)