From 07897a2174c5ef8affefed631fe48bc5510b426c Mon Sep 17 00:00:00 2001 From: dwelle Date: Mon, 4 Sep 2023 00:31:27 +0200 Subject: [PATCH] lint --- .lintstagedrc.js | 5 +- .../api/children-components/footer.mdx | 6 +- .../excalidraw/api/props/initialdata.mdx | 10 +- .../excalidraw/api/props/props.mdx | 79 ++++++---- .../excalidraw/api/props/render-props.mdx | 19 ++- .../excalidraw/api/props/ui-options.mdx | 2 +- .../excalidraw/api/utils/export.mdx | 136 ++++++++++------- .../excalidraw/api/utils/restore.mdx | 85 ++++++++--- .../excalidraw/customizing-styles.mdx | 1 + dev-docs/docs/@excalidraw/excalidraw/faq.mdx | 8 +- .../@excalidraw/excalidraw/integration.mdx | 6 +- dev-docs/docs/introduction/contributing.mdx | 8 +- index.html | 2 +- src/actions/actionFrame.ts | 11 +- src/appState.ts | 4 +- src/colors.ts | 15 +- src/components/App.tsx | 11 +- src/components/ExportDialog.scss | 3 +- src/components/LayerUI.scss | 8 +- src/css/styles.scss | 12 +- src/data/blob.ts | 2 +- src/data/transform.ts | 141 +++++++++--------- src/element/bounds.test.ts | 2 +- src/element/linearElementEditor.ts | 6 +- src/element/resizeElements.ts | 2 +- src/element/resizeTest.ts | 34 +++-- src/element/types.ts | 8 +- src/history.ts | 53 +++---- .../excalidraw/example/public/index.html | 2 +- src/scene/Scene.ts | 2 +- src/scene/Shape.ts | 16 +- src/scene/export.ts | 15 +- src/tests/helpers/api.ts | 11 +- src/types.ts | 4 +- src/utils.ts | 2 +- src/zindex.ts | 13 +- 36 files changed, 434 insertions(+), 310 deletions(-) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 612d4c39a..d94b5a573 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -5,9 +5,10 @@ const { CLIEngine } = require("eslint"); const cli = new CLIEngine({}); module.exports = { - "*.{js,ts,tsx}": files => { + "*.{js,ts,tsx}": (files) => { return ( - "eslint --max-warnings=0 --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ") + "eslint --max-warnings=0 --fix " + + files.filter((file) => !cli.isPathIgnored(file)).join(" ") ); }, "*.{css,scss,json,md,html,yml}": ["prettier --write"], diff --git a/dev-docs/docs/@excalidraw/excalidraw/api/children-components/footer.mdx b/dev-docs/docs/@excalidraw/excalidraw/api/children-components/footer.mdx index cdd5ea5a4..e1c717f0a 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/api/children-components/footer.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/api/children-components/footer.mdx @@ -9,7 +9,7 @@ You will need to import the `Footer` component from the package and wrap your co ```jsx live function App() { return ( -
+
diff --git a/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx b/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx index 104d9dccd..71cb8856a 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx @@ -1,34 +1,34 @@ # Props -All `props` are *optional*. +All `props` are _optional_. | Name | Type | Default | Description | -| --- | --- | --- | --- | -| [`initialData`](/docs/@excalidraw/excalidraw/api/props/initialdata) | `object` | `null` | Promise | `null` | The initial data with which app loads. | -| [`ref`](/docs/@excalidraw/excalidraw/api/props/ref) | `object` | _ | `Ref` to be passed to Excalidraw | -| [`isCollaborating`](#iscollaborating) | `boolean` | _ | This indicates if the app is in `collaboration` mode | -| [`onChange`](#onchange) | `function` | _ | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw `elements` and the current `app state`. | -| [`onPointerUpdate`](#onpointerupdate) | `function` | _ | Callback triggered when mouse pointer is updated. | -| [`onPointerDown`](#onpointerdown) | `function` | _ | This prop if passed gets triggered on pointer down evenets | -| [`onScrollChange`](#onscrollchange) | `function` | _ | This prop if passed gets triggered when scrolling the canvas. | -| [`onPaste`](#onpaste) | `function` | _ | Callback to be triggered if passed when the something is pasted in to the scene | -| [`onLibraryChange`](#onlibrarychange) | `function` | _ | The callback if supplied is triggered when the library is updated and receives the library items. | -| [`onLinkOpen`](#onlinkopen) | `function` | _ | The callback if supplied is triggered when any link is opened. | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | +| [`initialData`](/docs/@excalidraw/excalidraw/api/props/initialdata) | `object` | `null` | Promise | `null` | The initial data with which app loads. | +| [`ref`](/docs/@excalidraw/excalidraw/api/props/ref) | `object` | \_ | `Ref` to be passed to Excalidraw | +| [`isCollaborating`](#iscollaborating) | `boolean` | \_ | This indicates if the app is in `collaboration` mode | +| [`onChange`](#onchange) | `function` | \_ | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw `elements` and the current `app state`. | +| [`onPointerUpdate`](#onpointerupdate) | `function` | \_ | Callback triggered when mouse pointer is updated. | +| [`onPointerDown`](#onpointerdown) | `function` | \_ | This prop if passed gets triggered on pointer down evenets | +| [`onScrollChange`](#onscrollchange) | `function` | \_ | This prop if passed gets triggered when scrolling the canvas. | +| [`onPaste`](#onpaste) | `function` | \_ | Callback to be triggered if passed when the something is pasted in to the scene | +| [`onLibraryChange`](#onlibrarychange) | `function` | \_ | The callback if supplied is triggered when the library is updated and receives the library items. | +| [`onLinkOpen`](#onlinkopen) | `function` | \_ | The callback if supplied is triggered when any link is opened. | | [`langCode`](#langcode) | `string` | `en` | Language code string to be used in Excalidraw | -| [`renderTopRightUI`](/docs/@excalidraw/excalidraw/api/props/render-props#rendertoprightui) | `function` | _ | Render function that renders custom UI in top right corner | -| [`renderCustomStats`](/docs/@excalidraw/excalidraw/api/props/render-props#rendercustomstats) | `function` | _ | Render function that can be used to render custom stats on the stats dialog. | -| [`renderSidebar`](/docs/@excalidraw/excalidraw/api/props/render-props#rendersidebar) | `function` | _ | Render function that renders custom sidebar. | -| [`viewModeEnabled`](#viewmodeenabled) | `boolean` | _ | This indicates if the app is in `view` mode. | -| [`zenModeEnabled`](#zenmodeenabled) | `boolean` | _ | This indicates if the `zen` mode is enabled | -| [`gridModeEnabled`](#gridmodeenabled) | `boolean` | _ | This indicates if the `grid` mode is enabled | -| [`libraryReturnUrl`](#libraryreturnurl) | `string` | _ | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to | +| [`renderTopRightUI`](/docs/@excalidraw/excalidraw/api/props/render-props#rendertoprightui) | `function` | \_ | Render function that renders custom UI in top right corner | +| [`renderCustomStats`](/docs/@excalidraw/excalidraw/api/props/render-props#rendercustomstats) | `function` | \_ | Render function that can be used to render custom stats on the stats dialog. | +| [`renderSidebar`](/docs/@excalidraw/excalidraw/api/props/render-props#rendersidebar) | `function` | \_ | Render function that renders custom sidebar. | +| [`viewModeEnabled`](#viewmodeenabled) | `boolean` | \_ | This indicates if the app is in `view` mode. | +| [`zenModeEnabled`](#zenmodeenabled) | `boolean` | \_ | This indicates if the `zen` mode is enabled | +| [`gridModeEnabled`](#gridmodeenabled) | `boolean` | \_ | This indicates if the `grid` mode is enabled | +| [`libraryReturnUrl`](#libraryreturnurl) | `string` | \_ | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to | | [`theme`](#theme) | `"light"` | `"dark"` | `"light"` | The theme of the Excalidraw component | | [`name`](#name) | `string` | | Name of the drawing | | [`UIOptions`](/docs/@excalidraw/excalidraw/api/props/ui-options) | `object` | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L151) | To customise UI options. Currently we support customising [`canvas actions`](#canvasactions) | | [`detectScroll`](#detectscroll) | `boolean` | `true` | Indicates whether to update the offsets when nearest ancestor is scrolled. | | [`handleKeyboardGlobally`](#handlekeyboardglobally) | `boolean` | `false` | Indicates whether to bind the keyboard events to document. | | [`autoFocus`](#autofocus) | `boolean` | `false` | indicates whether to focus the Excalidraw component on page load | -| [`generateIdForFile`](#generateidforfile) | `function` | _ | Allows you to override `id` generation for files added on canvas | +| [`generateIdForFile`](#generateidforfile) | `function` | \_ | Allows you to override `id` generation for files added on canvas | | [`validateEmbeddable`](#validateEmbeddable) | string[] | `boolean | RegExp | RegExp[] | ((link: string) => boolean | undefined)` | \_ | use for custom src url validation | | [`renderEmbeddable`](/docs/@excalidraw/excalidraw/api/props/render-props#renderEmbeddable) | `function` | \_ | Render function that can override the built-in `