chore: Update eslint configuration and dependencies

This commit is contained in:
C4illin 2024-08-05 21:25:35 +02:00
parent 1e9bde18c7
commit 3f79ccaa2a
6 changed files with 55 additions and 57 deletions

View file

@ -1,46 +0,0 @@
/** @type {import("eslint").Linter.Config} */
const config = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["isaacscript", "import"],
extends: [
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
overrides: [
// Template files don't have reliable type information
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
},
],
rules: {
// These off/not-configured-the-way-we-want lint rules we like & opt into
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
// For educational purposes we format our comments/jsdoc nicely
"isaacscript/complete-sentences-jsdoc": "warn",
"isaacscript/format-jsdoc-comments": "warn",
// These lint rules don't make sense for us but are enabled in the preset configs
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/restrict-template-expressions": "off",
},
};
module.exports = config;

View file

@ -1,5 +1,5 @@
{ {
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"formatter": { "formatter": {
"enabled": true, "enabled": true,
"formatWithErrors": true, "formatWithErrors": true,
@ -9,6 +9,9 @@
"lineWidth": 80, "lineWidth": 80,
"attributePosition": "auto" "attributePosition": "auto"
}, },
"files": {
"ignore": ["node_modules"]
},
"organizeImports": { "enabled": true }, "organizeImports": { "enabled": true },
"linter": { "linter": {
"enabled": true, "enabled": true,

BIN
bun.lockb

Binary file not shown.

36
eslint.config.mjs Normal file
View file

@ -0,0 +1,36 @@
import { fixupPluginRules } from "@eslint/compat";
import tseslint from "typescript-eslint";
import eslint from "@eslint/js";
import deprecationPlugin from "eslint-plugin-deprecation";
import eslintCommentsPlugin from "eslint-plugin-eslint-comments";
import importPlugin from "eslint-plugin-import";
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
export default tseslint.config(
{
plugins: {
"@typescript-eslint": tseslint.plugin,
deprecation: fixupPluginRules(deprecationPlugin),
"eslint-comments": eslintCommentsPlugin,
import: fixupPluginRules(importPlugin),
"simple-import-sort": simpleImportSortPlugin,
},
},
{
ignores: ["**/node_modules/**", "**/public/**"],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json"],
},
},
},
);

View file

@ -8,14 +8,15 @@
"css": "cpy 'node_modules/@picocss/pico/css/pico.lime.min.css' 'src/public/' --flat", "css": "cpy 'node_modules/@picocss/pico/css/pico.lime.min.css' 'src/public/' --flat",
"lint": "run-p 'lint:*'", "lint": "run-p 'lint:*'",
"lint:tsc": "tsc --noEmit", "lint:tsc": "tsc --noEmit",
"lint:knip": "knip" "lint:knip": "knip",
"lint:biome": "biome lint --error-on-warnings ./src"
}, },
"dependencies": { "dependencies": {
"@elysiajs/cookie": "^0.8.0", "@elysiajs/cookie": "^0.8.0",
"@elysiajs/html": "1.0.2", "@elysiajs/html": "1.0.2",
"@elysiajs/jwt": "^1.1.0", "@elysiajs/jwt": "^1.1.0",
"@elysiajs/static": "1.0.3", "@elysiajs/static": "1.0.3",
"elysia": "^1.1.4" "elysia": "^1.1.5"
}, },
"module": "src/index.tsx", "module": "src/index.tsx",
"type": "module", "type": "module",
@ -24,6 +25,8 @@
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "1.8.3", "@biomejs/biome": "1.8.3",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.8.0",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@kitajs/ts-html-plugin": "^4.0.2", "@kitajs/ts-html-plugin": "^4.0.2",
"@picocss/pico": "^2.0.6", "@picocss/pico": "^2.0.6",
@ -31,20 +34,22 @@
"@types/bun": "^1.1.6", "@types/bun": "^1.1.6",
"@types/eslint": "^9.6.0", "@types/eslint": "^9.6.0",
"@types/node": "^22.1.0", "@types/node": "^22.1.0",
"@typescript-eslint/eslint-plugin": "^8.0.0", "@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.0", "@typescript-eslint/parser": "^8.0.1",
"cpy-cli": "^5.0.0", "cpy-cli": "^5.0.0",
"eslint": "^9.8.0", "eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-isaacscript": "^3.12.2", "eslint-plugin-isaacscript": "^3.12.2",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"knip": "^5.27.0", "knip": "^5.27.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"typescript": "^5.5.4" "typescript": "^5.5.4",
"typescript-eslint": "^8.0.1"
}, },
"trustedDependencies": [ "trustedDependencies": ["@biomejs/biome"]
"@biomejs/biome"
]
} }

View file

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["ESNext"], "lib": ["ESNext"],
"module": "esnext", "module": "ESNext",
"target": "esnext", "target": "ES2021",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"moduleDetection": "force", "moduleDetection": "force",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,