Add eslint to check the code.

This commit is contained in:
Madeorsk 2025-06-28 23:00:55 +02:00
parent a4c1c88138
commit 784f527a9e
Signed by: Madeorsk
GPG key ID: 677E51CA765BB79F
4 changed files with 950 additions and 6 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"

925
yarn.lock

File diff suppressed because it is too large Load diff