diff --git a/common/eslint-local-rules/__tests__/matchingTranslationKeys.spec.js b/common/eslint-local-rules/__tests__/matchingTranslationKeys.spec.js index 342c3c94052..8d0405be0e4 100644 --- a/common/eslint-local-rules/__tests__/matchingTranslationKeys.spec.js +++ b/common/eslint-local-rules/__tests__/matchingTranslationKeys.spec.js @@ -1,11 +1,9 @@ -import rule from '../matchingTranslationKeys.js' +import { matchingTranslationKeys } from '../matchingTranslationKeys.js' import { RuleTester } from 'eslint' -import path from 'path' -import fs from 'fs' -import utils from 'eslint-plugin-vue/lib/utils/index.js' import { describe, it } from 'vitest' import localRules from 'eslint-plugin-local-rules' import globals from 'globals' +import utils from 'eslint-plugin-vue/lib/utils/index.js' import eslintParser from 'vue-eslint-parser' RuleTester.describe = describe @@ -28,7 +26,7 @@ const ruleTester = new RuleTester({ }, }, }) -const ruleInstance = rule(path, utils, fs) +const ruleInstance = matchingTranslationKeys(utils) const options = [ { diff --git a/common/eslint-local-rules/matchingTranslationKeys.js b/common/eslint-local-rules/matchingTranslationKeys.js index fbfbc80edd5..ec3dc952896 100644 --- a/common/eslint-local-rules/matchingTranslationKeys.js +++ b/common/eslint-local-rules/matchingTranslationKeys.js @@ -1,5 +1,7 @@ -module.exports = (path, utils, fs) => { - const { packageDirectory } = require('./packageDirectory.js')(path, fs) +import { packageDirectory } from "./packageDirectory.js" +import path from "path" + +export default function createMatchingTranslationKeys(utils) { /** * Convert a file path to our convention for translation key structures diff --git a/common/eslint-local-rules/packageDirectory.js b/common/eslint-local-rules/packageDirectory.js index ea4faf4093c..01bdca54685 100644 --- a/common/eslint-local-rules/packageDirectory.js +++ b/common/eslint-local-rules/packageDirectory.js @@ -1,5 +1,7 @@ -module.exports = (path, fs) => ({ - packageDirectory: function (filename) { +import path from "path"; +import fs from "fs"; + +export function packageDirectory(filename) { const { root } = path.parse(filename) let directory = filename @@ -16,5 +18,4 @@ module.exports = (path, fs) => ({ } return '' - }, -}) +} diff --git a/frontend/babel.config.js b/frontend/babel.config.js index cbadcc09f9b..2b8a72a2f46 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,8 +1,7 @@ -module.exports = { - presets: ['@vue/app'], - env: { - test: { - plugins: ['require-context-hook'], - }, +// noinspection JSUnusedGlobalSymbols +export const presets = ['@vue/app'] +export const env = { + test: { + plugins: ['require-context-hook'], }, } diff --git a/frontend/docker-setup.sh b/frontend/docker-setup.sh index 8f31586a220..91dd9c4dd9a 100755 --- a/frontend/docker-setup.sh +++ b/frontend/docker-setup.sh @@ -4,10 +4,10 @@ set -euo pipefail BASEDIR=$(dirname "$0") PDF_DIST=$BASEDIR"/src/pdf" -if [ ! -f "$PDF_DIST/pdf.mjs" ] || [ ! -f "$PDF_DIST/prepareInMainThread.mjs" ]; then +if [ ! -f "$PDF_DIST/pdf.js" ] || [ ! -f "$PDF_DIST/prepareInMainThread.js" ]; then # Copy dummy versions of the pdf build outputs, to make sure there is always something to import - cp "$PDF_DIST/pdf.mjs.dist" "$PDF_DIST/pdf.mjs" - cp "$PDF_DIST/prepareInMainThread.mjs.dist" "$PDF_DIST/prepareInMainThread.mjs" + cp "$PDF_DIST/pdf.js.dist" "$PDF_DIST/pdf.js" + cp "$PDF_DIST/prepareInMainThread.js.dist" "$PDF_DIST/prepareInMainThread.js" fi if [ "$CI" = 'true' ] ; then diff --git a/frontend/eslint-local-rules/index.js b/frontend/eslint-local-rules/index.js index 7da60a12f91..0431dd1383f 100644 --- a/frontend/eslint-local-rules/index.js +++ b/frontend/eslint-local-rules/index.js @@ -1,8 +1,6 @@ -const path = require('path') -const fs = require('fs') -const utils = require('eslint-plugin-vue/lib/utils/index.js') -const matchingTranslationKeys = require('../src/common/eslint-local-rules/matchingTranslationKeys.js') +import utils from 'eslint-plugin-vue/lib/utils/index.js' +// noinspection ES6UnusedImports +import createMatchingTranslationKeys from '../../common/eslint-local-rules/matchingTranslationKeys.js' -module.exports = { - 'matching-translation-keys': matchingTranslationKeys(path, utils, fs), -} +// noinspection JSUnusedGlobalSymbols +export const matchingTranslationKeys = createMatchingTranslationKeys(utils) diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index 9d959b3c5f8..3296272992a 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -77,7 +77,7 @@ export default [ }, ], - 'local-rules/matching-translation-keys': [ + 'local-rules/matchingTranslationKeys': [ 'error', { ignoreKeysRegex: diff --git a/frontend/package.json b/frontend/package.json index 498d7a85489..3f9f1e86059 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,7 @@ { "name": "@ecamp3/frontend", "private": true, + "type": "module", "scripts": { "serve": "vite --host 0.0.0.0", "preview": "vite preview --host 0.0.0.0 --port 3000", diff --git a/frontend/src/components/print/print-client/generatePdf.js b/frontend/src/components/print/print-client/generatePdf.js index 67a533c8c1e..f1f20e9959d 100644 --- a/frontend/src/components/print/print-client/generatePdf.js +++ b/frontend/src/components/print/print-client/generatePdf.js @@ -1,4 +1,4 @@ -import { prepareInMainThread } from '@/pdf/prepareInMainThread.mjs' +import { prepareInMainThread } from '@/pdf/prepareInMainThread.js' import cloneDeep from 'lodash/cloneDeep.js' export const generatePdf = async (data) => { diff --git a/frontend/src/components/print/print-client/renderPdf.js b/frontend/src/components/print/print-client/renderPdf.js index 60acd6235c9..b9ee20d80a7 100644 --- a/frontend/src/components/print/print-client/renderPdf.js +++ b/frontend/src/components/print/print-client/renderPdf.js @@ -1,6 +1,6 @@ import wrap from './minimalHalJsonVuex.js' import createI18n from './i18n.js' -import { render, prepare } from '@/pdf/pdf.mjs' +import { render, prepare } from '@/pdf/pdf.js' export const renderPdf = async ({ config, storeData, translationData }) => { const result = { diff --git a/frontend/vue.config.js b/frontend/vue.config.js index c6ceaf66181..2c74438f9d0 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,25 +1,25 @@ -module.exports = { +export const pluginOptions = { + jestSerializer: { + attributesToClear: ['id', 'for'], + formatting: { + indent_char: ' ', + indent_inner_html: true, + indent_size: 5, + inline: [], + sep: '\n', + wrap_attributes: 'force-aligned', + }, + }, +} + +export default { devServer: { useLocalIp: false, allowedHosts: ['ecamp3', 'localhost', '127.0.0.1'], }, transpileDependencies: ['vuetify'], - - pluginOptions: { - jestSerializer: { - attributesToClear: ['id', 'for'], - formatting: { - indent_char: ' ', - indent_inner_html: true, - indent_size: 5, - inline: [], - sep: '\n', - wrap_attributes: 'force-aligned', - }, - }, - }, - + pluginOptions, css: { sourceMap: true, }, diff --git a/pdf/.gitignore b/pdf/.gitignore index be1616bf10b..4cf9e4833b1 100644 --- a/pdf/.gitignore +++ b/pdf/.gitignore @@ -9,7 +9,8 @@ lerna-debug.log* node_modules .DS_Store -dist +/dist/* +!/dist/*.dist dist-ssr coverage *.local diff --git a/pdf/babel.config.js b/pdf/babel.config.js index cbadcc09f9b..2b8a72a2f46 100644 --- a/pdf/babel.config.js +++ b/pdf/babel.config.js @@ -1,8 +1,7 @@ -module.exports = { - presets: ['@vue/app'], - env: { - test: { - plugins: ['require-context-hook'], - }, +// noinspection JSUnusedGlobalSymbols +export const presets = ['@vue/app'] +export const env = { + test: { + plugins: ['require-context-hook'], }, } diff --git a/pdf/dist/pdf.mjs.dist b/pdf/dist/pdf.js.dist similarity index 100% rename from pdf/dist/pdf.mjs.dist rename to pdf/dist/pdf.js.dist diff --git a/pdf/dist/prepareInMainThread.mjs.dist b/pdf/dist/prepareInMainThread.js.dist similarity index 100% rename from pdf/dist/prepareInMainThread.mjs.dist rename to pdf/dist/prepareInMainThread.js.dist diff --git a/pdf/eslint-local-rules/index.js b/pdf/eslint-local-rules/index.js index fa20d58d4dc..0431dd1383f 100644 --- a/pdf/eslint-local-rules/index.js +++ b/pdf/eslint-local-rules/index.js @@ -1,8 +1,6 @@ -const path = require('path') -const fs = require('fs') -const utils = require('eslint-plugin-vue/lib/utils/index.js') -const matchingTranslationKeys = require('../common/eslint-local-rules/matchingTranslationKeys.js') +import utils from 'eslint-plugin-vue/lib/utils/index.js' +// noinspection ES6UnusedImports +import createMatchingTranslationKeys from '../../common/eslint-local-rules/matchingTranslationKeys.js' -module.exports = { - 'matching-translation-keys': matchingTranslationKeys(path, utils, fs), -} +// noinspection JSUnusedGlobalSymbols +export const matchingTranslationKeys = createMatchingTranslationKeys(utils) diff --git a/pdf/eslint.config.mjs b/pdf/eslint.config.mjs index 91fd7649ef0..0fb22597995 100644 --- a/pdf/eslint.config.mjs +++ b/pdf/eslint.config.mjs @@ -73,7 +73,7 @@ export default [ }, ], - 'local-rules/matching-translation-keys': [ + 'local-rules/matchingTranslationKeys': [ 'error', { ignoreKeysRegex: diff --git a/pdf/package.json b/pdf/package.json index 4ad2a030262..4ef8601cf13 100644 --- a/pdf/package.json +++ b/pdf/package.json @@ -1,6 +1,7 @@ { "name": "@ecamp3/client-pdf", "description": "Create pdfs for eCamp, using Vue components", + "type": "module", "main": "src/index.js", "private": true, "scripts": { diff --git a/print/eslint-local-rules/index.js b/print/eslint-local-rules/index.js index 7ec246a27da..0431dd1383f 100644 --- a/print/eslint-local-rules/index.js +++ b/print/eslint-local-rules/index.js @@ -1,8 +1,6 @@ -const path = require('path') -const fs = require('fs') -const utils = require('eslint-plugin-vue/lib/utils/index.js') -const matchingTranslationKeys = require('../../common/eslint-local-rules/matchingTranslationKeys.js') +import utils from 'eslint-plugin-vue/lib/utils/index.js' +// noinspection ES6UnusedImports +import createMatchingTranslationKeys from '../../common/eslint-local-rules/matchingTranslationKeys.js' -module.exports = { - 'matching-translation-keys': matchingTranslationKeys(path, utils, fs), -} +// noinspection JSUnusedGlobalSymbols +export const matchingTranslationKeys = createMatchingTranslationKeys(utils) diff --git a/print/eslint.config.mjs b/print/eslint.config.mjs index 377a195b9db..272deb64b97 100644 --- a/print/eslint.config.mjs +++ b/print/eslint.config.mjs @@ -51,7 +51,7 @@ export default [ 'prefer-const': 'error', 'vue/multi-word-component-names': 'off', - 'local-rules/matching-translation-keys': [ + 'local-rules/matchingTranslationKeys': [ 'error', { ignoreKeysRegex: diff --git a/print/package.json b/print/package.json index 2ca28f1e228..98f2aefc174 100644 --- a/print/package.json +++ b/print/package.json @@ -1,6 +1,7 @@ { "name": "@ecamp3/backend-print", "private": true, + "type": "module", "scripts": { "dev": "nuxt dev", "dev-debug": "node --inspect node_modules/.bin/nuxt",