import js from "@eslint/js"; import globals from "globals"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; import htmlEslint from "@html-eslint/eslint-plugin"; import htmlParser from "@html-eslint/parser"; import customRules from "./eslint-rules/index.js"; export default tseslint.config( { ignores: [ "dist", // Build output & native shells — generated, not our source. "android", "ios", // Skill templates carried along in the repo; they target a different // ESLint ruleset (react-hooks/set-state-in-effect, purity) not installed // here, and are never bundled into the app. ".agents", // Standalone Bun server — type-checked by its own tsconfig (see the // `typecheck:cvm` script, wired into `npm test`), not by the web ESLint // config (it leans on `any` and has no React rules). "cvm-server", // Standalone Bun AI proxy — same deal: own tsconfig (`typecheck:ai`). "ai-proxy", // Standalone Bun push service — own tsconfig (`typecheck:push`). "push-service", // Local Capacitor plugins (Kotlin + a TS bridge built only for the shell). "packages", // Static utility HTML (icon generators, sticker sheets, QR pages) that // are intentionally minimal and don't need app-level meta/OG tags. "public/**/*.html", "scripts", ], }, { extends: [js.configs.recommended, ...tseslint.configs.recommended], files: ["**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, linterOptions: { reportUnusedDisableDirectives: "error", // Reports unused disable directives as errors }, plugins: { "react-hooks": reactHooks, "react-refresh": reactRefresh, "custom": customRules, }, rules: { ...reactHooks.configs.recommended.rules, "react-refresh/only-export-components": [ "warn", { allowConstantExport: true }, ], // Explicit `any` is discouraged but not a runtime bug (tsconfig already // has noImplicitAny:false). Warn instead of failing the release build. "@typescript-eslint/no-explicit-any": "warn", // Unused vars/imports are code-cleanliness issues, not runtime bugs // (tsc catches the bug-causing undefined references). Keep them visible // as warnings so they don't block a release build, but still surface. "@typescript-eslint/no-unused-vars": [ "warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "ignoreRestSiblings": true, }, ], "custom/no-placeholder-comments": "error", "no-warning-comments": [ "error", { terms: ["fixme"] }, ], }, }, { files: ["**/*.html"], plugins: { "@html-eslint": htmlEslint, "custom": customRules, }, languageOptions: { parser: htmlParser, }, rules: { "@html-eslint/require-title": "error", "@html-eslint/require-meta-charset": "error", "@html-eslint/require-meta-description": "error", "@html-eslint/require-meta-viewport": "error", "@html-eslint/require-open-graph-protocol": [ "error", [ "og:type", "og:title", "og:description", ], ], "custom/no-inline-script": "error", "custom/require-webmanifest": "error", }, } );