diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/.prettierrc.js b/.prettierrc.cjs similarity index 100% rename from .prettierrc.js rename to .prettierrc.cjs diff --git a/examples/bin/test.mjs b/examples/bin/test.mjs index c2c7bbf2..241ae67f 100755 --- a/examples/bin/test.mjs +++ b/examples/bin/test.mjs @@ -42,8 +42,6 @@ const run = async () => { './node_modules/prettier/bin/prettier.cjs', '.', '--write', - '--plugin', - 'prettier-plugin-ember-template-tag', debug ? '--log-level' : null, debug ? 'debug' : null, ].filter(Boolean), diff --git a/package.json b/package.json index 421ed727..baafbebf 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "email": "kmenne@gmail.com", "name": "Krystan HuffMenne" }, - "type": "commonjs", + "type": "module", "main": "dist/prettier-plugin-ember-template-tag.js", "license": "MIT", "repository": { diff --git a/src/parse/index.ts b/src/parse/index.ts index 77deadf9..222c256c 100644 --- a/src/parse/index.ts +++ b/src/parse/index.ts @@ -10,12 +10,12 @@ import { Preprocessor } from 'content-tag'; import type { Parser } from 'prettier'; import { parsers as babelParsers } from 'prettier/plugins/babel.js'; -import { PRINTER_NAME } from '../config'; +import { PRINTER_NAME } from '../config.js'; import type { Options } from '../options.js'; -import type { GlimmerTemplate, RawGlimmerTemplate } from '../types/glimmer'; -import { isDefaultTemplate } from '../types/glimmer'; -import { assert } from '../utils'; -import { preprocessTemplateRange } from './preprocess'; +import type { GlimmerTemplate, RawGlimmerTemplate } from '../types/glimmer.js'; +import { isDefaultTemplate } from '../types/glimmer.js'; +import { assert } from '../utils/index.js'; +import { preprocessTemplateRange } from './preprocess.js'; const typescript = babelParsers['babel-ts'] as Parser; const p = new Preprocessor(); diff --git a/src/parse/preprocess.ts b/src/parse/preprocess.ts index 7c78f1b5..9dd3483b 100644 --- a/src/parse/preprocess.ts +++ b/src/parse/preprocess.ts @@ -1,4 +1,4 @@ -import type { RawGlimmerTemplate } from '../types/glimmer'; +import type { RawGlimmerTemplate } from '../types/glimmer.js'; function replaceRange( original: string, diff --git a/src/print/index.ts b/src/print/index.ts index 01546340..749fb04d 100644 --- a/src/print/index.ts +++ b/src/print/index.ts @@ -8,10 +8,13 @@ import type { import { printers as estreePrinters } from 'prettier/plugins/estree.js'; import type { Options } from '../options.js'; -import { getGlimmerTemplate, isGlimmerTemplate } from '../types/glimmer'; -import { assert } from '../utils'; -import { fixPreviousPrint, saveCurrentPrintOnSiblingNode } from './ambiguity'; -import { printTemplateContent, printTemplateTag } from './template'; +import { getGlimmerTemplate, isGlimmerTemplate } from '../types/glimmer.js'; +import { assert } from '../utils/index.js'; +import { + fixPreviousPrint, + saveCurrentPrintOnSiblingNode, +} from './ambiguity.js'; +import { printTemplateContent, printTemplateTag } from './template.js'; const estreePrinter = estreePrinters['estree'] as Printer; diff --git a/tsconfig.json b/tsconfig.json index 3034b9cd..51a4cf1e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "sourceMap": true, "resolveJsonModule": true, "isolatedModules": true, + "verbatimModuleSyntax": true, "noEmit": true, "paths": { diff --git a/vite.config.ts b/vite.config.ts index c627b033..8bba1e68 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,3 @@ -// @ts-expect-error https://github.com/vitejs/vite/issues/11552 - import { defineConfig } from 'vite'; export default defineConfig({ @@ -9,7 +7,7 @@ export default defineConfig({ }, lib: { entry: 'src/main.ts', - formats: ['cjs'], + formats: ['es'], }, minify: false, },