diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 96% rename from .eslintrc.js rename to .eslintrc.cjs index 3365bc62..f9d5d222 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -110,9 +110,9 @@ module.exports = { }, settings: { jest: { - // we're using vitest which has a very similar API to jest - // (so the linting plugins work nicely), but it means we have to explicitly - // set the jest version. + // We're using vitest which has a very similar API to jest + // (so the linting plugins work nicely), but it means we + // have to set the jest version explicitly. version: 28, }, }, diff --git a/cypress/.eslintrc.js b/cypress/.eslintrc.cjs similarity index 100% rename from cypress/.eslintrc.js rename to cypress/.eslintrc.cjs diff --git a/mocks/index.js b/mocks/index.js index ca2210ce..2cbbbe76 100644 --- a/mocks/index.js +++ b/mocks/index.js @@ -1,5 +1,5 @@ -const { http, passthrough } = require("msw"); -const { setupServer } = require("msw/node"); +import { http, passthrough } from "msw"; +import { setupServer } from "msw/node"; // put one-off handlers that don't really need an entire file to themselves here const miscHandlers = [ diff --git a/package.json b/package.json index 31ca04ef..541e4ba9 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,17 @@ "name": "indie-stack-template", "private": true, "sideEffects": false, + "type": "module", "scripts": { "build": "remix build", "dev": "remix dev -c \"npm run dev:serve\"", - "dev:serve": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js", + "dev:serve": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js", "format": "prettier --write .", "format:repo": "npm run format && npm run lint -- --fix", "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", "setup": "prisma generate && prisma migrate deploy && prisma db seed", "start": "remix-serve ./build/index.js", - "start:mocks": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js", + "start:mocks": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js", "test": "vitest", "test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"", "pretest:e2e:run": "npm run build", @@ -53,7 +54,6 @@ "@vitejs/plugin-react": "^4.2.1", "@vitest/coverage-v8": "^1.4.0", "autoprefixer": "^10.4.19", - "binode": "^1.0.5", "cookie": "^0.6.0", "cross-env": "^7.0.3", "cypress": "^13.7.1", @@ -89,6 +89,6 @@ "node": ">=18.0.0" }, "prisma": { - "seed": "ts-node -r tsconfig-paths/register prisma/seed.ts" + "seed": "ts-node --esm -r tsconfig-paths/register prisma/seed.ts" } } diff --git a/postcss.config.js b/postcss.config.cjs similarity index 100% rename from postcss.config.js rename to postcss.config.cjs diff --git a/remix.config.js b/remix.config.js index 29582b29..4047ae45 100644 --- a/remix.config.js +++ b/remix.config.js @@ -1,6 +1,5 @@ /** @type {import('@remix-run/dev').AppConfig} */ -module.exports = { +export default { cacheDirectory: "./node_modules/.cache/remix", ignoredRouteFiles: ["**/.*", "**/*.test.{ts,tsx}"], - serverModuleFormat: "cjs", }; diff --git a/tsconfig.json b/tsconfig.json index c0a761dd..17bce856 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "resolveJsonModule": true, "target": "ES2020",