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:
@@ -111,7 +111,7 @@ const reducer = (state: State, { type, payload }): State => {
|
||||
}
|
||||
case 'updateCode':
|
||||
return { ...state, code: payload }
|
||||
case 'resetCustomizer':
|
||||
case 'resetCustomizer': {
|
||||
const resetParameters = {}
|
||||
state.customizerParams.forEach(({ name, initial }) => {
|
||||
resetParameters[name] = initial
|
||||
@@ -120,7 +120,8 @@ const reducer = (state: State, { type, payload }): State => {
|
||||
...state,
|
||||
currentParameters: resetParameters,
|
||||
}
|
||||
case 'healthyRender':
|
||||
}
|
||||
case 'healthyRender': {
|
||||
const currentParameters = {}
|
||||
|
||||
const customizerParams: CadhubParams[] = payload.customizerParams || []
|
||||
@@ -144,6 +145,7 @@ const reducer = (state: State, { type, payload }): State => {
|
||||
: payload.message,
|
||||
isLoading: false,
|
||||
}
|
||||
}
|
||||
case 'errorRender':
|
||||
return {
|
||||
...state,
|
||||
@@ -198,7 +200,7 @@ const reducer = (state: State, { type, payload }): State => {
|
||||
...state,
|
||||
threeInstance: payload,
|
||||
}
|
||||
case 'settingsButtonClicked':
|
||||
case 'settingsButtonClicked': {
|
||||
const isReClick =
|
||||
state.sideTray.length &&
|
||||
state.sideTray.length === payload.length &&
|
||||
@@ -229,6 +231,7 @@ const reducer = (state: State, { type, payload }): State => {
|
||||
...state,
|
||||
sideTray: payload,
|
||||
}
|
||||
}
|
||||
case 'switchEditorModel':
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
// 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
|
||||
export function useMarkdownMetaData(text: string): Array<any> {
|
||||
const metaData = {} as any
|
||||
return React.useMemo(() => {
|
||||
const metaRegExp = RegExp(
|
||||
/^---[\r\n](((?!---).|[\r\n])*)[\r\n]---$/m
|
||||
) as any
|
||||
interface MetaData {
|
||||
[key: string]: string
|
||||
}
|
||||
type MarkdownMetaDataReturn = [RegExpExecArray, MetaData]
|
||||
|
||||
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
|
||||
const rawMetaData = metaRegExp.exec(text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user