// ESLint Configuration for 6002_clawos
// Flat config format (ESLint 9.x)

export default [
    {
        ignores: ["node_modules/", "static/lib/", "static/js/vanilla-jsoneditor.js"]
    },
    {
        languageOptions: {
            ecmaVersion: 2022,
            sourceType: "script",
            globals: {
                // Browser globals
                window: "readonly",
                document: "readonly",
                navigator: "readonly",
                localStorage: "readonly",
                fetch: "readonly",
                setTimeout: "readonly",
                clearTimeout: "readonly",
                setInterval: "readonly",
                clearInterval: "readonly",
                requestAnimationFrame: "readonly",
                alert: "readonly",
                confirm: "readonly",
                prompt: "readonly",
                FormData: "readonly",
                File: "readonly",
                URL: "readonly",
                btoa: "readonly",
                atob: "readonly",
                console: "readonly",
                sessionStorage: "readonly",
                CustomEvent: "readonly",
                MutationObserver: "readonly",
                WebSocket: "readonly",
                TextEncoder: "readonly",
                XMLHttpRequest: "readonly",
                // Socket.IO
                io: "readonly",
                socketio: "readonly",
                // xterm.js
                Terminal: "readonly",
                FitAddon: "readonly",
                // CommonJS (UMD shims)
                module: "readonly",
                exports: "readonly",
                // Common UI functions (used across modules)
                showToast: "readonly",
                escapeHtml: "readonly",
                formatSize: "readonly",
                showUploadStatus: "readonly",
                authHeaders: "readonly",
                apiData: "readonly",
                apiSuccess: "readonly",
                apiMessage: "readonly",
                Drawer: "readonly",
                SmallMenu: "readonly",
                I18n: "readonly",
                openTerminal: "readonly",
                openPreview: "readonly",
                loadBotHistory: "readonly",
                botConnect: "readonly",
                botIsConnected: "writable",
                loadCronJobList: "readonly",
                loadSystemdList: "readonly",
                loadGitList: "readonly",
                loadGitCommitDetail: "readonly",
                loadProcessList: "readonly",
                loadSystemPackageList: "readonly",
                loadPipList: "readonly",
                loadNpmList: "readonly",
                loadDockerTabs: "readonly",
                loadDiskList: "readonly",
                loadNetworkList: "readonly",
                loadGpuInfo: "readonly",
                loadOllamaModels: "readonly",
                loadOpenclawConfig: "readonly",
                confirmDialogDrawer: "readonly",
                closeDialogDrawer: "readonly",
                openDialogDrawer: "readonly",
                showPromptDrawer: "readonly",
                showConfirmDrawer: "readonly",
                openSearchModal: "readonly",
                closeSearchModal: "readonly",
                closeTerminal: "readonly",
                closeCreateMenuDrawer: "readonly",
                loadTrashList: "readonly",
                attachFileItemDefaultHandlers: "readonly",
                encodePathForUrl: "readonly",
                // File browser globals
                currentItemPath: "writable",
                currentItemName: "writable",
                currentItemIsDir: "writable",
                // Drag globals
                isDragging: "writable",
                startY: "writable",
                startHeight: "writable",
                onDrag: "readonly",
                endDrag: "readonly",
                // Functions defined in other modules
                closeMenuModal: "readonly",
                closeMainMenuModal: "readonly",
                closePreviewModal: "readonly",
                closeRenameModal: "readonly",
                closeDetailsModal: "readonly",
                doSearch: "readonly",
                refreshFileList: "readonly",
                showDetails: "readonly",
                performBatchOp: "readonly",
                ok: "readonly",
                SwalConfirm: "readonly",
                SwalAlert: "readonly",
                SwalPrompt: "readonly",
                openEmailDrawer: "readonly",
                killProcess: "readonly",
                uninstallPkg: "readonly",
                removeImage: "readonly",
                removeContainer: "readonly",
                toggleClash: "readonly",
                toggleFrp: "readonly",
                openServiceLog: "readonly",
                __systemdEditConfig: "readonly",
                __systemdRemove: "readonly",
                updateSubscription: "readonly",
                switchProxy: "readonly",
                echarts: "readonly",
                XLSX: "readonly",
                close: "readonly",
                focus: "readonly",
                send: "readonly",
                name: "readonly",
                localPort: "readonly",
                remotePort: "readonly",
                startCompression: "readonly",
                doMoveOrCopy: "readonly",
                picked: "readonly",
                value: "readonly",
                target: "readonly"
            }
        },
        rules: {
            "no-undef": "error",
            "no-redeclare": "off",
            "eqeqeq": ["error", "always"],
            "no-extra-semi": "warn",
            "semi": ["error", "always"]
        }
    }
];
