Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import types consistently from @uppy/core #5589

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Conversation

Murderlon
Copy link
Member

@Murderlon Murderlon commented Jan 9, 2025

It's always better to import from your own package roots like your users would.

Also added a new eslint rule to prevent imports from src/.

Ref: #5584
Ref: #5559

@Murderlon Murderlon requested a review from mifi January 9, 2025 09:23
@Murderlon Murderlon self-assigned this Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Diff output files
diff --git a/packages/@uppy/aws-s3/lib/index.js b/packages/@uppy/aws-s3/lib/index.js
index fdacf39..1e4c029 100644
--- a/packages/@uppy/aws-s3/lib/index.js
+++ b/packages/@uppy/aws-s3/lib/index.js
@@ -7,7 +7,7 @@ function _classPrivateFieldLooseKey(e) {
   return "__private_" + id++ + "_" + e;
 }
 import { RequestClient } from "@uppy/companion-client";
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import EventManager from "@uppy/core/lib/EventManager.js";
 import { createAbortError } from "@uppy/utils/lib/AbortController";
 import { filterFilesToEmitUploadStarted, filterNonFailedFiles } from "@uppy/utils/lib/fileFilters";
diff --git a/packages/@uppy/core/lib/index.js b/packages/@uppy/core/lib/index.js
index 6c10dc2..21b75a9 100644
--- a/packages/@uppy/core/lib/index.js
+++ b/packages/@uppy/core/lib/index.js
@@ -1,5 +1,4 @@
 export { default as BasePlugin } from "./BasePlugin.js";
 export { debugLogger } from "./loggers.js";
 export { default as UIPlugin } from "./UIPlugin.js";
-export { default } from "./Uppy.js";
-export { default as Uppy } from "./Uppy.js";
+export { default, default as Uppy } from "./Uppy.js";
diff --git a/packages/@uppy/drop-target/lib/index.js b/packages/@uppy/drop-target/lib/index.js
index ac16fa4..dff1b9b 100644
--- a/packages/@uppy/drop-target/lib/index.js
+++ b/packages/@uppy/drop-target/lib/index.js
@@ -1,4 +1,4 @@
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import getDroppedFiles from "@uppy/utils/lib/getDroppedFiles";
 import toArray from "@uppy/utils/lib/toArray";
 const packageJson = {
diff --git a/packages/@uppy/form/lib/index.js b/packages/@uppy/form/lib/index.js
index cf3b31a..753c87e 100644
--- a/packages/@uppy/form/lib/index.js
+++ b/packages/@uppy/form/lib/index.js
@@ -6,7 +6,7 @@ var id = 0;
 function _classPrivateFieldLooseKey(e) {
   return "__private_" + id++ + "_" + e;
 }
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import findDOMElement from "@uppy/utils/lib/findDOMElement";
 import toArray from "@uppy/utils/lib/toArray";
 import getFormData from "get-form-data";
diff --git a/packages/@uppy/golden-retriever/lib/index.js b/packages/@uppy/golden-retriever/lib/index.js
index 1a10a45..d8b60bb 100644
--- a/packages/@uppy/golden-retriever/lib/index.js
+++ b/packages/@uppy/golden-retriever/lib/index.js
@@ -1,4 +1,4 @@
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import throttle from "lodash/throttle.js";
 import IndexedDBStore from "./IndexedDBStore.js";
 import MetaDataStore from "./MetaDataStore.js";
diff --git a/packages/@uppy/transloadit/lib/index.js b/packages/@uppy/transloadit/lib/index.js
index e86dfea..1632268 100644
--- a/packages/@uppy/transloadit/lib/index.js
+++ b/packages/@uppy/transloadit/lib/index.js
@@ -6,7 +6,7 @@ var id = 0;
 function _classPrivateFieldLooseKey(e) {
   return "__private_" + id++ + "_" + e;
 }
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import Tus from "@uppy/tus";
 import ErrorWithCause from "@uppy/utils/lib/ErrorWithCause";
 import hasProperty from "@uppy/utils/lib/hasProperty";
diff --git a/packages/@uppy/tus/lib/index.js b/packages/@uppy/tus/lib/index.js
index c53394f..650bb19 100644
--- a/packages/@uppy/tus/lib/index.js
+++ b/packages/@uppy/tus/lib/index.js
@@ -6,7 +6,7 @@ var id = 0;
 function _classPrivateFieldLooseKey(e) {
   return "__private_" + id++ + "_" + e;
 }
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import EventManager from "@uppy/core/lib/EventManager.js";
 import { filterFilesToEmitUploadStarted, filterNonFailedFiles } from "@uppy/utils/lib/fileFilters";
 import getAllowedMetaFields from "@uppy/utils/lib/getAllowedMetaFields";
diff --git a/packages/@uppy/xhr-upload/lib/index.js b/packages/@uppy/xhr-upload/lib/index.js
index db3ca94..2f9c967 100644
--- a/packages/@uppy/xhr-upload/lib/index.js
+++ b/packages/@uppy/xhr-upload/lib/index.js
@@ -6,7 +6,7 @@ var id = 0;
 function _classPrivateFieldLooseKey(e) {
   return "__private_" + id++ + "_" + e;
 }
-import BasePlugin from "@uppy/core/lib/BasePlugin.js";
+import { BasePlugin } from "@uppy/core";
 import EventManager from "@uppy/core/lib/EventManager.js";
 import { fetcher } from "@uppy/utils/lib/fetcher";
 import { filterFilesToEmitUploadStarted, filterNonFailedFiles } from "@uppy/utils/lib/fileFilters";

@mifi
Copy link
Contributor

mifi commented Jan 9, 2025

sgtm except:

  • type tests are failing
  • e2e tests are failing
  • could this be enforced by eslint or something else? i will 100% forget to do this some time in the future, and i'm sure other contributors could too

@Murderlon Murderlon merged commit 6e65cd8 into main Jan 9, 2025
16 checks passed
@Murderlon Murderlon deleted the uppy-file-imports branch January 9, 2025 10:03
github-actions bot added a commit that referenced this pull request Jan 9, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.1 | @uppy/instagram            |   4.2.1 |
| @uppy/aws-s3               |   4.2.1 | @uppy/onedrive             |   4.2.2 |
| @uppy/box                  |   3.2.1 | @uppy/progress-bar         |   4.2.1 |
| @uppy/companion-client     |   4.4.1 | @uppy/provider-views       |   4.4.1 |
| @uppy/compressor           |   2.2.1 | @uppy/react                |   4.2.1 |
| @uppy/core                 |   4.4.1 | @uppy/remote-sources       |   2.3.1 |
| @uppy/dashboard            |   4.3.1 | @uppy/screen-capture       |   4.2.1 |
| @uppy/drag-drop            |   4.1.1 | @uppy/status-bar           |   4.1.1 |
| @uppy/drop-target          |   3.1.1 | @uppy/thumbnail-generator  |   4.1.1 |
| @uppy/dropbox              |   4.2.1 | @uppy/transloadit          |   4.2.1 |
| @uppy/facebook             |   4.2.1 | @uppy/tus                  |   4.2.1 |
| @uppy/file-input           |   4.1.1 | @uppy/unsplash             |   4.3.1 |
| @uppy/form                 |   4.1.1 | @uppy/url                  |   4.2.1 |
| @uppy/golden-retriever     |   4.1.1 | @uppy/vue                  |   2.1.1 |
| @uppy/google-drive         |   4.3.1 | @uppy/webcam               |   4.1.1 |
| @uppy/google-drive-picker  |   0.3.2 | @uppy/webdav               |   0.3.1 |
| @uppy/google-photos        |   0.5.1 | @uppy/xhr-upload           |   4.3.2 |
| @uppy/google-photos-picker |   0.3.2 | @uppy/zoom                 |   3.2.1 |
| @uppy/image-editor         |   3.3.1 | uppy                       |  4.12.2 |
| @uppy/informer             |   4.2.1 |                            |         |

- @uppy/provider-views: Import types consistently from @uppy/core (Merlijn Vos / #5589)
- @uppy/status-bar: fix double upload progress (Mikael Finstad / #5587)
- @uppy/provider-views: fix incorrect import (Merlijn Vos / #5588)
Murderlon added a commit that referenced this pull request Jan 23, 2025
* main: (38 commits)
  Release: [email protected] (#5617)
  @uppy/tus: fix resumeFromPreviousUpload race condition (#5616)
  @uppy/aws-s3: Fixed default shouldUseMultipart (#5613)
  build(deps): bump docker/build-push-action from 6.11.0 to 6.12.0 (#5611)
  @uppy/aws-s3: remove console.error (#5607)
  @uppy/companion: unify http error responses (#5595)
  Release: [email protected] (#5605)
  @uppy/aws-s3: always set S3 meta to UppyFile & include key (#5602)
  @uppy/companion: fix forcePathStyle boolean conversion (#5308)
  Fix Webpack CI (#5604)
  @uppy/aws-s3: allow uploads to fail/succeed independently (#5603)
  Revert "@uppy/aws-s3: allow uploads to fail/succeed independently"
  @uppy/aws-s3: allow uploads to fail/succeed independently
  Add types for css files (#5591)
  @uppy/unsplash: make utmSource optional (#5601)
  build(deps): bump docker/setup-qemu-action from 3.2.0 to 3.3.0 (#5599)
  build(deps): bump docker/build-push-action from 6.10.0 to 6.11.0 (#5600)
  @uppy/companion: add COMPANION_TUS_DEFERRED_UPLOAD_LENGTH (#5561)
  Release: [email protected] (#5590)
  Import types consistently from @uppy/core (#5589)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants