TypeScript 7.0 is the native compiler and ships no JavaScript API, which typescript-eslint still needs. Install both, as Microsoft documents it: - "@typescript/native": "npm:typescript@^7.0.2" gives `tsc` = 7.0 - "typescript": "npm:@typescript/typescript6@^6.0.2" gives the 6.0 API that typescript-eslint loads (its peer range stops below 6.1), and `tsc6` CI fails if `tsc` ever resolves to TypeScript 6 (@typescript/old, pulled in by the 6.0 package, ships a `tsc` too). tsconfig.json (src): - target ES2025: the newest year TypeScript 7.0, esbuild and Vite all know - lib ES2022 + DOM: the browser floor (Vite's baseline-widely-available, Chrome 111 / Safari 16.4 / Firefox 114), because nothing polyfills - baseUrl removed (gone in 7.0; paths were already relative), DOM.Iterable dropped (merged into DOM), `types: []` spelled out, erasableSyntaxOnly and verbatimModuleSyntax on (both clean) tsconfig.check.json: lib ES2025 for tests, scripts, worker and build plugins. Platform floor: the Tauri build no longer lowers to es2020; it shares the web build's baseline (the stylesheet already needed Chromium 99+ / Safari 15.4+). macOS minimumSystemVersion is 11.0 (the build is arm64). Also: eslint.config.js uses ESLint's defineConfig (tseslint.config is deprecated); THIRD_PARTY_NOTICES names the real package behind an npm alias, sorted with a shared code-unit comparator (src/utils/sort.ts); Dependabot groups typescript + @typescript/*; a test's typed-array annotation follows TypeScript 7's lib.dom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.1 KiB
JavaScript
52 lines
2.1 KiB
JavaScript
import js from "@eslint/js";
|
|
import { defineConfig } from "eslint/config";
|
|
import tseslint from "typescript-eslint";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
|
|
export default defineConfig(
|
|
js.configs.recommended,
|
|
...tseslint.configs.strict,
|
|
{
|
|
plugins: {
|
|
"react-hooks": reactHooks,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
|
|
// eslint-plugin-react-hooks 7 turned on the React Compiler diagnostics.
|
|
// They are worth having — four of the seven they flagged on arrival were
|
|
// real extra render passes and were fixed (use-online-status moved to
|
|
// `useSyncExternalStore`, ShortcutHelpModal now derives instead of
|
|
// resetting in an effect, DraftIndicator and use-languages-ready were
|
|
// guarded).
|
|
//
|
|
// Three remain, all genuinely syncing state FROM an external source:
|
|
// src/hooks/use-languages-ready.ts — i18next bundle readiness
|
|
// src/components/editor/PlaytestEditor.tsx — text mirror of a store number
|
|
// src/components/editor/StoreLinkEditor.tsx — compiler can't preserve a useMemo
|
|
//
|
|
// Each needs a real restructure, not a guard, so they are warnings rather
|
|
// than a reason to hold back the ESLint 10 upgrade or to delete the rule.
|
|
// Downgrade — do not remove: the signal is the point.
|
|
"react-hooks/set-state-in-effect": "warn",
|
|
"react-hooks/preserve-manual-memoization": "warn",
|
|
},
|
|
},
|
|
{
|
|
// Tests index into fixture arrays constantly, and `noUncheckedIndexedAccess`
|
|
// makes every one of those reads `T | undefined`. A `!` there asserts the
|
|
// fixture the test itself just built — the alternative is a guard clause per
|
|
// lookup that can only ever fail if the test is already broken. Production
|
|
// code keeps the rule.
|
|
files: ["tests/**/*.ts", "tests/**/*.tsx"],
|
|
rules: {
|
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
},
|
|
},
|
|
{
|
|
ignores: ["dist/", "node_modules/", "*.config.*"],
|
|
},
|
|
);
|