refactor: Code cleanup for storage package#2085
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| } | ||
| const migrate = async () => { | ||
|
|
||
| const migrate: WxtStorageItem<any, any>['migrate'] = async () => { |
There was a problem hiding this comment.
TS performance change, fully typing the function instead of having to look at the implementation.
| if (debug === true) { | ||
| if (debug) { |
There was a problem hiding this comment.
Unnecessarily strict check
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
| throw Error(`'wxt/storage' must be loaded in a web extension environment | ||
|
|
||
| - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371 | ||
| - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing.html | ||
| `); |
There was a problem hiding this comment.
No need to join an array, just define the string in a readable way.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2085 +/- ##
==========================================
- Coverage 76.03% 75.93% -0.10%
==========================================
Files 113 113
Lines 3050 3050
Branches 686 686
==========================================
- Hits 2319 2316 -3
- Misses 648 650 +2
- Partials 83 84 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if (change == null) return; | ||
| if (dequal(change.newValue, change.oldValue)) return; | ||
|
|
||
| if (change == null || dequal(change.newValue, change.oldValue)) return; |
There was a problem hiding this comment.
Combined to a single statement.
Co-Authored-By: Patryk Kuniczak <p.kuniczak@gmail.com>
|
Thanks for helping make WXT better! |
Overview
Broken out of #2081.
The storage code was originally very small and I tried to keep it small as it grew... So this PR adds a lot of whitespace I would normally add back to the code.
Manual Testing
CI passes