-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
296b64d
commit 2057083
Showing
16 changed files
with
225 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* This is intended to be a basic starting point for linting in your app. | ||
* It relies on recommended configs out of the box for simplicity, but you can | ||
* and should modify this configuration to best suit your team's needs. | ||
*/ | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
|
||
// Base config | ||
extends: ['eslint:recommended'], | ||
|
||
overrides: [ | ||
// React | ||
{ | ||
files: ['**/*.{js,jsx,ts,tsx}'], | ||
plugins: ['react', 'jsx-a11y'], | ||
extends: [ | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
], | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
formComponents: ['Form'], | ||
linkComponents: [ | ||
{ name: 'Link', linkAttribute: 'to' }, | ||
{ name: 'NavLink', linkAttribute: 'to' }, | ||
], | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ['**/*.{ts,tsx}'], | ||
plugins: ['@typescript-eslint', 'import'], | ||
parser: '@typescript-eslint/parser', | ||
settings: { | ||
'import/internal-regex': '^~/', | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.ts', '.tsx'], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
], | ||
}, | ||
|
||
// Node | ||
{ | ||
files: ['.eslintrc.cjs'], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createRequestHandler, type ServerBuild } from '@remix-run/cloudflare'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore This file won’t exist if it hasn’t yet been built | ||
import * as build from './build/server'; // eslint-disable-line import/no-unresolved | ||
import { getLoadContext } from './load-context'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const handleRemixRequest = createRequestHandler(build as any as ServerBuild); | ||
|
||
export default { | ||
async fetch(request, env, ctx) { | ||
try { | ||
const loadContext = getLoadContext({ | ||
request, | ||
context: { | ||
cloudflare: { | ||
// This object matches the return value from Wrangler's | ||
// `getPlatformProxy` used during development via Remix's | ||
// `cloudflareDevProxyVitePlugin`: | ||
// https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy | ||
cf: request.cf, | ||
ctx: { | ||
waitUntil: ctx.waitUntil.bind(ctx), | ||
passThroughOnException: ctx.passThroughOnException.bind(ctx), | ||
}, | ||
caches, | ||
env, | ||
}, | ||
}, | ||
}); | ||
return await handleRemixRequest(request, loadContext); | ||
} catch (error) { | ||
console.log(error); | ||
return new Response('An unexpected error occurred', { status: 500 }); | ||
} | ||
}, | ||
} satisfies ExportedHandler<Env>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
import { defineConfig } from 'vite'; | ||
import { | ||
vitePlugin as remix, | ||
cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, | ||
cloudflareDevProxyVitePlugin, | ||
} from '@remix-run/dev'; | ||
import { defineConfig } from 'vite'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
import { getLoadContext } from './load-context'; | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
remixCloudflareDevProxy({ getLoadContext }), | ||
remix(), | ||
cloudflareDevProxyVitePlugin({ | ||
getLoadContext, | ||
}), | ||
remix({ | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
ssr: { | ||
resolve: { | ||
conditions: ['workerd', 'worker', 'browser'], | ||
}, | ||
}, | ||
resolve: { | ||
mainFields: ['browser', 'module', 'main'], | ||
}, | ||
build: { | ||
minify: true, | ||
}, | ||
}); |
Oops, something went wrong.