Lutra/ui/eslint.config.js
danny 0a4b80adec
Some checks failed
ci / ci (macos-15) (push) Has been cancelled
ci / ci (ubuntu-24.04) (push) Has been cancelled
ci / ci (windows-2025) (push) Has been cancelled
C2: lutra CLI in the setup with optional PATH entry, xtask bundle prints the version
- xtask bundle builds lutra-cli and adds it as a Tauri external binary
  through a --config override (lutra.exe next to the app on Windows,
  Lutra.app/Contents/MacOS/lutra on macOS); prints path, version, size.
- NSIS: "Add lutra to PATH" page, unticked by default, /ADDTOPATH for
  silent installs. Changes HKCU\Environment Path only, keeps its type,
  broadcasts WM_SETTINGCHANGE, records the entry; the uninstaller removes
  exactly that entry. A PATH too long for NSIS strings is left alone.
- lutra CLI resolves a symlinked executable before looking for the app.
- localStorage: the UI never used webview storage, so there is nothing to
  migrate; docs corrected, ESLint now bans localStorage, sessionStorage
  and indexedDB, with tests.
- docs/install.md: CLI, PATH, macOS link step, webview folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:46:49 +01:00

79 lines
2.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* ESLint flat configuration of the Lutra frontend.
*
* Type-aware TypeScript rules apply to `.ts` and `.vue` files. Floating and
* misused promises are errors so that no rejection goes unhandled, `any`
* is an error, and inline comments are banned in favour of TSDoc blocks.
*
* Templates may not contain bare text: every interface string comes from the
* message catalog (`src/i18n`). The rule's default punctuation allowlist is
* extended by `;`, `…` and `×`.
*
* The webview's storage (`localStorage`, `sessionStorage`, IndexedDB) is
* banned: it is tied to the app identifier and lives outside Lutra's own
* files, so the desktop's data migration cannot carry it over (see
* `apps/lutra-desktop/src/migrate.rs`). Remembered state goes through the
* engine into Lutra's settings and data directories instead.
*/
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
import tseslint from "typescript-eslint";
import vueParser from "vue-eslint-parser";
export default defineConfig(
{ ignores: ["dist/**", "node_modules/**", "coverage/**"] },
js.configs.recommended,
tseslint.configs.strictTypeChecked,
pluginVue.configs["flat/recommended"],
{
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
projectService: true,
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: [".vue"],
},
globals: { ...globals.browser },
},
rules: {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-explicit-any": "error",
"no-inline-comments": "error",
"no-restricted-globals": [
"error",
...["localStorage", "sessionStorage", "indexedDB"].map((name) => ({
name,
message: "Keep state in Lutra's own files through the engine; the webview's storage is not migrated.",
})),
],
"no-restricted-properties": [
"error",
...["window", "globalThis", "self"].flatMap((object) =>
["localStorage", "sessionStorage", "indexedDB"].map((property) => ({
object,
property,
message: "Keep state in Lutra's own files through the engine; the webview's storage is not migrated.",
})),
),
],
"vue/no-bare-strings-in-template": [
"error",
{
allowlist: [
"(", ")", ",", ".", "&", "+", "-", "=", "*", "/", "#", "%", "!", "?", ":", "[", "]",
"{", "}", "<", ">", "|", ";", "·", "•", "‐", "–", "—", "−", "…", "×",
],
},
],
},
},
{
files: ["**/*.js"],
extends: [tseslint.configs.disableTypeChecked],
languageOptions: { globals: { ...globals.node } },
},
);