Skip to content

Commit

Permalink
chore: lint jsx (#426)
Browse files Browse the repository at this point in the history
#425 was not caught because
we're not linting `jsx` files.

I verified that this PR caught the error:

```
/Users/alan/Code/storacha/w3infra/upload-api/html-w3s/index.jsx
  180:13  error  'preact' is not defined  no-undef
```
  • Loading branch information
alanshaw authored Oct 2, 2024
1 parent 8382280 commit d96804d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 96 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"deploy": "sst deploy --outputs-file .test-env.json",
"remove": "sst remove",
"console": "sst console",
"lint": "tsc && eslint '**/*.js'",
"lint": "tsc && eslint '**/*.js' '**/*.jsx'",
"clean": "rm -rf dist node_modules package-lock.json ./*/{.cache,dist,node_modules}",
"test": "npm test -w billing -w upload-api -w carpark -w replicator -w roundabout -w filecoin -w indexer",
"test-integration": "ava --verbose --serial --timeout=660s --fail-fast test/*.test.js",
Expand Down
5 changes: 2 additions & 3 deletions upload-api/functions/validate-email.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { createConsumerTable } from '../tables/consumer.js'
import { createRevocationsTable } from '../stores/revocations.js'
import * as AgentStore from '../stores/agent.js'
import { useProvisionStore } from '../stores/provisions.js'
import * as htmlStoracha from '../html-storacha'
import * as htmlW3s from '../html-w3s'
import * as htmlStoracha from '../html-storacha/index.js'
import * as htmlW3s from '../html-w3s/index.js'
import { createRateLimitTable } from '../tables/rate-limit.js'
import { createSpaceMetricsTable } from '../tables/space-metrics.js'
import { createCustomerStore } from '@web3-storage/w3infra-billing/tables/customer'
Expand Down Expand Up @@ -52,7 +52,6 @@ export function toLambdaResponse(response) {
* @param {import('aws-lambda').APIGatewayProxyEventV2} request
*/
export async function validateEmailGet(request) {
request.requestContext.domainName
if (!request.queryStringParameters?.ucan) {
return toLambdaResponse(
new html.HtmlResponse(
Expand Down
185 changes: 93 additions & 92 deletions upload-api/html-storacha/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,108 +15,109 @@ import storachaLogoSvg from './storacha-logo.svg'
*/
export function buildDocument(body) {
return /* html */ `
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Storacha Email Validation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@acab/reset.css">
<link href="https://fonts.googleapis.com/css2?family=Epilogue:ital,wght@0,100..900;1,100..900&family=Fira+Code:[email protected]&display=swap" rel="stylesheet">
<style>
:root {
--hot-red: #E91315;
--hot-red-light: #EFE3F3;
--hot-yellow: #FFC83F;
--hot-yellow-light: #FFE4AE;
--hot-blue: #0176CE;
--hot-blue-light: #BDE0FF;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Storacha Email Validation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@acab/reset.css">
<link href="https://fonts.googleapis.com/css2?family=Epilogue:ital,wght@0,100..900;1,100..900&family=Fira+Code:[email protected]&display=swap" rel="stylesheet">
<style>
:root {
--hot-red: #E91315;
--hot-red-light: #EFE3F3;
--hot-yellow: #FFC83F;
--hot-yellow-light: #FFE4AE;
--hot-blue: #0176CE;
--hot-blue-light: #BDE0FF;
}
body {
color: black;
background-color: var(--hot-red-light);
font-family: 'Epilogue', sans-serif;
max-width: 70rem;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
gap: 1.5rem;
}
body {
color: black;
background-color: var(--hot-red-light);
font-family: 'Epilogue', sans-serif;
max-width: 70rem;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
gap: 1.5rem;
}
h1 {
color: var(--hot-red);
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 1.5rem;
line-height: 2rem;
}
h1 {
color: var(--hot-red);
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 1.5rem;
line-height: 2rem;
}
h5 {
color: var(--hot-red);
font-size: 1rem;
line-height: 1.5rem;
margin-top: 1rem;
}
h5 {
color: var(--hot-red);
font-size: 1rem;
line-height: 1.5rem;
margin-top: 1rem;
}
header {
padding: 1rem 3rem 0;
}
header {
padding: 1rem 3rem 0;
}
main {
padding: 0 3rem;
text-align: center;
width: 100%;
}
main {
padding: 0 3rem;
text-align: center;
width: 100%;
}
code {
font-family: 'Fira Code';
font-weight: 500;
}
code {
font-family: 'Fira Code';
font-weight: 500;
}
pre > code {
padding: 0.25rem 0;
display: block;
overflow-x: auto;
}
pre > code {
padding: 0.25rem 0;
display: block;
overflow-x: auto;
}
.box {
border: 1px solid var(--hot-red);
border-radius: 1rem;
background-color: #FFFFFF;
padding: 1.25rem;
margin-top: 1rem;
.box {
border: 1px solid var(--hot-red);
border-radius: 1rem;
background-color: #FFFFFF;
padding: 1.25rem;
margin-top: 1rem;
font-size: 0.875rem;
line-height: 1.25rem;
}
.box > p {
margin-bottom: 10px;
}
.box > p:last-child {
margin-bottom: 0;
}
font-size: 0.875rem;
line-height: 1.25rem;
}
.box > p {
margin-bottom: 10px;
}
.box > p:last-child {
margin-bottom: 0;
}
button {
background-color: var(--hot-yellow-light);
color: var(--hot-red);
font-weight: 500;
border: none;
border-radius: 0.25rem;
padding: 0.5rem 1rem;
margin-top: 1rem;
}
</style>
</head>
<body>
${body}
</body>
</html>`
button {
background-color: var(--hot-yellow-light);
color: var(--hot-red);
font-weight: 500;
border: none;
border-radius: 0.25rem;
padding: 0.5rem 1rem;
margin-top: 1rem;
}
</style>
</head>
<body>
${body}
</body>
</html>
`
}

export class HtmlResponse extends Response {
Expand Down

0 comments on commit d96804d

Please sign in to comment.