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 Array category
  • Loading branch information
serkodev committed Jul 24, 2025
commit 3cf0213f43ac6ca3e477dfe891ccdd327af41f55
2 changes: 2 additions & 0 deletions packages/shared/useArrayDifference/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export function useArrayDifference<T>(
* @see https://vueuse.org/useArrayDifference
* @returns - the difference of two array
* @param args
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayDifference<T>(...args: any[]): UseArrayDifferenceReturn<T> {
const list: MaybeRefOrGetter<T[]> = args[0]
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayEvery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayEveryReturn = ComputedRef<boolean>
* @param fn - a function to test each element.
*
* @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayEvery<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/useArrayFilter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayFilterReturn<T = any> = ComputedRef<T[]>
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
*
* @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayFilter<T, S extends T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand All @@ -20,6 +22,7 @@ export function useArrayFilter<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
fn: (element: T, index: number, array: T[]) => unknown,
): UseArrayFilterReturn<T>
/* @__NO_SIDE_EFFECTS__ */
export function useArrayFilter<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
fn: (element: T, index: number, array: T[]) => unknown,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayFind/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>
* @param fn - a function to test each element.
*
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayFind<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayFindIndex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayFindIndexReturn = ComputedRef<number>
* @param fn - a function to test each element.
*
* @returns the index of the first element in the array that passes the test. Otherwise, "-1".
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayFindIndex<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayFindLast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>
* @param fn - a function to test each element.
*
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayFindLast<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/useArrayIncludes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export type UseArrayIncludesReturn = ComputedRef<boolean>
* @see https://vueuse.org/useArrayIncludes
*
* @returns true if the `value` is found in the array. Otherwise, false.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayIncludes<T, V = any>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand All @@ -37,6 +39,7 @@ export function useArrayIncludes<T, V = any>(
value: MaybeRefOrGetter<V>,
options?: UseArrayIncludesOptions<T, V>,
): UseArrayIncludesReturn
/* @__NO_SIDE_EFFECTS__ */
export function useArrayIncludes<T, V = any>(
...args: any[]
): UseArrayIncludesReturn {
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayJoin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayJoinReturn = ComputedRef<string>
* @param separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
*
* @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayJoin(
list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayMap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayMapReturn<T = any> = ComputedRef<T[]>
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
*
* @returns a new array with each element being the result of the callback function.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayMap<T, U = T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
6 changes: 6 additions & 0 deletions packages/shared/useArrayReduce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, c
* @param reducer - a "reducer" function.
*
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayReduce<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand All @@ -26,6 +28,8 @@ export function useArrayReduce<T>(
* @param initialValue - a value to be initialized the first time when the callback is called.
*
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayReduce<T, U>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand All @@ -42,6 +46,8 @@ export function useArrayReduce<T, U>(
* @param args
*
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayReduce<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArraySome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UseArraySomeReturn = ComputedRef<boolean>
* @param fn - a function to test each element.
*
* @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArraySome<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useArrayUnique/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>
* @param list - the array was called upon.
* @param compareFn
* @returns A computed ref that returns a unique array of items.
*
* @__NO_SIDE_EFFECTS__
*/
export function useArrayUnique<T>(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
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