diff --git a/app/entry.client.tsx b/app/entry.client.tsx index 36f2e51a..186cd934 100644 --- a/app/entry.client.tsx +++ b/app/entry.client.tsx @@ -13,6 +13,6 @@ startTransition(() => { document, - + , ); }); diff --git a/app/entry.server.tsx b/app/entry.server.tsx index a39b156f..ea2e9811 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -18,20 +18,20 @@ export default function handleRequest( request: Request, responseStatusCode: number, responseHeaders: Headers, - remixContext: EntryContext + remixContext: EntryContext, ) { return isbot(request.headers.get("user-agent")) ? handleBotRequest( request, responseStatusCode, responseHeaders, - remixContext + remixContext, ) : handleBrowserRequest( request, responseStatusCode, responseHeaders, - remixContext + remixContext, ); } @@ -39,7 +39,7 @@ function handleBotRequest( request: Request, responseStatusCode: number, responseHeaders: Headers, - remixContext: EntryContext + remixContext: EntryContext, ) { return new Promise((resolve, reject) => { const { pipe, abort } = renderToPipeableStream( @@ -58,7 +58,7 @@ function handleBotRequest( new Response(body, { headers: responseHeaders, status: responseStatusCode, - }) + }), ); pipe(body); @@ -70,7 +70,7 @@ function handleBotRequest( responseStatusCode = 500; console.error(error); }, - } + }, ); setTimeout(abort, ABORT_DELAY); @@ -81,7 +81,7 @@ function handleBrowserRequest( request: Request, responseStatusCode: number, responseHeaders: Headers, - remixContext: EntryContext + remixContext: EntryContext, ) { return new Promise((resolve, reject) => { const { pipe, abort } = renderToPipeableStream( @@ -100,7 +100,7 @@ function handleBrowserRequest( new Response(body, { headers: responseHeaders, status: responseStatusCode, - }) + }), ); pipe(body); @@ -112,7 +112,7 @@ function handleBrowserRequest( console.error(error); responseStatusCode = 500; }, - } + }, ); setTimeout(abort, ABORT_DELAY); diff --git a/app/models/user.server.ts b/app/models/user.server.ts index cce401e2..ffdc0cca 100644 --- a/app/models/user.server.ts +++ b/app/models/user.server.ts @@ -34,7 +34,7 @@ export async function deleteUserByEmail(email: User["email"]) { export async function verifyLogin( email: User["email"], - password: Password["hash"] + password: Password["hash"], ) { const userWithPassword = await prisma.user.findUnique({ where: { email }, @@ -49,7 +49,7 @@ export async function verifyLogin( const isValid = await bcrypt.compare( password, - userWithPassword.password.hash + userWithPassword.password.hash, ); if (!isValid) { diff --git a/app/routes/join.tsx b/app/routes/join.tsx index ccedff51..2ca5d882 100644 --- a/app/routes/join.tsx +++ b/app/routes/join.tsx @@ -22,21 +22,21 @@ export const action = async ({ request }: ActionArgs) => { if (!validateEmail(email)) { return json( { errors: { email: "Email is invalid", password: null } }, - { status: 400 } + { status: 400 }, ); } if (typeof password !== "string" || password.length === 0) { return json( { errors: { email: null, password: "Password is required" } }, - { status: 400 } + { status: 400 }, ); } if (password.length < 8) { return json( { errors: { email: null, password: "Password is too short" } }, - { status: 400 } + { status: 400 }, ); } @@ -49,7 +49,7 @@ export const action = async ({ request }: ActionArgs) => { password: null, }, }, - { status: 400 } + { status: 400 }, ); } diff --git a/app/routes/login.tsx b/app/routes/login.tsx index 25a8f928..1dbf77ba 100644 --- a/app/routes/login.tsx +++ b/app/routes/login.tsx @@ -23,21 +23,21 @@ export const action = async ({ request }: ActionArgs) => { if (!validateEmail(email)) { return json( { errors: { email: "Email is invalid", password: null } }, - { status: 400 } + { status: 400 }, ); } if (typeof password !== "string" || password.length === 0) { return json( { errors: { email: null, password: "Password is required" } }, - { status: 400 } + { status: 400 }, ); } if (password.length < 8) { return json( { errors: { email: null, password: "Password is too short" } }, - { status: 400 } + { status: 400 }, ); } @@ -46,7 +46,7 @@ export const action = async ({ request }: ActionArgs) => { if (!user) { return json( { errors: { email: "Invalid email or password", password: null } }, - { status: 400 } + { status: 400 }, ); } diff --git a/app/routes/notes.new.tsx b/app/routes/notes.new.tsx index 6afcf5cb..ca11cf0f 100644 --- a/app/routes/notes.new.tsx +++ b/app/routes/notes.new.tsx @@ -16,14 +16,14 @@ export const action = async ({ request }: ActionArgs) => { if (typeof title !== "string" || title.length === 0) { return json( { errors: { body: null, title: "Title is required" } }, - { status: 400 } + { status: 400 }, ); } if (typeof body !== "string" || body.length === 0) { return json( { errors: { body: "Body is required", title: null } }, - { status: 400 } + { status: 400 }, ); } diff --git a/app/session.server.ts b/app/session.server.ts index 31a861e4..10cebe5a 100644 --- a/app/session.server.ts +++ b/app/session.server.ts @@ -25,7 +25,7 @@ export async function getSession(request: Request) { } export async function getUserId( - request: Request + request: Request, ): Promise { const session = await getSession(request); const userId = session.get(USER_SESSION_KEY); @@ -44,7 +44,7 @@ export async function getUser(request: Request) { export async function requireUserId( request: Request, - redirectTo: string = new URL(request.url).pathname + redirectTo: string = new URL(request.url).pathname, ) { const userId = await getUserId(request); if (!userId) { diff --git a/app/singleton.server.ts b/app/singleton.server.ts index 4eae6307..6d933284 100644 --- a/app/singleton.server.ts +++ b/app/singleton.server.ts @@ -4,7 +4,7 @@ export const singleton = ( name: string, - valueFactory: () => Value + valueFactory: () => Value, ): Value => { const g = global as any; g.__singletons ??= {}; diff --git a/app/utils.ts b/app/utils.ts index a7eb66eb..0f6a18c1 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -14,7 +14,7 @@ const DEFAULT_REDIRECT = "/"; */ export function safeRedirect( to: FormDataEntryValue | string | null | undefined, - defaultRedirect: string = DEFAULT_REDIRECT + defaultRedirect: string = DEFAULT_REDIRECT, ) { if (!to || typeof to !== "string") { return defaultRedirect; @@ -34,12 +34,12 @@ export function safeRedirect( * @returns {JSON|undefined} The router data or undefined if not found */ export function useMatchesData( - id: string + id: string, ): Record | undefined { const matchingRoutes = useMatches(); const route = useMemo( () => matchingRoutes.find((route) => route.id === id), - [matchingRoutes, id] + [matchingRoutes, id], ); return route?.data; } @@ -60,7 +60,7 @@ export function useUser(): User { const maybeUser = useOptionalUser(); if (!maybeUser) { throw new Error( - "No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead." + "No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead.", ); } return maybeUser; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 88e7febd..0865e4e1 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -49,7 +49,7 @@ function login({ } = {}) { cy.then(() => ({ email })).as("user"); cy.exec( - `npx ts-node --require tsconfig-paths/register ./cypress/support/create-user.ts "${email}"` + `npx ts-node --require tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`, ).then(({ stdout }) => { const cookieValue = stdout .replace(/.*(?.*)<\/cookie>.*/s, "$") @@ -75,7 +75,7 @@ function cleanupUser({ email }: { email?: string } = {}) { function deleteUserByEmail(email: string) { cy.exec( - `npx ts-node --require tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"` + `npx ts-node --require tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`, ); cy.clearCookie("__session"); } diff --git a/cypress/support/create-user.ts b/cypress/support/create-user.ts index d3fb0c5b..a466ea23 100644 --- a/cypress/support/create-user.ts +++ b/cypress/support/create-user.ts @@ -41,7 +41,7 @@ async function createAndLogin(email: string) { ${parsedCookie.__session} - `.trim() + `.trim(), ); } diff --git a/mocks/index.js b/mocks/index.js index dbf2207b..41246682 100644 --- a/mocks/index.js +++ b/mocks/index.js @@ -4,7 +4,7 @@ const { setupServer } = require("msw/node"); // put one-off handlers that don't really need an entire file to themselves here const miscHandlers = [ rest.post(`${process.env.REMIX_DEV_HTTP_ORIGIN}/ping`, (req) => - req.passthrough() + req.passthrough(), ), ]; diff --git a/package.json b/package.json index 2fabe1c6..27076af1 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,13 @@ "/public/build" ], "dependencies": { - "@prisma/client": "^4.16.1", + "@prisma/client": "^4.16.2", "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", "bcryptjs": "^2.4.3", - "isbot": "^3.6.12", + "isbot": "^3.6.13", "react": "^18.2.0", "react-dom": "^18.2.0", "tiny-invariant": "^1.3.1" @@ -43,42 +43,42 @@ "@remix-run/dev": "*", "@remix-run/eslint-config": "*", "@testing-library/cypress": "^9.0.0", - "@testing-library/jest-dom": "^5.16.5", + "@testing-library/jest-dom": "^5.17.0", "@types/bcryptjs": "^2.4.2", - "@types/eslint": "^8.40.2", - "@types/node": "^18.16.18", - "@types/react": "^18.2.14", - "@types/react-dom": "^18.2.6", - "@vitejs/plugin-react": "^4.0.1", - "@vitest/coverage-v8": "^0.32.2", - "autoprefixer": "^10.4.14", + "@types/eslint": "^8.44.2", + "@types/node": "^18.17.6", + "@types/react": "^18.2.20", + "@types/react-dom": "^18.2.7", + "@vitejs/plugin-react": "^4.0.4", + "@vitest/coverage-v8": "^0.34.2", + "autoprefixer": "^10.4.15", "binode": "^1.0.5", "cookie": "^0.5.0", "cross-env": "^7.0.3", - "cypress": "^12.16.0", - "eslint": "^8.43.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-cypress": "^2.13.3", - "eslint-plugin-markdown": "^3.0.0", + "cypress": "^12.17.4", + "eslint": "^8.47.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-cypress": "^2.14.0", + "eslint-plugin-markdown": "^3.0.1", "eslint-plugin-prefer-let": "^3.0.1", - "happy-dom": "^9.20.3", - "msw": "^1.2.2", + "happy-dom": "^10.10.4", + "msw": "^1.2.3", "npm-run-all": "^4.1.5", - "postcss": "^8.4.24", - "prettier": "2.8.8", - "prettier-plugin-tailwindcss": "^0.3.0", - "prisma": "^4.16.1", + "postcss": "^8.4.28", + "prettier": "3.0.2", + "prettier-plugin-tailwindcss": "^0.5.3", + "prisma": "^4.16.2", "start-server-and-test": "^2.0.0", - "tailwindcss": "^3.3.2", + "tailwindcss": "^3.3.3", "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", - "typescript": "^5.1.3", - "vite": "^4.3.9", + "typescript": "^5.1.6", + "vite": "^4.4.9", "vite-tsconfig-paths": "^3.6.0", - "vitest": "^0.32.2" + "vitest": "^0.34.2" }, "engines": { - "node": ">=14" + "node": ">=14.0.0" }, "prisma": { "seed": "ts-node --require tsconfig-paths/register prisma/seed.ts" diff --git a/remix.init/index.js b/remix.init/index.js index 347417c0..521944d4 100644 --- a/remix.init/index.js +++ b/remix.init/index.js @@ -12,7 +12,7 @@ const cleanupCypressFiles = ({ fileEntries, isTypeScript, packageManager }) => fileEntries.flatMap(([filePath, content]) => { let newContent = content.replace( new RegExp("npx ts-node", "g"), - isTypeScript ? `${packageManager.exec} ts-node` : "node" + isTypeScript ? `${packageManager.exec} ts-node` : "node", ); if (!isTypeScript) { @@ -27,7 +27,7 @@ const cleanupCypressFiles = ({ fileEntries, isTypeScript, packageManager }) => const cleanupDeployWorkflow = (deployWorkflow, deployWorkflowPath) => { delete deployWorkflow.jobs.typecheck; deployWorkflow.jobs.deploy.needs = deployWorkflow.jobs.deploy.needs.filter( - (need) => need !== "typecheck" + (need) => need !== "typecheck", ); return [fs.writeFile(deployWorkflowPath, YAML.stringify(deployWorkflow))]; @@ -36,7 +36,7 @@ const cleanupDeployWorkflow = (deployWorkflow, deployWorkflowPath) => { const cleanupVitestConfig = (vitestConfig, vitestConfigPath) => { const newVitestConfig = vitestConfig.replace( "setup-test-env.ts", - "setup-test-env.js" + "setup-test-env.js", ); return [fs.writeFile(vitestConfigPath, newVitestConfig)]; @@ -73,7 +73,7 @@ const getPackageManagerCommand = (packageManager) => lockfile: "yarn.lock", run: (script, args) => `yarn ${script} ${args || ""}`, }), - }[packageManager]()); + })[packageManager](); const getPackageManagerVersion = (packageManager) => // Copied over from https://github.com/nrwl/nx/blob/bd9b33eaef0393d01f747ea9a2ac5d2ca1fb87c6/packages/nx/src/utils/package-manager.ts#L105-L114 @@ -84,7 +84,7 @@ const getRandomString = (length) => crypto.randomBytes(length).toString("hex"); const readFileIfNotTypeScript = ( isTypeScript, filePath, - parseFunction = (result) => result + parseFunction = (result) => result, ) => isTypeScript ? Promise.resolve() @@ -93,8 +93,8 @@ const readFileIfNotTypeScript = ( const removeUnusedDependencies = (dependencies, unusedDependencies) => Object.fromEntries( Object.entries(dependencies).filter( - ([key]) => !unusedDependencies.includes(key) - ) + ([key]) => !unusedDependencies.includes(key), + ), ); const updatePackageJson = ({ APP_NAME, isTypeScript, packageJson }) => { @@ -116,8 +116,8 @@ const updatePackageJson = ({ APP_NAME, isTypeScript, packageJson }) => { devDependencies, // packages that are only used for linting the repo ["eslint-plugin-markdown", "eslint-plugin-prefer-let"].concat( - isTypeScript ? [] : ["ts-node"] - ) + isTypeScript ? [] : ["ts-node"], + ), ), prisma: isTypeScript ? { ...prisma, seed: prismaSeed } @@ -145,25 +145,25 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { rootDirectory, ".github", "workflows", - "deploy.yml" + "deploy.yml", ); const DOCKERFILE_PATH = path.join(rootDirectory, "Dockerfile"); const CYPRESS_SUPPORT_PATH = path.join(rootDirectory, "cypress", "support"); const CYPRESS_COMMANDS_PATH = path.join( CYPRESS_SUPPORT_PATH, - `commands.${FILE_EXTENSION}` + `commands.${FILE_EXTENSION}`, ); const CREATE_USER_COMMAND_PATH = path.join( CYPRESS_SUPPORT_PATH, - `create-user.${FILE_EXTENSION}` + `create-user.${FILE_EXTENSION}`, ); const DELETE_USER_COMMAND_PATH = path.join( CYPRESS_SUPPORT_PATH, - `delete-user.${FILE_EXTENSION}` + `delete-user.${FILE_EXTENSION}`, ); const VITEST_CONFIG_PATH = path.join( rootDirectory, - `vitest.config.${FILE_EXTENSION}` + `vitest.config.${FILE_EXTENSION}`, ); const REPLACER = "indie-stack-template"; @@ -195,7 +195,7 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { fs.readFile(CREATE_USER_COMMAND_PATH, "utf-8"), fs.readFile(DELETE_USER_COMMAND_PATH, "utf-8"), readFileIfNotTypeScript(isTypeScript, DEPLOY_WORKFLOW_PATH, (s) => - YAML.parse(s) + YAML.parse(s), ), readFileIfNotTypeScript(isTypeScript, VITEST_CONFIG_PATH), PackageJson.load(rootDirectory), @@ -203,7 +203,7 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { const newEnv = env.replace( /^SESSION_SECRET=.*$/m, - `SESSION_SECRET="${getRandomString(16)}"` + `SESSION_SECRET="${getRandomString(16)}"`, ); const prodToml = toml.parse(prodContent); @@ -227,7 +227,7 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { const newDockerfile = pm.lockfile ? dockerfile.replace( new RegExp(escapeRegExp("ADD package.json"), "g"), - `ADD package.json ${pm.lockfile}` + `ADD package.json ${pm.lockfile}`, ) : dockerfile; @@ -250,7 +250,7 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { packageJson.save(), fs.copyFile( path.join(rootDirectory, "remix.init", "gitignore"), - path.join(rootDirectory, ".gitignore") + path.join(rootDirectory, ".gitignore"), ), fs.rm(path.join(rootDirectory, ".github", "ISSUE_TEMPLATE"), { recursive: true, @@ -266,11 +266,11 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { if (!isTypeScript) { fileOperationPromises.push( - ...cleanupDeployWorkflow(deployWorkflow, DEPLOY_WORKFLOW_PATH) + ...cleanupDeployWorkflow(deployWorkflow, DEPLOY_WORKFLOW_PATH), ); fileOperationPromises.push( - ...cleanupVitestConfig(vitestConfig, VITEST_CONFIG_PATH) + ...cleanupVitestConfig(vitestConfig, VITEST_CONFIG_PATH), ); } @@ -287,7 +287,7 @@ const main = async ({ isTypeScript, packageManager, rootDirectory }) => { `Setup is complete. You're now ready to rock and roll 🤘 Start development with \`${pm.run("dev")}\` - `.trim() + `.trim(), ); }; diff --git a/remix.init/package.json b/remix.init/package.json index 8e999269..5f161b81 100644 --- a/remix.init/package.json +++ b/remix.init/package.json @@ -6,7 +6,7 @@ "dependencies": { "@iarna/toml": "^2.2.5", "@npmcli/package-json": "^2.0.0", - "semver": "^7.5.3", + "semver": "^7.5.4", "yaml": "^2.3.1" } }