Skip to content

refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions #4907

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

Merged
merged 20 commits into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3dc5bd2
refactor: add treeshake annotation for `State` category
serkodev Jul 22, 2025
f4aee15
refactor: add treeshake annotation for `Elements` category
serkodev Jul 22, 2025
d34b929
refactor: add treeshake annotation for `Browser` category
serkodev Jul 23, 2025
70aaab1
refactor: add treeshake annotation for `Sensors` category
serkodev Jul 23, 2025
90135ee
chore: move `__NO_SIDE_EFFECTS__` into JSDocs
serkodev Jul 24, 2025
4a3917b
refactor: add treeshake annotation for `Animation` category
serkodev Jul 24, 2025
e3349f4
fix: `useVModel` JSDocs position
serkodev Jul 24, 2025
f64bff9
refactor: add treeshake annotation for `Component` category
serkodev Jul 24, 2025
331ba11
refactor: add treeshake annotation for `Reactivity` category
serkodev Jul 24, 2025
81d784e
refactor: add treeshake annotation for `Time` category
serkodev Jul 24, 2025
3cf0213
refactor: add treeshake annotation for `Array` category
serkodev Jul 24, 2025
79e5e4a
refactor: add full JSDocs to function overloads
serkodev Jul 24, 2025
83e0bdf
refactor: add treeshake annotation for lazy getter resolver functions
serkodev Jul 24, 2025
878d00a
refactor: add treeshake annotation for `Utilities` category
serkodev Jul 24, 2025
541af36
refactor: add treeshake annotation for `
serkodev Jul 24, 2025
a7d92d3
refactor: add treeshake annotation for `@Integrations` category
serkodev Jul 24, 2025
04f9b80
fix: update `useClamp` JSDocs position
serkodev Jul 24, 2025
bde435c
refactor: add treeshake annotation for `@Math` category
serkodev Jul 24, 2025
09bb0cf
refactor: add treeshake annotation for `@Router`, `@RxJS` category
serkodev Jul 24, 2025
e9e3936
Merge branch 'main' into refactor/side-effects
serkodev Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: add treeshake annotation for Browser category
  • Loading branch information
serkodev committed Jul 23, 2025
commit d34b92951ec69cd2831a5bdc2bcd482c4f14c850
1 change: 1 addition & 0 deletions packages/core/useBluetooth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface UseBluetoothOptions extends UseBluetoothRequestDeviceOptions, C
acceptAllDevices?: boolean
}

/* #__NO_SIDE_EFFECTS__ */
export function useBluetooth(options?: UseBluetoothOptions): UseBluetoothReturn {
let {
acceptAllDevices = false,
Expand Down
1 change: 1 addition & 0 deletions packages/core/useBrowserLocation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface BrowserLocationState {
*
* @see https://vueuse.org/useBrowserLocation
*/
/* #__NO_SIDE_EFFECTS__ */
export function useBrowserLocation(options: ConfigurableWindow = {}) {
const { window = defaultWindow } = options
const refs = Object.fromEntries(
Expand Down
1 change: 1 addition & 0 deletions packages/core/useEyeDropper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface UseEyeDropperOptions {
*
* @see https://vueuse.org/useEyeDropper
*/
/* #__NO_SIDE_EFFECTS__ */
export function useEyeDropper(options: UseEyeDropperOptions = {}) {
const { initialValue = '' } = options
const isSupported = useSupported(() => typeof window !== 'undefined' && 'EyeDropper' in window)
Expand Down
1 change: 1 addition & 0 deletions packages/core/useGamepad/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function mapGamepadToXbox360Controller(gamepad: Ref<Gamepad | undefined>)
})
}

/* #__NO_SIDE_EFFECTS__ */
export function useGamepad(options: UseGamepadOptions = {}) {
const {
navigator = defaultNavigator,
Expand Down
1 change: 1 addition & 0 deletions packages/core/useMemory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type PerformanceMemory = Performance & {
* @see https://vueuse.org/useMemory
* @param options
*/
/* #__NO_SIDE_EFFECTS__ */
export function useMemory(options: UseMemoryOptions = {}) {
const memory = deepRef<MemoryInfo>()
const isSupported = useSupported(() => typeof performance !== 'undefined' && 'memory' in performance)
Expand Down
1 change: 1 addition & 0 deletions packages/core/usePermission/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function usePermission(
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
options: UsePermissionOptions<true>,
): UsePermissionReturnWithControls
/* #__NO_SIDE_EFFECTS__ */
export function usePermission(
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
options: UsePermissionOptions<boolean> = {},
Expand Down
1 change: 1 addition & 0 deletions packages/core/usePreferredColorScheme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ColorSchemeType = 'dark' | 'light' | 'no-preference'
* @see https://vueuse.org/usePreferredColorScheme
* @param [options]
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredColorScheme(options?: ConfigurableWindow) {
const isLight = useMediaQuery('(prefers-color-scheme: light)', options)
const isDark = useMediaQuery('(prefers-color-scheme: dark)', options)
Expand Down
1 change: 1 addition & 0 deletions packages/core/usePreferredContrast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ContrastType = 'more' | 'less' | 'custom' | 'no-preference'
* @see https://vueuse.org/usePreferredContrast
* @param [options]
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredContrast(options?: ConfigurableWindow) {
const isMore = useMediaQuery('(prefers-contrast: more)', options)
const isLess = useMediaQuery('(prefers-contrast: less)', options)
Expand Down
1 change: 1 addition & 0 deletions packages/core/usePreferredDark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useMediaQuery } from '../useMediaQuery'
* @see https://vueuse.org/usePreferredDark
* @param [options]
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredDark(options?: ConfigurableWindow) {
return useMediaQuery('(prefers-color-scheme: dark)', options)
}
1 change: 1 addition & 0 deletions packages/core/usePreferredLanguages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useEventListener } from '../useEventListener'
* @see https://vueuse.org/usePreferredLanguages
* @param options
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredLanguages(options: ConfigurableWindow = {}): Ref<readonly string[]> {
const { window = defaultWindow } = options
if (!window)
Expand Down
1 change: 1 addition & 0 deletions packages/core/usePreferredReducedMotion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ReducedMotionType = 'reduce' | 'no-preference'
* @see https://vueuse.org/usePreferredReducedMotion
* @param [options]
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredReducedMotion(options?: ConfigurableWindow) {
const isReduced = useMediaQuery('(prefers-reduced-motion: reduce)', options)

Expand Down
1 change: 1 addition & 0 deletions packages/core/usePreferredReducedTransparency/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ReducedTransparencyType = 'reduce' | 'no-preference'
* @see https://vueuse.org/usePreferredReducedTransparency
* @param [options]
*/
/* #__NO_SIDE_EFFECTS__ */
export function usePreferredReducedTransparency(options?: ConfigurableWindow) {
const isReduced = useMediaQuery('(prefers-reduced-transparency: reduce)', options)

Expand Down
1 change: 1 addition & 0 deletions packages/core/useSSRWidth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { hasInjectionContext } from 'vue'

const ssrWidthSymbol = Symbol('vueuse-ssr-width') as InjectionKey<number | null>

/* #__NO_SIDE_EFFECTS__ */
export function useSSRWidth() {
// Avoid injection warning outside of components
const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null
Expand Down
1 change: 1 addition & 0 deletions packages/core/useScreenOrientation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ScreenOrientation extends EventTarget {
*
* @see https://vueuse.org/useScreenOrientation
*/
/* #__NO_SIDE_EFFECTS__ */
export function useScreenOrientation(options: ConfigurableWindow = {}) {
const {
window = defaultWindow,
Expand Down
1 change: 1 addition & 0 deletions packages/core/useTextDirection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface UseTextDirectionOptions extends ConfigurableDocument {
*
* @see https://vueuse.org/useTextDirection
*/
/* #__NO_SIDE_EFFECTS__ */
export function useTextDirection(options: UseTextDirectionOptions = {}) {
const {
document = defaultDocument,
Expand Down
1 change: 1 addition & 0 deletions packages/core/useWakeLock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type UseWakeLockOptions = ConfigurableNavigator & ConfigurableDocument
* @see https://vueuse.org/useWakeLock
* @param options
*/
/* #__NO_SIDE_EFFECTS__ */
export function useWakeLock(options: UseWakeLockOptions = {}) {
const {
navigator = defaultNavigator,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy