- setup wizard (src/pages/setup): welcome (pick the language: the wizard switches at once), the owner's account, the venue (kind, name, staff language, time zone), an optional lock-screen PIN, finish -> sign in; English and Greek - shell (src/shell): AppLayout (license banner in both languages, header, lock button, idle lock / sign-out), Sidebar on a new 'nav' token set in @xenia/ui (light + dark), ProfileDialog (name, username, password, 4-6 digit PIN), licenseContext; App.jsx loads the session and the setup state with react-query (no setState in effects); the header's dead search box gone - Management -> Tables -> List (src/pages/tables, was TablesConfigTab): zones as tabs (drag to reorder), zone name / prefix / colour, add many numbered on, a table's name (6 chars) / zone / seats, twice-used names flagged, off / on / delete, pick several to move, rename in a series or delete (says how many failed) - the old src/ui kit, layouts/, components/Sidebar + EditProfileModal, the 'primary' palette and the .btn/.card/.input classes deleted; NotificationBell / UserMenuButton on tokens; @xenia/ui: nav tokens, 'scrim' in the Tailwind preset - v2.json paths = src (the guards cover all of it); npm run lint = eslint src; argsIgnorePattern for components in JSX - tests: shell.test.mjs (3), e2e setup.mjs (new: a fresh install through the wizard in Greek to the overview, in run-all), manager.mjs 'tables list' (zone, 3 tables, rename series, profile PIN, rail tokens) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
// ESLint for the manager (plan step 2.99b): the waiter's rules (React Hooks 7, react-refresh).
|
|
// `npm run lint` (scripts/lint.mjs) checks the code on the v2 rules: v2.json `paths`. Older pages
|
|
// break these rules in places (e.g. setState in effects); phase 6 adds each page to v2.json as
|
|
// it converts it. The `strict` paths load data with useLiveQuery / react-query, so setState in
|
|
// an effect is an error there (6.1). `npx eslint src` shows everything.
|
|
import { readFileSync } from 'node:fs'
|
|
import js from '@eslint/js'
|
|
import globals from 'globals'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
|
|
const v2 = JSON.parse(readFileSync(new URL('./v2.json', import.meta.url), 'utf8'))
|
|
const strict = v2.strict.map(p => (/\.[jt]sx?$/.test(p) ? p : `${p}/**/*.{js,jsx}`))
|
|
|
|
export default defineConfig([
|
|
globalIgnores(['dist', 'dev-dist']),
|
|
{
|
|
files: ['**/*.{js,jsx}'],
|
|
extends: [
|
|
js.configs.recommended,
|
|
reactHooks.configs.flat.recommended,
|
|
reactRefresh.configs.vite,
|
|
],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
globals: globals.browser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
ecmaFeatures: { jsx: true },
|
|
sourceType: 'module',
|
|
},
|
|
},
|
|
rules: {
|
|
// components in JSX (`icon: Icon` props) count as used
|
|
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^[A-Z_]' }],
|
|
// The v2 pages load their data with `useEffect(() => { load() }, [load])` (setState after
|
|
// a fetch). A warning until phase 6 moves page loading to react-query (already a dependency).
|
|
'react-hooks/set-state-in-effect': 'warn',
|
|
},
|
|
},
|
|
{
|
|
files: strict,
|
|
rules: { 'react-hooks/set-state-in-effect': 'error' },
|
|
},
|
|
{
|
|
files: ['tests/**/*.mjs', 'scripts/**/*.mjs', '*.config.js'],
|
|
languageOptions: { globals: globals.node },
|
|
},
|
|
])
|