From 4761aeb513ab32496667dce5ba7d124fe0f37bc4 Mon Sep 17 00:00:00 2001 From: Anna Bocharova Date: Thu, 28 Dec 2023 00:00:16 +0100 Subject: [PATCH] Switching to ESM dev environment. (#252) --- ui/.eslintrc.json | 8 ++++---- ui/package.json | 1 + ui/tsconfig.json | 4 ++-- ui/tsup.config.ts | 1 + ui/{vitest.config.mts => vitest.config.ts} | 0 5 files changed, 8 insertions(+), 6 deletions(-) rename ui/{vitest.config.mts => vitest.config.ts} (100%) diff --git a/ui/.eslintrc.json b/ui/.eslintrc.json index dcab78e8..390e601c 100644 --- a/ui/.eslintrc.json +++ b/ui/.eslintrc.json @@ -1,6 +1,6 @@ { "env": { - "es6": true, + "es2022": true, "browser": true }, "extends": [ @@ -10,8 +10,8 @@ ], "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 6, - "sourceType": "script", + "ecmaVersion": "latest", + "sourceType": "module", "project": true }, "plugins": [ @@ -23,7 +23,7 @@ }, "overrides": [ { - "files": ["*.config.*ts", "mocks/*.ts"], + "files": ["*.config.ts", "mocks/*.ts"], "rules": { "import/no-extraneous-dependencies": "off" } diff --git a/ui/package.json b/ui/package.json index 4fc6b3eb..711dd049 100644 --- a/ui/package.json +++ b/ui/package.json @@ -3,6 +3,7 @@ "description": "The UI scripts for OctoRelay plugin", "version": "1.0.0", "private": true, + "type": "module", "author": { "name": "Anna Bocharova", "url": "https://github.com/RobinTail" diff --git a/ui/tsconfig.json b/ui/tsconfig.json index b71944df..02e042ea 100644 --- a/ui/tsconfig.json +++ b/ui/tsconfig.json @@ -2,8 +2,8 @@ "extends": "@tsconfig/node18/tsconfig.json", "compilerOptions": { "target": "ES6", - "module": "CommonJS", - "moduleResolution": "Node", + "module": "ES2022", + "moduleResolution": "Bundler", "removeComments": true }, "exclude": [ diff --git a/ui/tsup.config.ts b/ui/tsup.config.ts index f83ad0de..ab69e712 100644 --- a/ui/tsup.config.ts +++ b/ui/tsup.config.ts @@ -4,6 +4,7 @@ export default defineConfig({ entry: ["octorelay.ts"], outDir: "../octoprint_octorelay/static/js", format: "cjs", + outExtension: () => ({ js: ".js" }), splitting: false, sourcemap: false, clean: true, diff --git a/ui/vitest.config.mts b/ui/vitest.config.ts similarity index 100% rename from ui/vitest.config.mts rename to ui/vitest.config.ts