Skip to content

Commit

Permalink
lint: add eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawntraoz committed Sep 23, 2024
1 parent 1f5a8f9 commit 64c1894
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
43 changes: 24 additions & 19 deletions packages/field-plugin/src/createFieldPlugin/createFieldPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export const createFieldPlugin: CreateFieldPlugin = ({
// eslint-disable-next-line functional/no-throw-statement
throw new Error(
'The argument could not be cloned. ' +
'The argument must be cloneable with structuredClone(), so that it can be sent to other windows with window.postMessage(). ' +
'Does your object contain functions, getters, setters, proxies, or any other value that is not cloneable? Did you try to pass a reactive object? ' +
'For a full description on the structuredClone algorithm, see: ' +
'https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm',
'The argument must be cloneable with structuredClone(), so that it can be sent to other windows with window.postMessage(). ' +
'Does your object contain functions, getters, setters, proxies, or any other value that is not cloneable? Did you try to pass a reactive object? ' +
'For a full description on the structuredClone algorithm, see: ' +
'https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm',
{
cause: err,
},
Expand All @@ -86,21 +86,26 @@ export const createFieldPlugin: CreateFieldPlugin = ({
Exclude<typeof validateContent, undefined>
>['content']

const { actions, messageCallbacks, onHeightChange, onKeydownEsc, initialize } =
createPluginActions<InferredContent>({
uid,
postToContainer,
onUpdateState: (data) => {
onUpdateState({
type: 'loaded',
data,
actions,
})
},
validateContent:
validateContent ||
((content) => ({ content: content as InferredContent })),
})
const {
actions,
messageCallbacks,
onHeightChange,
onKeydownEsc,
initialize,
} = createPluginActions<InferredContent>({
uid,
postToContainer,
onUpdateState: (data) => {
onUpdateState({
type: 'loaded',
data,
actions,
})
},
validateContent:
validateContent ||
((content) => ({ content: content as InferredContent })),
})

const cleanupHeightChangeListener = createHeightChangeListener(onHeightChange)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
* @returns function for cleaning up side effects
*/

export const createKeydownEscListener = (
onChange: () => void,
) => {
export const createKeydownEscListener = (onChange: () => void) => {
const handleEsc = (event: KeyboardEvent) => {
const key = event.key;
if (key === "Escape") {
const key = event.key
if (key === 'Escape') {
onChange()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const createPluginActions: CreatePluginActions = ({
// TODO remove side-effect, making functions in this file pure.

Check warning on line 68 in packages/field-plugin/src/createFieldPlugin/createPluginActions/createPluginActions.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected 'todo' comment: 'TODO remove side-effect, making...'
// perhaps only show this message in development mode?
console.debug(

Check warning on line 70 in packages/field-plugin/src/createFieldPlugin/createPluginActions/createPluginActions.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement
`Plugin received a message from container of an unknown action type "${data.action
`Plugin received a message from container of an unknown action type "${
data.action
}". You may need to upgrade the version of the @storyblok/field-plugin library. Full message: ${JSON.stringify(
data,
)}`,
Expand Down

0 comments on commit 64c1894

Please sign in to comment.