diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 38e07b3..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -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; diff --git a/biome.json b/biome.json index a8829cb..3ab38fb 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "formatter": { "enabled": true, "formatWithErrors": true, @@ -9,6 +9,9 @@ "lineWidth": 80, "attributePosition": "auto" }, + "files": { + "ignore": ["node_modules"] + }, "organizeImports": { "enabled": true }, "linter": { "enabled": true, diff --git a/bun.lockb b/bun.lockb index 48bbed2..fedca7f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..f43d771 --- /dev/null +++ b/eslint.config.mjs @@ -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"], + }, + }, + }, +); diff --git a/package.json b/package.json index d9ca354..934da9b 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,15 @@ "css": "cpy 'node_modules/@picocss/pico/css/pico.lime.min.css' 'src/public/' --flat", "lint": "run-p 'lint:*'", "lint:tsc": "tsc --noEmit", - "lint:knip": "knip" + "lint:knip": "knip", + "lint:biome": "biome lint --error-on-warnings ./src" }, "dependencies": { "@elysiajs/cookie": "^0.8.0", "@elysiajs/html": "1.0.2", "@elysiajs/jwt": "^1.1.0", "@elysiajs/static": "1.0.3", - "elysia": "^1.1.4" + "elysia": "^1.1.5" }, "module": "src/index.tsx", "type": "module", @@ -24,6 +25,8 @@ }, "devDependencies": { "@biomejs/biome": "1.8.3", + "@eslint/compat": "^1.1.1", + "@eslint/js": "^9.8.0", "@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@kitajs/ts-html-plugin": "^4.0.2", "@picocss/pico": "^2.0.6", @@ -31,20 +34,22 @@ "@types/bun": "^1.1.6", "@types/eslint": "^9.6.0", "@types/node": "^22.1.0", - "@typescript-eslint/eslint-plugin": "^8.0.0", - "@typescript-eslint/parser": "^8.0.0", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/parser": "^8.0.1", "cpy-cli": "^5.0.0", "eslint": "^9.8.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-isaacscript": "^3.12.2", "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-simple-import-sort": "^12.1.1", "knip": "^5.27.0", "npm-run-all": "^4.1.5", "prettier": "^3.3.3", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1" }, - "trustedDependencies": [ - "@biomejs/biome" - ] + "trustedDependencies": ["@biomejs/biome"] } diff --git a/tsconfig.json b/tsconfig.json index 6547452..e88c4a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", + "module": "ESNext", + "target": "ES2021", "moduleResolution": "bundler", "moduleDetection": "force", "allowImportingTsExtensions": true,