Compare commits

...

2 commits

Author SHA1 Message Date
18a162c6d7
Fix remaining eslint errors.
All checks were successful
/ test (push) Successful in 38s
2025-06-28 23:01:14 +02:00
784f527a9e
Add eslint to check the code. 2025-06-28 23:00:55 +02:00
7 changed files with 958 additions and 9 deletions

View file

@ -12,4 +12,5 @@ jobs:
with: with:
cache: "yarn" cache: "yarn"
- run: yarn install - run: yarn install
- run: yarn lint
- run: yarn coverage - run: yarn coverage

23
eslint.config.js Normal file
View file

@ -0,0 +1,23 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import {defineConfig, globalIgnores} from "eslint/config";
export default defineConfig([
globalIgnores([".yarn/**", "coverage/**", "lib/**"]),
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
plugins: {js},
extends: ["js/recommended"],
},
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
languageOptions: {globals: {...globals.browser, ...globals.node}},
},
tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
]);

View file

@ -26,7 +26,8 @@
"build": "tsc && vite build", "build": "tsc && vite build",
"test": "vitest", "test": "vitest",
"coverage": "vitest run --coverage", "coverage": "vitest run --coverage",
"format": "prettier . --write" "format": "prettier . --write",
"lint": "eslint"
}, },
"type": "module", "type": "module",
"source": "src/library.ts", "source": "src/library.ts",
@ -36,11 +37,15 @@
"lib/**/*" "lib/**/*"
], ],
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.30.0",
"@types/node": "^24.0.3", "@types/node": "^24.0.3",
"@vitest/coverage-v8": "^3.2.4", "@vitest/coverage-v8": "^3.2.4",
"eslint": "^9.30.0",
"globals": "^16.2.0",
"prettier": "^3.6.0", "prettier": "^3.6.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.35.0",
"vite": "^6.3.5", "vite": "^6.3.5",
"vite-plugin-dts": "^4.5.4", "vite-plugin-dts": "^4.5.4",
"vitest": "^3.2.4" "vitest": "^3.2.4"

View file

@ -29,6 +29,7 @@ export type SerializedModel<T extends object, Shape extends ModelShape<T>> = {
* This is an experimental serialized model type declaration. * This is an experimental serialized model type declaration.
* @deprecated * @deprecated
*/ */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type ExperimentalSerializedModel< type ExperimentalSerializedModel<
T extends object, T extends object,
Shape extends ModelShape<T>, Shape extends ModelShape<T>,

View file

@ -32,7 +32,10 @@ export abstract class Type<SerializedType, ModelType> {
* Reset the difference between the original value and the current one. * Reset the difference between the original value and the current one.
* @param value Value for which reset diff data. * @param value Value for which reset diff data.
*/ */
resetDiff(value: ModelType | null | undefined): void { resetDiff(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
value: ModelType | null | undefined,
): void {
// By default, nothing to do. // By default, nothing to do.
} }
@ -77,6 +80,7 @@ export abstract class Type<SerializedType, ModelType> {
applyPatch<T extends ModelType>( applyPatch<T extends ModelType>(
currentValue: T | null | undefined, currentValue: T | null | undefined,
patchValue: SerializedType | null | undefined, patchValue: SerializedType | null | undefined,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
updateOriginals: boolean, updateOriginals: boolean,
): T | null | undefined { ): T | null | undefined {
return this.deserialize(patchValue) as T; return this.deserialize(patchValue) as T;

View file

@ -1,9 +1,9 @@
import {ConfigEnv, defineConfig, UserConfig} from "vite"; import {defineConfig, UserConfig} from "vite";
import dts from "vite-plugin-dts"; import dts from "vite-plugin-dts";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig(({mode}: ConfigEnv): UserConfig => { export default defineConfig((): UserConfig => {
return { return {
build: { build: {
outDir: "lib", outDir: "lib",

925
yarn.lock

File diff suppressed because it is too large Load diff