Files
faunosteo/apps/app/eslint.config.js
bchanot 1b359598ab chore(workspace): R5.7 delete packages/anatomy and packages/domain
The TS pipeline, domain, upload script and legacy scripts leave; xmldom out of the
lockfile, Dockerfile copies trimmed. LEDGER.tsv (407 cases) and FILES.tsv (112 files)
record each disposition; r4 and r5 census tests guard the tree, lockfile and
production imports.
2026-10-25 04:00:07 +01:00

110 lines
3.3 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 left the application at R4.8 and
// the repository at R5.7 with the pipeline package and its xmldom
// (RUST_ARCHITECTURE_REVIEW VI.4). The rule keeps the door closed.
files: ['src/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@faunosteo/domain',
message: 'Use @faunosteo/core-wasm (types) and the core operations.',
},
{
name: '@faunosteo/anatomy',
message: 'The SVG layer and composition are the core operations.',
},
{
name: '@xmldom/xmldom',
message: 'Every SVG goes through the core reader (anatomy::svg).',
},
],
patterns: ['@faunosteo/domain/*', '@faunosteo/anatomy/*'],
},
],
},
},
{
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)],
},
},
)