mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
c5765bbf15
The apps ship only an address screen now. Once a server is picked, the native side points the WebView at it: TrekBridgeViewController on iOS and a config copy with server.url on Android. The UI then comes from that server, in the version it runs and on its own origin, so the session cookie, uploads, /ws and plugins work exactly as in a browser and no app release has to keep pace with the servers out there. The address screen (native-shell/, built into native-dist/) probes /api/health/features through native HTTP, tries https before http when no scheme was typed, and refuses servers without the nativeApp flag. It also serves as the error page when the remembered server does not load: retry, change server, or on iOS the stored copy of the server's start page. TrekShell is the app's own plugin for all of that: remember, change and reload the server, sign in through ASWebAuthenticationSession or a Custom Tab, and on iOS keep and open the offline copy of the start page, because WKWebView runs no service worker for a domain the app does not list. Plugins the frame does not use are gone (push, camera, geolocation, calendar, file transfer, in-app browser and more): the WebView covers the camera and location itself, and push needs a relay before it is worth shipping. With them go the push entitlement, the calendar usage strings and the Firebase bits. The iOS scheme falls back to capacitor://, since Capacitor drops an iosScheme of https, and the arm64 capability replaces armv7.
108 lines
3.7 KiB
JavaScript
108 lines
3.7 KiB
JavaScript
import js from '@eslint/js';
|
|
|
|
import gitignore from 'eslint-config-flat-gitignore';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
// Minimal stub so the existing `// eslint-disable-next-line react/no-danger`
|
|
// directive in src/i18n/TransHtml.tsx resolves without pulling in the full
|
|
// eslint-plugin-react (not a dependency here). The rule is a no-op.
|
|
const reactStub = {
|
|
rules: {
|
|
'no-danger': {
|
|
meta: { schema: [] },
|
|
create() {
|
|
return {};
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
export default tseslint.config(
|
|
gitignore({ strict: false }),
|
|
{
|
|
ignores: [
|
|
'node_modules',
|
|
'dist',
|
|
'coverage',
|
|
'public',
|
|
'test-results',
|
|
'playwright-report',
|
|
// Capacitor native shells. `npx cap sync` copies the built address screen
|
|
// from native-dist/ into both platforms, so without these ESLint lints the
|
|
// minified output. gitignore() does not cover them: the iOS and Android
|
|
// .gitignore files live one level down, and this config's gitignore
|
|
// integration only reads client/.gitignore.
|
|
'native-dist',
|
|
'android/**',
|
|
'ios/**',
|
|
'e2e/**',
|
|
'scripts/**',
|
|
'**/*.config.js',
|
|
'**/*.config.ts',
|
|
'**/*.config.mjs',
|
|
],
|
|
},
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
eslintConfigPrettier,
|
|
{
|
|
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
react: reactStub,
|
|
},
|
|
rules: {
|
|
'react/no-danger': 'off',
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
|
|
// --- Severities tuned to keep CI green on a codebase that was never linted ---
|
|
// (each rule below has pre-existing violations; surfaced as warnings, not blockers)
|
|
|
|
// rules-of-hooks has one conditional-hook violation in PlaceInspector.tsx -> warn (not error).
|
|
'react-hooks/rules-of-hooks': 'warn',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
|
],
|
|
'@typescript-eslint/no-unused-expressions': 'warn',
|
|
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
|
'@typescript-eslint/no-this-alias': 'warn',
|
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
|
|
|
|
// js.recommended rules with pre-existing hits.
|
|
'no-empty': 'warn',
|
|
'no-useless-escape': 'warn',
|
|
'no-useless-assignment': 'warn',
|
|
'preserve-caught-error': 'warn',
|
|
},
|
|
},
|
|
{
|
|
// react-dom/server was worth ~190 KB raw / 57 KB gzip in a chunk three lazy
|
|
// routes share — including the Leaflet renderer, which is the default — for
|
|
// output that is always a single <svg>. utils/iconMarkup.ts does that job
|
|
// without Fizz, and this keeps the import from creeping back: nothing else
|
|
// would notice, the build stays green and the app keeps working.
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
ignores: ['src/**/*.test.{ts,tsx}'],
|
|
rules: {
|
|
'no-restricted-imports': ['error', {
|
|
paths: [{
|
|
name: 'react-dom/server',
|
|
message: 'Use renderIconMarkup from utils/iconMarkup — Fizz is ~190 KB for one <svg>.',
|
|
}],
|
|
}],
|
|
'no-restricted-syntax': ['error', {
|
|
selector: "ImportExpression > Literal[value=/^react-dom\\u002F(server|static)/]",
|
|
message: 'Use renderIconMarkup from utils/iconMarkup — Fizz is ~190 KB for one <svg>.',
|
|
}],
|
|
},
|
|
},
|
|
);
|