Skip to content

Commit

Permalink
chore: migrate eslint and other deps
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 6, 2024
1 parent e791407 commit f231a07
Show file tree
Hide file tree
Showing 19 changed files with 2,099 additions and 1,682 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/highlight.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import * as shiki from 'shiki';
import { JSDOM } from 'jsdom';
import { visit } from 'unist-util-visit';
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"unist-util-visit": "^5.0.0",
"valibot": "^0.28.1",
"vee-validate": "^4.12.6",
"vue": "^3.3.11",
"vue": "^3.4.26",
"yup": "^1.3.2",
"zod": "^3.22.4"
}
Expand Down
53 changes: 53 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import eslint from '@eslint/js';
import globals from "globals";
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
sourceType: 'module',
globals: {
...globals.browser,
}
},
rules: {
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn"
},
},
{
files: ["scripts/**/*"],
languageOptions: {
'sourceType': 'commonjs',
globals: {
...globals.nodeBuiltin
}
},
},
{
files: [ "docs/scripts/**/*", "docs/*.config.js"],
languageOptions: {
'sourceType': 'commonjs',
globals: {
...globals.node
}
},
},
{
ignores: [
"packages/vee-validate/dist/*",
"packages/yup/dist/*",
"packages/zod/dist/*",
"packages/valibot/dist/*",
"packages/joi/dist/*",
"packages/rules/dist/*",
"packages/i18n/dist/*",
"packages/nuxt/dist/*",
]
}
);
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,51 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/js": "^9.2.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-typescript": "^11.1.5",
"@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitest/coverage-v8": "^1.0.4",
"@vue/devtools-api": "^6.5.1",
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.12.8",
"@vitest/coverage-v8": "^1.6.0",
"@vue/devtools-api": "^6.6.1",
"chalk": "^5.3.0",
"eslint": "^8.55.0",
"eslint": "^9.2.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.4.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.4.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"filesize": "^10.1.0",
"filesize": "^10.1.1",
"flush-promises": "^1.0.2",
"fs-extra": "^11.2.0",
"globals": "^15.1.0",
"gzip-size": "^7.0.0",
"husky": "^8.0.3",
"jsdom": "^23.0.1",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"klona": "^2.0.6",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.2",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"raf-stub": "^3.0.0",
"rollup": "^4.9.0",
"rollup": "^4.17.2",
"rollup-plugin-dts": "^6.1.0",
"terser": "^5.26.0",
"terser": "^5.31.0",
"tslint-config-prettier": "^1.18.0",
"type-fest": "^4.8.3",
"typescript": "5.3.3",
"vite-tsconfig-paths": "^4.2.2",
"vitest": "^1.0.4",
"vue": "^3.3.11",
"yup": "^1.3.2"
"typescript-eslint": "^7.8.0",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0",
"vue": "^3.4.26",
"yup": "^1.4.0"
},
"peerDependencies": {
"vue": "^3.3.11"
"vue": "^3.4.26"
},
"lint-staged": {
"*.ts": [
Expand Down
2 changes: 0 additions & 2 deletions packages/rules/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable camelcase */

import alpha from './alpha';
import alpha_dash from './alpha_dash';
import alpha_num from './alpha_num';
Expand Down
1 change: 0 additions & 1 deletion packages/rules/src/one_of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const oneOfValidator = (value: unknown, list: unknown[]): boolean => {
}

return Array.from(list).some(item => {
// eslint-disable-next-line
return item == value;
});
};
Expand Down
1 change: 0 additions & 1 deletion packages/rules/src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const urlValidator = (value: unknown, params: [string | RegExp | undefined] | {
}

try {
// eslint-disable-next-line no-new
new URL(value as string);
} catch {
return false;
Expand Down
1 change: 0 additions & 1 deletion packages/rules/tests/dimensions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ beforeEach(() => {
};
});

// eslint-disable-next-line
test('validates image dimensions', async () => {
let result = await validate(helpers.file('file.jpg', 'image/jpeg', 10), { width: 150, height: 100 });
expect(result).toBe(true);
Expand Down
5 changes: 2 additions & 3 deletions packages/vee-validate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
"dist/*.d.ts"
],
"peerDependencies": {
"vue": "^3.3.11"
},
"vue": "^3.4.26" },
"dependencies": {
"@vue/devtools-api": "^6.5.1",
"@vue/devtools-api": "^6.6.1",
"type-fest": "^4.8.3"
}
}
5 changes: 2 additions & 3 deletions packages/vee-validate/src/types/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ export interface TypedSchema<TInput = any, TOutput = TInput> {
describe?(path?: Path<TInput>): Partial<TypedSchemaPathDescription>;
}

export type InferOutput<TSchema extends TypedSchema> = TSchema extends TypedSchema<any, infer TOutput>
? TOutput
: never;
export type InferOutput<TSchema extends TypedSchema> =
TSchema extends TypedSchema<any, infer TOutput> ? TOutput : never;

export type InferInput<TSchema extends TypedSchema> = TSchema extends TypedSchema<infer TInput, any> ? TInput : never;

Expand Down
40 changes: 21 additions & 19 deletions packages/vee-validate/src/types/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/react-hook-form/react-hook-form/tree/master/src/types/path

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-use-before-define */

type BrowserNativeObject = Date | FileList | File;

type Primitive = null | undefined | string | number | boolean | symbol | bigint;
Expand Down Expand Up @@ -93,15 +93,16 @@ type PathImpl<K extends string | number, V, TraversedTypes> = V extends Primitiv
*
* See {@link Path}
*/
type PathInternal<T, TraversedTypes = T> = T extends ReadonlyArray<infer V>
? IsTuple<T> extends true
? {
[K in TupleKeys<T>]-?: PathImpl<K & string, T[K], TraversedTypes>;
}[TupleKeys<T>]
: PathImpl<ArrayKey, V, TraversedTypes>
: {
[K in keyof T]-?: PathImpl<K & string, T[K], TraversedTypes>;
}[keyof T];
type PathInternal<T, TraversedTypes = T> =
T extends ReadonlyArray<infer V>
? IsTuple<T> extends true
? {
[K in TupleKeys<T>]-?: PathImpl<K & string, T[K], TraversedTypes>;
}[TupleKeys<T>]
: PathImpl<ArrayKey, V, TraversedTypes>
: {
[K in keyof T]-?: PathImpl<K & string, T[K], TraversedTypes>;
}[keyof T];

/**
* Helper type for recursively constructing paths through a type.
Expand Down Expand Up @@ -135,15 +136,16 @@ type ArrayPathImpl<K extends string | number, V, TraversedTypes> = V extends Pri
*
* See {@link ArrayPath}
*/
type ArrayPathInternal<T, TraversedTypes = T> = T extends ReadonlyArray<infer V>
? IsTuple<T> extends true
? {
[K in TupleKeys<T>]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
}[TupleKeys<T>]
: ArrayPathImpl<ArrayKey, V, TraversedTypes>
: {
[K in keyof T]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
}[keyof T];
type ArrayPathInternal<T, TraversedTypes = T> =
T extends ReadonlyArray<infer V>
? IsTuple<T> extends true
? {
[K in TupleKeys<T>]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
}[TupleKeys<T>]
: ArrayPathImpl<ArrayKey, V, TraversedTypes>
: {
[K in keyof T]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
}[keyof T];

/**
* Type which eagerly collects all paths through a type which point to an array
Expand Down
1 change: 0 additions & 1 deletion packages/vee-validate/src/useFieldArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export function useFieldArray<TValue = unknown>(arrayPath: MaybeRefOrGetter<stri
const form = injectWithSelf(FormContextKey, undefined) as PrivateFormContext;
const fields: Ref<FieldEntry<TValue>[]> = ref([]);

// eslint-disable-next-line @typescript-eslint/no-empty-function
const noOp = () => {};
const noOpApi: FieldArrayContext<TValue> = {
fields,
Expand Down
3 changes: 2 additions & 1 deletion packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ let FORM_COUNTER = 0;
const PRIVATE_PATH_STATE_KEYS: (keyof PathState)[] = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];

function resolveInitialValues<TValues extends GenericObject = GenericObject>(opts?: FormOptions<TValues>): TValues {
const providedValues = { ...toValue(opts?.initialValues || {}) };
const givenInitial = opts?.initialValues || {};
const providedValues = { ...toValue(givenInitial) };
const schema = unref(opts?.validationSchema);
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
return deepCopy(schema.cast(providedValues) || {});
Expand Down
6 changes: 3 additions & 3 deletions packages/vee-validate/src/utils/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function isEqual(a: any, b: any) {
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
// eslint-disable-next-line eqeqeq

if (length != b.length) return false;
for (i = length; i-- !== 0; ) if (!isEqual(a[i], b[i])) return false;
return true;
Expand Down Expand Up @@ -151,7 +151,7 @@ export function isEqual(a: any, b: any) {

if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = (a as any).length;
// eslint-disable-next-line eqeqeq

if (length != (b as any).length) return false;
for (i = length; i-- !== 0; ) if ((a as any)[i] !== (b as any)[i]) return false;
return true;
Expand All @@ -175,7 +175,7 @@ export function isEqual(a: any, b: any) {
}

// true if both NaN, false otherwise
// eslint-disable-next-line no-self-compare

return a !== a && b !== b;
}

Expand Down
Loading

0 comments on commit f231a07

Please sign in to comment.