Files
faunosteo/apps/app/eslint.config.js
T
bchanot 6371523f8c fix(editor): honest stopped state when the draft is unsaved; no dead retry
0279953 chose the stopped message from CoreRuntime.stopped alone: it
promised the report was kept even when the tab's storage refused the
draft (export, the banner's advice, needs the core), four surfaces still
offered a retry that could not work, and a failed recovery below the cap
was a dead end since nothing called retry().

The runtime restarts a failed recovery on the next call (compiled module
reused, cap still counts traps) and notifies status listeners. One
CoreStoppedNotice on the editor, Home, New report and the full-page
notice: reload when saved, else core.stopped_unsaved with a core-free
copy download (also on the storage-full banner) and a beforeunload
guard. Export, import and new report say the stopped message; a core
failure reading an unread draft is FAILED, not held. ESLint census of
the failure keys; core.stopped says "plusieurs erreurs".
2026-10-16 18:26:10 +02:00

101 lines
2.9 KiB
JavaScript

import globals from 'globals'
import tseslint from 'typescript-eslint'
import pluginReact from 'eslint-plugin-react'
import pluginReactHooks from 'eslint-plugin-react-hooks'
/**
* Census of the call sites of the keys that must go through `coreFailureMessage`: once the
* engine stopped, a direct `t('<key>')` would tell the practitioner to retry (owner
* decision 2026-10-15). Dictionaries and key strings passed as arguments are not call sites.
*/
const failureKeySelector = (key) => ({
selector: `CallExpression[callee.name='t'][arguments.0.value='${key}']`,
message: `Use coreFailureMessage(t, '${key}') (src/core/failure.ts), not a direct t() call.`,
})
const FAILURE_KEYS = [
'core.action_failed',
'editor.export_failed',
'home.import.error_core_unavailable',
]
export default tseslint.config(
{ ignores: ['dist/**', 'node_modules/**', 'coverage/**'] },
{
files: ['**/*.{ts,tsx}'],
extends: [
...tseslint.configs.recommended,
],
plugins: {
react: pluginReact,
'react-hooks': pluginReactHooks,
},
languageOptions: {
globals: {
...globals.browser,
...globals.es2022,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
settings: {
react: { version: 'detect' },
},
rules: {
...pluginReact.configs.recommended.rules,
...pluginReactHooks.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
},
},
{
// R2: the application's rules run in the Rust core; its contracts come from
// @faunosteo/core-wasm. The TypeScript domain stays frozen for the PDF engine, the
// pipeline and scripts/ until R4/R5 (RUST_ARCHITECTURE_REVIEW VI.4).
files: ['src/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@faunosteo/domain',
message: 'Use @faunosteo/core-wasm (types) and the core operations.',
},
],
patterns: ['@faunosteo/domain/*'],
},
],
},
},
{
files: ['src/**/*.{ts,tsx}'],
ignores: [
'src/core/failure.ts',
'src/components/report/CoreUnavailable.tsx',
'src/components/canvas/AnatomyCanvas.tsx',
],
rules: {
'no-restricted-syntax': [
'error',
...[...FAILURE_KEYS, 'sheet.core_unavailable'].map(failureKeySelector),
],
},
},
{
// These two own the degraded engine notice, which names `sheet.core_unavailable`.
files: [
'src/components/report/CoreUnavailable.tsx',
'src/components/canvas/AnatomyCanvas.tsx',
],
rules: {
'no-restricted-syntax': ['error', ...FAILURE_KEYS.map(failureKeySelector)],
},
},
)