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

meta: disable @typescript-eslint/no-non-null-assertion lint rule #4945

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Feb 21, 2024

Type assertions are not inherently bad, we need them in some places. We should still avoid using them when we can, I try to remove all that looked like could be avoided in this PR, the one that stay are those that are due to either TS unable to infer the correct types, or cases where there's nothing better than throwing a TypeError on runtime.

The tus-js-client patch was also sent upstream: tus/tus-js-client#670

Copy link
Contributor

github-actions bot commented Feb 21, 2024

Diff output files
diff --git a/packages/@uppy/status-bar/lib/Components.js b/packages/@uppy/status-bar/lib/Components.js
index 3f867a0..0267dfb 100644
--- a/packages/@uppy/status-bar/lib/Components.js
+++ b/packages/@uppy/status-bar/lib/Components.js
@@ -222,7 +222,6 @@ function ProgressBarProcessing(props) {
     mode,
     message,
   } = progress;
-  const roundedValue = Math.round(value * 100);
   const dot = `\u00B7`;
   return h(
     "div",
@@ -230,7 +229,7 @@ function ProgressBarProcessing(props) {
       className: "uppy-StatusBar-content",
     },
     h(LoadingSpinner, null),
-    mode === "determinate" ? `${roundedValue}% ${dot} ` : "",
+    mode === "determinate" ? `${Math.round(value * 100)}% ${dot} ` : "",
     message,
   );
 }
diff --git a/packages/@uppy/tus/lib/index.js b/packages/@uppy/tus/lib/index.js
index 9ad45a0..d1e87ee 100644
--- a/packages/@uppy/tus/lib/index.js
+++ b/packages/@uppy/tus/lib/index.js
@@ -129,8 +129,8 @@ export default class Tus extends BasePlugin {
     });
   }
   resetUploaderReferences(fileID, opts) {
-    if (this.uploaders[fileID]) {
-      const uploader = this.uploaders[fileID];
+    const uploader = this.uploaders[fileID];
+    if (uploader) {
       uploader.abort();
       if (opts != null && opts.abort) {
         uploader.abort(true);

@aduh95 aduh95 merged commit 9fb5162 into main Feb 21, 2024
20 checks passed
@aduh95 aduh95 deleted the @typescript-eslint/no-non-null-assertion branch February 21, 2024 12:24
Murderlon added a commit that referenced this pull request Feb 22, 2024
* main:
  meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (#4945)
  remove unnecessary `'use strict'` directives (#4943)
  @uppy/companion-client: type changes for provider-views (#4938)
  meta: bump ip from 1.1.8 to 1.1.9 (#4941)
  @uppy/companion-client: update types (#4927)
  Release: uppy@3.22.1 (#4935)
  update vi_VN translation (#4930)
  bump `@transloadit/prettier-bytes` (#4933)
  Release: uppy@3.22.0 (#4929)
  update `UppyFile` objects before emitting events (#4928)
  @uppy/transloadit: add `clientName` option (#4920)
  Fix broken previews after cropping (#4926)
  @uppy/compressor: upgrade compressorjs (#4924)
  Fix companion dns and allow redirects from http->https again (#4895)
  autoOpenFileEditor - rename "Edit file" to "Edit image" (#4925)
  meta: resolve jsx to Preact in shared tsconfig (#4923)
Murderlon added a commit that referenced this pull request Feb 22, 2024
* main:
  MetaEditor + ImageEditor - new state machine logic (#4939)
  meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (#4945)
  remove unnecessary `'use strict'` directives (#4943)
  @uppy/companion-client: type changes for provider-views (#4938)
  meta: bump ip from 1.1.8 to 1.1.9 (#4941)
  @uppy/companion-client: update types (#4927)
  Release: uppy@3.22.1 (#4935)
  update vi_VN translation (#4930)
  bump `@transloadit/prettier-bytes` (#4933)
  Release: uppy@3.22.0 (#4929)
  update `UppyFile` objects before emitting events (#4928)
  @uppy/transloadit: add `clientName` option (#4920)
  Fix broken previews after cropping (#4926)
  @uppy/compressor: upgrade compressorjs (#4924)
  Fix companion dns and allow redirects from http->https again (#4895)
  autoOpenFileEditor - rename "Edit file" to "Edit image" (#4925)
@github-actions github-actions bot mentioned this pull request Feb 22, 2024
github-actions bot added a commit that referenced this pull request Feb 22, 2024
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/audio            |   1.1.7 | @uppy/react            |   3.2.2 |
| @uppy/companion        |  4.12.3 | @uppy/status-bar       |   3.2.8 |
| @uppy/companion-client |   3.7.3 | @uppy/tus              |   3.5.3 |
| @uppy/core             |   3.9.2 | @uppy/utils            |   5.7.3 |
| @uppy/dashboard        |   3.7.4 | @uppy/xhr-upload       |   3.6.3 |
| @uppy/image-editor     |   2.4.3 | uppy                   |  3.22.2 |

- @uppy/core: fix plugin detection (Antoine du Hamel / #4951)
- @uppy/core,@uppy/utils: Introduce `ValidateableFile` & move `MinimalRequiredUppyFile` into utils (Antoine du Hamel / #4944)
- meta: uppy: fix bundle builder (Antoine du Hamel / #4950)
- @uppy/core: improve `UIPluginOptions` types (Merlijn Vos / #4946)
- @uppy/companion-client: fix body/url on upload-success (Merlijn Vos / #4922)
- @uppy/utils: remove EventManager circular reference (Merlijn Vos / #4949)
- @uppy/dashboard: MetaEditor + ImageEditor - new state machine logic (Evgenia Karunus / #4939)
- meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (Antoine du Hamel / #4945)
- @uppy/companion-client: remove unnecessary `'use strict'` directives (Antoine du Hamel / #4943)
- @uppy/companion-client: type changes for provider-views (Antoine du Hamel / #4938)
- meta: bump ip from 1.1.8 to 1.1.9 (dependabot[bot] / #4941)
- @uppy/companion-client: update types (Antoine du Hamel / #4927)
Murderlon added a commit that referenced this pull request Feb 26, 2024
* main:
  @uppy/file-input: refactor to TypeScript (#4954)
  Release: uppy@3.22.2 (#4952)
  @uppy/core: fix plugin detection (#4951)
  Introduce `ValidateableFile` & move `MinimalRequiredUppyFile` into utils (#4944)
  uppy: fix bundle builder (#4950)
  @uppy/core: improve `UIPluginOptions` types (#4946)
  @uppy/companion-client: fix body/url on upload-success (#4922)
  @uppy/utils: remove EventManager circular reference (#4949)
  MetaEditor + ImageEditor - new state machine logic (#4939)
  meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (#4945)
  remove unnecessary `'use strict'` directives (#4943)
  @uppy/companion-client: type changes for provider-views (#4938)
  meta: bump ip from 1.1.8 to 1.1.9 (#4941)
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