Skip to content

Commit 908c8cf

Browse files
committed
ESM lib
1 parent 944db35 commit 908c8cf

9 files changed

Lines changed: 1448 additions & 415 deletions

File tree

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
presets: [
3+
["@babel/preset-env", { targets: { node: "current" } }],
4+
"@babel/preset-typescript"
5+
]
6+
};

eslint.config.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
const {
2-
defineConfig,
3-
} = require("eslint/config");
4-
5-
const tsParser = require("@typescript-eslint/parser");
6-
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
7-
const js = require("@eslint/js");
8-
9-
const {
10-
FlatCompat,
11-
} = require("@eslint/eslintrc");
1+
import { defineConfig } from "eslint/config";
2+
import tsParser from "@typescript-eslint/parser";
3+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
126

137
const compat = new FlatCompat({
14-
baseDirectory: __dirname,
8+
baseDirectory: import.meta.dirname,
159
recommendedConfig: js.configs.recommended,
1610
allConfig: js.configs.all
1711
});
1812

19-
module.exports = defineConfig([{
13+
export default defineConfig([{
2014
languageOptions: {
2115
parser: tsParser,
2216
},

jest.config.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
module.exports = {
2-
verbose: true,
3-
testEnvironment: 'jsdom',
1+
/** @type {import("jest").Config} */
2+
export default {
3+
// verbose: true, // Uncomment for detailed test output
4+
testEnvironment: "jsdom",
45
testEnvironmentOptions: {
5-
customExportConditions: ['node']
6+
customExportConditions: ["node"],
67
},
7-
setupFilesAfterEnv: [
8-
'./test/helpers/setup.ts'
9-
]
10-
}
8+
transform: {
9+
"^.+\\.[tj]sx?$": ["babel-jest", { configFile: "./babel.config.js" }],
10+
},
11+
setupFilesAfterEnv: ["./test/helpers/setup.ts"],
12+
testMatch: ["**/__tests__/**/*.ts?(x)", "**/?(*.)+(spec|test).ts?(x)"],
13+
roots: ["<rootDir>/src", "<rootDir>/test"],
14+
};

0 commit comments

Comments
 (0)