Skip to content

Commit

Permalink
chore: fixed eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarciaesgi committed Nov 11, 2024
1 parent ef73f3b commit 68f0468
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import prettierPlugin from 'eslint-config-prettier';
import ts from 'typescript-eslint';

export default [
...ts.configs.recommended,
ts.configs.base,
...eslintPluginVue.configs['flat/recommended'],
{
files: ['**/*.ts', '*.vue', '**/*.vue'],
Expand All @@ -12,7 +12,7 @@ export default [
parser: '@typescript-eslint/parser',
},
},
ignores: ['dist', 'node_modules'],
ignores: ['**/*.js', '**/*.d.ts', 'dist', 'node_modules'],
rules: {
semi: 'off',
'prefer-const': 'off',
Expand All @@ -24,7 +24,7 @@ export default [
'import/named': 'off',
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-vars': ['off'],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
'@typescript-eslint/no-explicit-any': 'off',
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"description": "Typescript first model-based validation library for Vue 3",
"scripts": {
"lint": "eslint --ext .ts --ext .vue .",
"lint:fix": "eslint --ext .ts --ext .vue . --fix",
"lint": "eslint packages/**",
"lint:fix": "eslint packages/** --fix",
"typecheck": "pnpm run -r --parallel --filter='@regle/*' typecheck",
"build": "pnpm run -r --filter='@regle/*' build",
"build:local": "pnpm run -r --filter='@regle/*' build:local",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/core/defineRegleConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { AllRulesDeclarations, RegleBehaviourOptions } from '../types';
import { createUseRegleComposable } from './useRegle';
import type { Ref, ComputedRef } from 'vue';

/**
* Root function that allows you to define project-wise all your custom validators or overwrite default ones
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line vue/prefer-import-from-vue
import { pauseTracking, resetTracking } from '@vue/reactivity';
import type { RequiredDeep } from 'type-fest';
import type { ComputedRef, Ref } from 'vue';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types/rules/rule.errors.types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ArrayElement, ExtractFromGetter, NonPresentKeys } from '../utils';
import type { ArrayElement, ExtractFromGetter, NonPresentKeys } from '../utils';
import type {
RegleFormPropertyType,
ReglePartialValidationTree,
RegleRuleDecl,
} from './rule.declaration.types';
import { RegleCollectionRuleDefinition } from './rule.definition.type';
import type { RegleCollectionRuleDefinition } from './rule.definition.type';

export type RegleErrorTree<
TRules extends ReglePartialValidationTree<any, any>,
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/utils/object.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Ref } from 'vue';
import { MaybeGetter } from '../types';
import type { MaybeGetter } from '../types';

export function isObject(obj: unknown): obj is Record<string, any> {
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
Expand All @@ -13,7 +13,7 @@ export function cloneDeep(obj: { [x: string]: any }): {
[x: string]: any;
} {
let result = obj;
var type = {}.toString.call(obj).slice(8, -1);
let type = {}.toString.call(obj).slice(8, -1);
if (type == 'Set') {
return new Set([...(obj as any)].map((value) => cloneDeep(value)));
}
Expand All @@ -28,7 +28,7 @@ export function cloneDeep(obj: { [x: string]: any }): {
}
if (type == 'Array' || type == 'Object') {
result = Array.isArray(obj) ? [] : {};
for (var key in obj) {
for (let key in obj) {
// include prototype properties
result[key] = cloneDeep(obj[key]);
}
Expand All @@ -41,7 +41,7 @@ function getRegExpFlags(regExp: any) {
if (typeof regExp.source.flags == 'string') {
return regExp.source.flags;
} else {
var flags = [];
let flags = [];
regExp.global && flags.push('g');
regExp.ignoreCase && flags.push('i');
regExp.multiline && flags.push('m');
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/helpers/tests/and.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegleRuleDefinition } from '@regle/core';
import type { RegleRuleDefinition } from '@regle/core';
import { timeout } from '../../../../../tests/utils';
import { email, minLength, required } from '../../validators';
import { and } from '../and';
Expand Down
3 changes: 2 additions & 1 deletion packages/validators/src/helpers/tests/applyIf.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RegleRuleDefinition, useRegle } from '@regle/core';
import type { RegleRuleDefinition} from '@regle/core';
import { useRegle } from '@regle/core';
import { flushPromises, mount } from '@vue/test-utils';
import { defineComponent, ref } from 'vue';
import { timeout } from '../../../../../tests/utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/helpers/tests/not.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegleRuleDefinition } from '@regle/core';
import type { RegleRuleDefinition } from '@regle/core';
import { minLength, required } from '../../validators';
import { not } from '../not';

Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/helpers/tests/or.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegleRuleDefinition } from '@regle/core';
import type { RegleRuleDefinition } from '@regle/core';
import { timeout } from '../../../../../tests/utils';
import { email, minLength, required } from '../../validators';
import { or } from '../or';
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/helpers/tests/withAsync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('withAsync helper', () => {
const mountComponent = () => {
return mount(
defineComponent({
template: '<div>{{regle}}</div>',
setup() {
const form = ref({
email: '',
Expand All @@ -34,6 +33,7 @@ describe('withAsync helper', () => {

return { form, errors, validateForm, regle };
},
template: '<div>{{regle}}</div>',
})
);
};
Expand Down
3 changes: 2 additions & 1 deletion packages/validators/src/helpers/tests/withMessage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RegleRuleDefinition, useRegle } from '@regle/core';
import type { RegleRuleDefinition} from '@regle/core';
import { useRegle } from '@regle/core';
import { flushPromises, mount } from '@vue/test-utils';
import { Ref, defineComponent, ref } from 'vue';
import { and } from '../../helpers/and';
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/core/useZodForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useZodForm<
state: Ref<TState> | DeepReactiveState<TState>,
schema: MaybeRef<TZodSchema>,
options?: Partial<DeepMaybeRef<RegleBehaviourOptions>> &
LocalRegleBehaviourOptions<TState, {}, TExternal, never>
LocalRegleBehaviourOptions<TState, object, TExternal, never>
): ZodRegle<TState, TZodSchema> {
const rules = ref<ReglePartialValidationTree<any, any>>({});

Expand Down

0 comments on commit 68f0468

Please sign in to comment.