Skip to content

Commit

Permalink
chore: cleanup codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarciaesgi committed Dec 9, 2024
1 parent 7d4a949 commit 3af232e
Show file tree
Hide file tree
Showing 40 changed files with 96 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type {
} from '../../../types';
import {
cloneDeep,
isEmpty,
isObject,
randomId,
resetArrayValuesRecursively,
Expand All @@ -30,6 +29,7 @@ import type { RegleStorage } from '../../useStorage';
import { isNestedRulesStatus, isRuleDef } from '../guards';
import { createReactiveFieldStatus } from './createReactiveFieldStatus';
import { createReactiveChildrenStatus } from './createReactiveNestedStatus';
import { isEmpty } from '../../../../../shared';

type StateWithId = unknown & { $id?: string };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import type {
RegleShortcutDefinition,
ResolvedRegleBehaviourOptions,
} from '../../../types';
import { debounce, isEmpty, isVueSuperiorOrEqualTo3dotFive, resetFieldValue } from '../../../utils';
import { debounce, isVueSuperiorOrEqualTo3dotFive, resetFieldValue } from '../../../utils';
import type { RegleStorage } from '../../useStorage';
import { extractRulesErrors } from '../useErrors';
import { createReactiveRuleStatus } from './createReactiveRuleStatus';
import { isEmpty } from '../../../../../shared';

interface CreateReactiveFieldStatusArgs {
state: Ref<unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ import type {
ResolvedRegleBehaviourOptions,
} from '../../../types';
import { mergeArrayGroupProperties, mergeBooleanGroupProperties } from '../../../types';
import { isEmpty, isObject, isRefObject, resetValuesRecursively } from '../../../utils';
import { isObject, isRefObject, resetValuesRecursively } from '../../../utils';
import type { RegleStorage } from '../../useStorage';
import { isCollectionRulesDef, isNestedRulesDef, isValidatorRulesDef } from '../guards';
import { createReactiveCollectionStatus } from './createReactiveCollectionStatus';
import { createReactiveFieldStatus } from './createReactiveFieldStatus';
import { isEmpty } from '../../../../../shared';

interface CreateReactiveNestedStatus {
rootRules?: Ref<$InternalReglePartialRuleTree>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import type {
RegleRuleDefinitionProcessor,
RegleRuleMetadataDefinition,
} from '../../../types';
import { debounce, isEmpty } from '../../../utils';
import { debounce } from '../../../utils';
import { unwrapRuleParameters } from '../../createRule/unwrapRuleParameters';
import type { RegleStorage } from '../../useStorage';
import { isFormRuleDefinition, isRuleDef } from '../guards';
import { isEmpty } from '../../../../../shared';

interface CreateReactiveRuleStatusOptions {
state: Ref<unknown>;
Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/utils/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
interface DebouncedFunction<T extends (...args: any[]) => any | Promise<any>> {
(...args: Parameters<T>): Promise<ReturnType<T> extends Promise<infer U> ? U : ReturnType<T>>;
cancel(): void;
doImmediately(...args: unknown[]): Promise<unknown>;
}

export function debounce<T extends (...args: any[]) => any | Promise<any>>(
Expand Down Expand Up @@ -30,14 +29,5 @@ export function debounce<T extends (...args: any[]) => any | Promise<any>>(
timeout = undefined;
};

debouncedFn.doImmediately = (...args) =>
new Promise((resolve) => {
clearTimeout(timeout);
timeout = setTimeout(() => {
timeout = undefined;
Promise.resolve(func.apply(this, [...args] as any)).then(resolve);
}, 0);
});

return debouncedFn;
}
1 change: 0 additions & 1 deletion packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './object.utils';
export * from './isEmpty';
export * from './debounce';
export * from './version-compare';
export * from './randomId';
20 changes: 0 additions & 20 deletions packages/core/src/utils/isEmpty.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/examples/simple/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/examples/simple/.vscode/extensions.json

This file was deleted.

5 changes: 0 additions & 5 deletions packages/examples/simple/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions packages/examples/simple/index.html

This file was deleted.

24 changes: 0 additions & 24 deletions packages/examples/simple/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions packages/examples/simple/postcss.config.js

This file was deleted.

22 changes: 0 additions & 22 deletions packages/examples/simple/public/favicon.svg

This file was deleted.

125 changes: 0 additions & 125 deletions packages/examples/simple/src/App.vue

This file was deleted.

11 changes: 0 additions & 11 deletions packages/examples/simple/src/components/FieldError.vue

This file was deleted.

5 changes: 0 additions & 5 deletions packages/examples/simple/src/main.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/examples/simple/src/style.css

This file was deleted.

8 changes: 0 additions & 8 deletions packages/examples/simple/tailwind.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/examples/simple/vite.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/rules/src/helpers/ruleHelpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { isEmpty } from './isEmpty';
import { isFilled } from './isFilled';
import { isNumber } from './isNumber';
import { regex } from './regex';
import { size } from './size';
import { isDate } from './isDate';
import { toDate } from './toDate';
import { toNumber } from './toNumber';
import { isEmpty } from '../../../../shared';

export const ruleHelpers = {
isEmpty,
Expand Down
2 changes: 1 addition & 1 deletion packages/rules/src/helpers/ruleHelpers/isDate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from './isEmpty';
import { isEmpty } from '../../../../shared';

export function isDate(value: unknown): value is Date {
if (isEmpty(value)) {
Expand Down
Loading

0 comments on commit 3af232e

Please sign in to comment.