diff --git a/examples/data-objects/table-document/.eslintrc.js b/examples/data-objects/table-document/.eslintrc.js index c3573c72dc1d..31eca03a0423 100644 --- a/examples/data-objects/table-document/.eslintrc.js +++ b/examples/data-objects/table-document/.eslintrc.js @@ -11,4 +11,16 @@ module.exports = { rules: { "@typescript-eslint/strict-boolean-expressions": "off", }, + overrides: [ + { + // Rules only for test files + files: ["*.spec.ts", "src/test/**"], + rules: { + // ESLint's resolver doesn't resolve relative imports of ESNext modules correctly, since + // it resolves the path relative to the .ts file (and assumes a file with a .js extension + // should exist there) + "import/no-unresolved": ["error", { ignore: ["^\\.(.*)\\.js$"] }], + }, + }, + ], }; diff --git a/examples/data-objects/table-document/README.md b/examples/data-objects/table-document/README.md index bff4549d0dde..8eb09a00d582 100644 --- a/examples/data-objects/table-document/README.md +++ b/examples/data-objects/table-document/README.md @@ -20,3 +20,4 @@ For example, to support a feature like simple user attribution, the app can appe Being an example, this package should have `private: true` in `package.json` but alas there's one consumer of Fluid taking a dependency on it, so we can't do that yet. +Once it can be converted, or once that consumer confirms they don't need both ESNext and CommonJS modules, it should also drop the CommonJS build (this has already been done for the package's tests, but not its public API). diff --git a/examples/data-objects/table-document/src/test/table.spec.ts b/examples/data-objects/table-document/src/test/table.spec.mts similarity index 98% rename from examples/data-objects/table-document/src/test/table.spec.ts rename to examples/data-objects/table-document/src/test/table.spec.mts index 0ac8c83c0026..959309a0a4cf 100644 --- a/examples/data-objects/table-document/src/test/table.spec.ts +++ b/examples/data-objects/table-document/src/test/table.spec.mts @@ -7,9 +7,9 @@ import { strict as assert } from "assert"; import { requestFluidObject } from "@fluidframework/runtime-utils"; import { ITestObjectProvider } from "@fluidframework/test-utils"; import { describeLoaderCompat } from "@fluid-internal/test-version-utils"; -import { TableDocument } from "../document"; -import { TableSlice } from "../slice"; -import { TableDocumentItem } from "../table"; +import { TableDocument } from "../document.js"; +import { TableSlice } from "../slice.js"; +import { TableDocumentItem } from "../table.js"; describeLoaderCompat("TableDocument", (getTestObjectProvider) => { let tableDocument: TableDocument; diff --git a/examples/data-objects/table-document/src/test/tableWithInterception.spec.ts b/examples/data-objects/table-document/src/test/tableWithInterception.spec.mts similarity index 98% rename from examples/data-objects/table-document/src/test/tableWithInterception.spec.ts rename to examples/data-objects/table-document/src/test/tableWithInterception.spec.mts index a44bb2692605..9fc645d122e1 100644 --- a/examples/data-objects/table-document/src/test/tableWithInterception.spec.ts +++ b/examples/data-objects/table-document/src/test/tableWithInterception.spec.mts @@ -9,9 +9,9 @@ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions"; import { requestFluidObject } from "@fluidframework/runtime-utils"; import { ITestObjectProvider } from "@fluidframework/test-utils"; import { describeLoaderCompat } from "@fluid-internal/test-version-utils"; -import { ITable } from "../table"; -import { TableDocument } from "../document"; -import { createTableWithInterception } from "../interception"; +import { ITable } from "../table.js"; +import { TableDocument } from "../document.js"; +import { createTableWithInterception } from "../interception/index.js"; describeLoaderCompat("Table Document with Interception", (getTestObjectProvider) => { describe("Simple User Attribution", () => { diff --git a/examples/data-objects/table-document/src/test/tsconfig.json b/examples/data-objects/table-document/src/test/tsconfig.json index b58e17f1917f..e34d0becab11 100644 --- a/examples/data-objects/table-document/src/test/tsconfig.json +++ b/examples/data-objects/table-document/src/test/tsconfig.json @@ -6,6 +6,7 @@ "types": ["node", "mocha"], "declaration": false, "declarationMap": false, + "module": "esnext", }, "include": ["./**/*"], "references": [