Fixing linting problem from running yarn rw lint (#537)

✖ 118 problems (65 errors, 53 warnings) currently
This commit was merged in pull request #537.
This commit is contained in:
Kurt Hutten
2021-09-29 17:35:07 +10:00
committed by GitHub
parent 0ce7ce4e76
commit e9ad7180a7
12 changed files with 38 additions and 35 deletions

View File

@@ -19,7 +19,7 @@ export interface UserProfileType {
loading: boolean loading: boolean
error: boolean error: boolean
onSave: Function onSave: Function
projects: {}[] projects: any[]
} }
export interface FieldType { export interface FieldType {
@@ -205,14 +205,13 @@ export function fieldReducer(state, action) {
}, },
} }
case 'SET_NEW_VALUE': case 'SET_NEW_VALUE':
const newState = { return {
...state, ...state,
[action.payload.field]: { [action.payload.field]: {
...state[action.payload.field], ...state[action.payload.field],
newValue: action.payload.value, newValue: action.payload.value,
}, },
} }
return newState
default: default:
return state return state
} }

View File

@@ -19,10 +19,6 @@ const truncate = (text) => {
return output return output
} }
const jsonTruncate = (obj) => {
return truncate(JSON.stringify(obj, null, 2))
}
const timeTag = (datetime) => { const timeTag = (datetime) => {
return ( return (
<time dateTime={datetime} title={datetime}> <time dateTime={datetime} title={datetime}>
@@ -31,10 +27,6 @@ const timeTag = (datetime) => {
) )
} }
const checkboxInputTag = (checked) => {
return <input type="checkbox" checked={checked} disabled />
}
const UsersList = ({ users }) => { const UsersList = ({ users }) => {
const [deleteUser] = useMutation(DELETE_USER_MUTATION, { const [deleteUser] = useMutation(DELETE_USER_MUTATION, {
onCompleted: () => { onCompleted: () => {

View File

@@ -4,8 +4,8 @@
import { RenderArgs, DefaultKernelExport } from './common' import { RenderArgs, DefaultKernelExport } from './common'
export const render: DefaultKernelExport['render'] = async ({ export const render: DefaultKernelExport['render'] = async ({
code, code, // eslint-disable-line @typescript-eslint/no-unused-vars
settings, settings, // eslint-disable-line @typescript-eslint/no-unused-vars
}: RenderArgs) => { }: RenderArgs) => {
// do your magic // do your magic
return { return {

View File

@@ -41,7 +41,7 @@ interface CsgObj {
} }
function CSGArray2R3fComponent(Csgs: CsgObj[]): React.ReactNode { function CSGArray2R3fComponent(Csgs: CsgObj[]): React.ReactNode {
return Csgs.map(({ vertices, indices, color, transforms, type }, index) => { return Csgs.map(({ vertices, indices, color, transforms, type }) => {
const materialDef = materials[type] const materialDef = materials[type]
if (!materialDef) { if (!materialDef) {
console.error('Can not hangle object type: ' + type, { console.error('Can not hangle object type: ' + type, {

View File

@@ -413,7 +413,8 @@ const makeScriptWorker = ({ callback, convertToSolids }) => {
runMain(params) runMain(params)
}, },
init: (params) => { init: (params) => {
let { baseURI, alias = [] } = params let baseURI = params.baseURI
const alias = params.alias || []
if (!baseURI && typeof document != 'undefined' && document.baseURI) { if (!baseURI && typeof document != 'undefined' && document.baseURI) {
baseURI = document.baseURI baseURI = document.baseURI
} }

View File

@@ -24,7 +24,7 @@ function fallbackCopyTextToClipboard(text: string) {
document.body.removeChild(textArea) document.body.removeChild(textArea)
} }
const clipboardSuccessToast = (text: string) => const clipboardSuccessToast = () =>
toast.success(() => ( toast.success(() => (
<div className="overflow-hidden"> <div className="overflow-hidden">
<p>link added to clipboard.</p> <p>link added to clipboard.</p>

View File

@@ -111,7 +111,7 @@ const reducer = (state: State, { type, payload }): State => {
} }
case 'updateCode': case 'updateCode':
return { ...state, code: payload } return { ...state, code: payload }
case 'resetCustomizer': case 'resetCustomizer': {
const resetParameters = {} const resetParameters = {}
state.customizerParams.forEach(({ name, initial }) => { state.customizerParams.forEach(({ name, initial }) => {
resetParameters[name] = initial resetParameters[name] = initial
@@ -120,7 +120,8 @@ const reducer = (state: State, { type, payload }): State => {
...state, ...state,
currentParameters: resetParameters, currentParameters: resetParameters,
} }
case 'healthyRender': }
case 'healthyRender': {
const currentParameters = {} const currentParameters = {}
const customizerParams: CadhubParams[] = payload.customizerParams || [] const customizerParams: CadhubParams[] = payload.customizerParams || []
@@ -144,6 +145,7 @@ const reducer = (state: State, { type, payload }): State => {
: payload.message, : payload.message,
isLoading: false, isLoading: false,
} }
}
case 'errorRender': case 'errorRender':
return { return {
...state, ...state,
@@ -198,7 +200,7 @@ const reducer = (state: State, { type, payload }): State => {
...state, ...state,
threeInstance: payload, threeInstance: payload,
} }
case 'settingsButtonClicked': case 'settingsButtonClicked': {
const isReClick = const isReClick =
state.sideTray.length && state.sideTray.length &&
state.sideTray.length === payload.length && state.sideTray.length === payload.length &&
@@ -229,6 +231,7 @@ const reducer = (state: State, { type, payload }): State => {
...state, ...state,
sideTray: payload, sideTray: payload,
} }
}
case 'switchEditorModel': case 'switchEditorModel':
return { return {
...state, ...state,

View File

@@ -1,11 +1,14 @@
// Extracts YAML frontmatter from Markdown files // Extracts YAML frontmatter from Markdown files
// Gotten from this helpful comment on a react-markdown GitHub Issue: https://github.com/remarkjs/react-markdown/issues/164#issuecomment-890497653 // Gotten from this helpful comment on a react-markdown GitHub Issue: https://github.com/remarkjs/react-markdown/issues/164#issuecomment-890497653
export function useMarkdownMetaData(text: string): Array<any> { interface MetaData {
const metaData = {} as any [key: string]: string
return React.useMemo(() => { }
const metaRegExp = RegExp( type MarkdownMetaDataReturn = [RegExpExecArray, MetaData]
/^---[\r\n](((?!---).|[\r\n])*)[\r\n]---$/m
) as any export function useMarkdownMetaData(text: string): MarkdownMetaDataReturn {
return React.useMemo<MarkdownMetaDataReturn>(() => {
const metaData: MetaData = {}
const metaRegExp = RegExp(/^---[\r\n](((?!---).|[\r\n])*)[\r\n]---$/m)
// get metadata // get metadata
const rawMetaData = metaRegExp.exec(text) const rawMetaData = metaRegExp.exec(text)

View File

@@ -10,7 +10,7 @@ const NewProjectPage = ({ userName }) => {
const { isAuthenticated, currentUser } = useAuth() const { isAuthenticated, currentUser } = useAuth()
useEffect(() => { useEffect(() => {
!isAuthenticated && navigate(routes.home()) !isAuthenticated && navigate(routes.home())
}, [currentUser]) }, [currentUser, isAuthenticated])
return ( return (
<MainLayout> <MainLayout>
<Seo <Seo

View File

@@ -43,7 +43,12 @@ export default () => (
<section className=""> <section className="">
<h1> <h1>
<span className="font-ropa-sans">404 Page Not Found</span> <span className="font-ropa-sans">404 Page Not Found</span>
<div className="text-sm">{location.href} 🤷</div> <div className="text-sm">
{location.href}{' '}
<span role="img" aria-label="shrug">
🤷
</span>
</div>
</h1> </h1>
</section> </section>
</MainLayout> </MainLayout>

View File

@@ -25,7 +25,7 @@ const PrivacyPolicyPage = () => {
<P> <P>
This Privacy Policy describes how your personal information is This Privacy Policy describes how your personal information is
collected, used, and shared when you visit or use{' '} collected, used, and shared when you visit or use{' '}
<A to="https://cadhub.xyz" /> (the Site). <A to="https://cadhub.xyz" /> {'(the “Site”)'}.
</P> </P>
<SubHeading>PERSONAL INFORMATION WE COLLECT</SubHeading> <SubHeading>PERSONAL INFORMATION WE COLLECT</SubHeading>
<P> <P>
@@ -36,7 +36,7 @@ const PrivacyPolicyPage = () => {
about the individual web pages that you view, what websites or search about the individual web pages that you view, what websites or search
terms referred you to the Site, and information about how you interact terms referred you to the Site, and information about how you interact
with the Site. We refer to this automatically-collected information as with the Site. We refer to this automatically-collected information as
Device Information. {'“Device Information.”'}
</P> </P>
<P>We collect Device Information using the following technologies:</P> <P>We collect Device Information using the following technologies:</P>
<ul className="list-disc pl-4"> <ul className="list-disc pl-4">
@@ -60,8 +60,8 @@ const PrivacyPolicyPage = () => {
Additionally when you make an account or sign in to the app through Additionally when you make an account or sign in to the app through
the Site, we collect certain information from you, including your the Site, we collect certain information from you, including your
name, email address as well as any information you add to the website, name, email address as well as any information you add to the website,
such as your profile bio, or "parts" you have added. We refer to this such as your profile bio, or {'"Projects"'} you have added. We refer
information as Account Information. to this information as Account Information.
</P> </P>
<P> <P>
When we talk about Personal Information in this Privacy Policy, we When we talk about Personal Information in this Privacy Policy, we
@@ -126,9 +126,9 @@ const PrivacyPolicyPage = () => {
</P> </P>
<SubHeading>DATA RETENTION</SubHeading> <SubHeading>DATA RETENTION</SubHeading>
<P> <P>
When you place an create a "part" through the Site, we will keep this When you place an create a {'"project"'} through the Site, we will
record to become part of the public website, you can delete you parts keep this record to become part of the public website, you can delete
at anytime. you Projects at anytime.
</P> </P>
<SubHeading>CHANGES</SubHeading> <SubHeading>CHANGES</SubHeading>
<P> <P>

View File

@@ -116,7 +116,7 @@ const SubjectAccessRequestPage = () => {
<SubjectAccessRequestsCell /> <SubjectAccessRequestsCell />
Here to fulfill a user's right to portability, before running this Here to fulfill a user's right to portability, before running this
please check that the query in please check that the query in
"pages/SubjectAccessRequestPage/SubjectAccessRequestPage.js" is {'"pages/SubjectAccessRequestPage/SubjectAccessRequestPage.js"'} is
up-to-date. up-to-date.
<Form onSubmit={onSubmit}> <Form onSubmit={onSubmit}>
<div <div