Skip to content

Commit

Permalink
build: ✨ eslint on pre-push
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass committed Feb 22, 2023
1 parent f401e2e commit 8946826
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 80 deletions.
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@
"rules": {
"jsx-a11y/media-has-caption": "off"
},
"ignorePatterns": ["**/*.html", "node_polyfill.js"]

"ignorePatterns": [
"**/*.html",
"node_polyfill.js",
"src/stories/*",
".storybook/*",
"src/gql/index.ts"
]
}
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged
npx pretty-quick --staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"test": "vite test",
"screenshots": "playwright test",
"eject": "react-scripts eject",
"format": "prettier --write \"./src/**/*.{js,jsx,scss}\"",
"format": "prettier --write \"./src/**/*.{js,jsx,scss,ts,tsx}\"",
"prepare": "husky install",
"lint": "eslint src --ext .js,.jsx",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/collab/CollabSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@atoms/button'
import { apiSWR, fetchGraphQL } from '@data/api'
import { apiSWR } from '@data/api'
import { CollabContractsOverview } from '@pages/collaborate/manage'
import { useEffect, useState } from 'react'
import { useState } from 'react'

import collabStyles from '@components/collab/index.module.scss'
import classNames from 'classnames'
Expand Down
110 changes: 51 additions & 59 deletions src/data/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import { useUserStore } from '@context/userStore'
import { useModalStore } from '@context/modalStore'
import { FileForm, FileMint, MintFormat } from '@types'

/**
* @typedef { {path: string?, blob: Blob} } FileHolder
*/

/**
* Upload a single file through the IPFS proxy.
*/
Expand Down Expand Up @@ -102,17 +98,8 @@ const isDoubleMint = async (uri: string) => {
address: proxyAddress || address || '',
uris: [uri],
})
// await fetchGraphQL(uriQuery, 'uriQuery', {
// address: proxyAddress || address,
// ids: [uri],
// })

console.debug(res)

// if (errors) {
// show(`GraphQL Error: ${JSON.stringify(errors)}`)
// return true
// } else if (data) {
if (!res.tokens) return false
const areAllTokensBurned = res.tokens.every((token) => token.editions === 0)

Expand All @@ -129,21 +116,6 @@ const isDoubleMint = async (uri: string) => {
// return false
}

interface PrepareProps {
name: string
description: string
tags: string
address: string
file: FileForm
cover: FileForm
thumbnail: FileForm
rights: string
rightUri?: string
language?: string
accessibility: string
contentRating: string
formats: any
}
export const prepareFile = async ({
name,
description,
Expand Down Expand Up @@ -270,22 +242,7 @@ export const prepareDirectory = async ({
accessibility,
contentRating,
formats,
}: {
name: string
description: string
tags: string
address: string
files: FileForm[]
cover: FileForm
thumbnail: FileForm
generateDisplayUri: string
rights: string
rightUri: string
language: string
accessibility: string
contentRating: string
formats: MintFormat[]
}) => {
}: PrepareDirectoryOptions) => {
const step = useModalStore.getState().step

const hashes = await uploadFilesToDirectory(files)
Expand Down Expand Up @@ -435,21 +392,7 @@ async function buildMetadataFile({
accessibility,
contentRating,
formats,
}: {
name: string
description: string
tags: string
uri: string
address: string
displayUri: string
thumbnailUri: string
rights: string
rightUri?: string
language: string
accessibility: string
contentRating: string
formats: MintFormat[]
}) {
}: BuildMetadataOptions) {
const metadata: TeiaMetadata = {
name,
description,
Expand All @@ -475,6 +418,55 @@ async function buildMetadataFile({
return JSON.stringify(metadata)
}

// TODO: Move types to each roots?

interface PrepareProps {
name: string
description: string
tags: string
address: string
file: FileForm
cover: FileForm
thumbnail: FileForm
rights: string
rightUri?: string
language?: string
accessibility: string
contentRating: string
formats: any
}

interface PrepareDirectoryOptions {
name: string
description: string
tags: string
address: string
files: FileMint[]
cover: FileForm
thumbnail: FileForm
generateDisplayUri: string
rights: string
rightUri: string
language: string
accessibility: string
contentRating: string
formats: MintFormat[]
}
interface BuildMetadataOptions {
name: string
description: string
tags: string
uri: string
address: string
displayUri: string
thumbnailUri: string
rights: string
rightUri?: string
language?: string
accessibility: string
contentRating: string
formats: MintFormat[]
}
interface TeiaMetadata {
name: string
description: string
Expand Down
30 changes: 15 additions & 15 deletions src/pages/collaborate/manage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import { apiSWR } from '@data/api'
// import { CountdownTimer } from '@components/collab/manage/CountdownTimer'
import { CollabList } from '@components/collab/manage/CollabList'
import { useUserStore } from '@context/userStore'
import { useCollabStore } from '@context/collabStore'
import { shallow } from 'zustand/shallow'
// import { useCollabStore } from '@context/collabStore'
// import { shallow } from 'zustand/shallow'
import { Loading } from '@atoms/loading'

export const CollabContractsOverview = ({ showAdminOnly = false }) => {
const address = useUserStore((st) => st.address)

const [
originatedContract,
// originationOpHash,
// findOriginatedContractFromOpHash,
] = useCollabStore(
(st) => [
st.originatedContract,
// st.originationOpHash,
// st.findOriginatedContractFromOpHash,
],
shallow
)
// const [
// originatedContract,
// originationOpHash,
// findOriginatedContractFromOpHash,
// ] = useCollabStore(
// (st) => [
// st.originatedContract,
// st.originationOpHash,
// st.findOriginatedContractFromOpHash,
// ],
// shallow
// )

// const [collabs, setCollabs] = useState([])
// const [managedCollabs, setManagedCollabs] = useState([])
Expand Down Expand Up @@ -75,7 +75,7 @@ export const CollabContractsOverview = ({ showAdminOnly = false }) => {
: [...adminCollabs, ...participantCollabs]

return availableCollabs
}, [data, address, originatedContract, showAdminOnly])
}, [data, address /*, originatedContract*/, showAdminOnly])
if (!address) {
return
}
Expand Down

0 comments on commit 8946826

Please sign in to comment.