mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 16:20:25 +00:00
chore: replace dead frontend eslint with oxlint and fix what it found (#12371)
Claude-Session: https://claude.ai/code/session_01PjsYvu7Wp1NGdgZrGdaP6v Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
af14331862
commit
5713e3f23b
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Lint a frontend file with oxlint after Claude edits it, and hand any findings back
|
||||
# as context. Never blocks: the edit stands, Claude sees what to fix.
|
||||
|
||||
INPUT=$(cat)
|
||||
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
||||
[ -z "$FILE_PATH" ] && exit 0
|
||||
[[ "$FILE_PATH" =~ \.(ts|js|svelte)$ ]] || exit 0
|
||||
|
||||
# Same anchoring as format-frontend.sh: a "frontend" directory at a repo root.
|
||||
REPO_ROOT="${FILE_PATH%%/frontend/*}"
|
||||
[[ "$FILE_PATH" == *"/frontend/"* ]] && [[ -e "$REPO_ROOT/.git" ]] || exit 0
|
||||
OXLINT="$REPO_ROOT/frontend/node_modules/.bin/oxlint"
|
||||
[ -x "$OXLINT" ] || exit 0
|
||||
|
||||
cd "$REPO_ROOT/frontend" || exit 0
|
||||
OUT=$("$OXLINT" --format=unix "$FILE_PATH" 2>&1) && exit 0
|
||||
|
||||
jq -n --arg out "$OUT" '{hookSpecificOutput: {hookEventName: "PostToolUse",
|
||||
additionalContext: ("oxlint found problems in the file you just edited; fix them:\n" + $out)}}'
|
||||
exit 0
|
||||
@@ -123,6 +123,11 @@
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format-frontend.sh",
|
||||
"timeout": 30
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/lint-frontend.sh",
|
||||
"timeout": 30
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format-backend.sh",
|
||||
|
||||
@@ -28,5 +28,5 @@ jobs:
|
||||
env:
|
||||
# svelte-check peaks past node's ~4GB default ceiling on this runner and aborts.
|
||||
NODE_OPTIONS: --max-old-space-size=8192
|
||||
run: cd frontend && npm ci && npm run generate-backend-client && npm run
|
||||
check
|
||||
run: cd frontend && npm ci && npm run lint && npm run generate-backend-client &&
|
||||
npm run check
|
||||
|
||||
@@ -29,6 +29,7 @@ After all code changes are done, run `./update_sqlx.sh` from `backend/` to regen
|
||||
| When | Command | Time |
|
||||
|---|---|---|
|
||||
| During iteration | `npm run check:fast` | ~2s |
|
||||
| During iteration | `npm run lint` (oxlint, `.oxlintrc.json`) | <1s |
|
||||
| Final PR validation | `npm run check` | ~50s |
|
||||
| After backend API changes | `npm run generate-backend-client` first | |
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
||||
plugins: ['svelte3', '@typescript-eslint'],
|
||||
ignorePatterns: ['*.cjs'],
|
||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||
settings: {
|
||||
'svelte3/typescript': () => require('typescript')
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2019
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
},
|
||||
rules: {
|
||||
'no-console': ['log', { allow: ['warn', 'error'] }]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["eslint", "typescript", "unicorn", "oxc"],
|
||||
"categories": {
|
||||
"correctness": "error"
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es2024": true
|
||||
},
|
||||
"ignorePatterns": ["src/lib/monaco_workers/graphql.worker.bundle.js", "static/**"],
|
||||
"rules": {
|
||||
// Svelte 5 reads a value in `$effect` to track it (`x && untrack(...)`, `;[x]`).
|
||||
"no-unused-expressions": "off",
|
||||
// `$store = $store` is how a mutated store is told to notify.
|
||||
"no-self-assign": "off",
|
||||
// tsc's `noUnusedLocals` covers locals; what is left is unused params and catch bindings.
|
||||
"no-unused-vars": "off",
|
||||
// Cosmetic: no runtime effect, so they only add churn.
|
||||
"no-useless-escape": "off",
|
||||
"no-useless-rename": "off",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"typescript/prefer-as-const": "off",
|
||||
"typescript/no-wrapper-object-types": "off",
|
||||
"typescript/no-non-null-asserted-optional-chain": "off",
|
||||
"typescript/no-this-alias": "off",
|
||||
"unicorn/no-useless-fallback-in-spread": "off",
|
||||
"unicorn/no-useless-spread": "off",
|
||||
"unicorn/no-useless-length-check": "off",
|
||||
"unicorn/no-new-array": "off",
|
||||
"unicorn/no-empty-file": "off",
|
||||
"unicorn/prefer-string-starts-ends-with": "off",
|
||||
// Stripping control characters is what those regexes are for.
|
||||
"no-control-regex": "off",
|
||||
// Exports a deliberate thenable.
|
||||
"unicorn/no-thenable": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.test.ts", "**/*.spec.ts"],
|
||||
"rules": {
|
||||
// A throw there fails the test, which is the point.
|
||||
"no-unsafe-optional-chaining": "off",
|
||||
"require-yield": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+430
-1133
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,8 @@
|
||||
"check:fast": "bun --bun svelte-fast-check --no-svelte-warnings --incremental",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --threshold warning",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"lint": "oxlint",
|
||||
"format:check": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
|
||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
||||
"package": "svelte-package -o package && node scripts/package-system-prompts.js && node scripts/fix-svelte-module-imports.js",
|
||||
"generate-backend-client": "openapi-ts --input ../backend/windmill-api/openapi.yaml --output ./src/lib/gen --useOptions --enums javascript --format false",
|
||||
@@ -36,18 +37,14 @@
|
||||
"@types/d3-zoom": "^3.0.3",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/vscode": "^1.83.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
||||
"@typescript-eslint/parser": "^5.60.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"cssnano": "^6.0.1",
|
||||
"dts-bundle-generator": "^9.5.1",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-svelte": "^2.45.1",
|
||||
"fake-indexeddb": "^6.2.5",
|
||||
"jsdom": "^29.1.1",
|
||||
"json-refs": "^3.0.15",
|
||||
"json-schema-to-zod": "^2.7.0",
|
||||
"oxlint": "1.93.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"postcss": "^8.4.49",
|
||||
"postcss-load-config": "^4.0.1",
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// for information about these interfaces
|
||||
declare namespace App {
|
||||
interface Stuff {
|
||||
title: string?
|
||||
title?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,8 +141,6 @@
|
||||
})
|
||||
sendUserToast('Key renewal successful')
|
||||
reloadLicenseKey()
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
reloadKeyrenewalAttemptInfo()
|
||||
renewing = false
|
||||
|
||||
@@ -376,8 +376,6 @@
|
||||
sendingStats = true
|
||||
await SettingService.sendStats()
|
||||
sendUserToast('Usage sent')
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
sendingStats = false
|
||||
}
|
||||
@@ -399,8 +397,6 @@
|
||||
document.body.removeChild(a)
|
||||
URL.revokeObjectURL(url)
|
||||
sendUserToast('Telemetry data downloaded')
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
downloadingStats = false
|
||||
}
|
||||
|
||||
@@ -405,11 +405,7 @@
|
||||
: undefined,
|
||||
// isFlowStep: jobKindsCat != 'all' ? false : undefined,
|
||||
hasNullParent:
|
||||
filters.val.path != undefined ||
|
||||
filters.val.path != undefined ||
|
||||
filters.val.job_kinds != 'all'
|
||||
? true
|
||||
: undefined,
|
||||
filters.val.path != undefined || filters.val.job_kinds != 'all' ? true : undefined,
|
||||
label: filters.val.label || undefined,
|
||||
tag: filters.val.tag || undefined,
|
||||
suspended:
|
||||
@@ -562,7 +558,7 @@
|
||||
body: JSON.stringify(body)
|
||||
}
|
||||
)
|
||||
await new Promise(async (resolve) => {
|
||||
{
|
||||
const reader = response?.body?.pipeThrough(new TextDecoderStream()).getReader()
|
||||
let reRanUuids: string[] = []
|
||||
if (reader) {
|
||||
@@ -610,8 +606,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve(undefined)
|
||||
})
|
||||
}
|
||||
|
||||
selectedIds = []
|
||||
// Opened from the table's "Run again", the options are done; left open, the next selection
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
const agColumnDefs = transformColumnDefs({
|
||||
columnDefs:
|
||||
Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
|
||||
? ([...resolvedConfig?.columnDefs] as WindmillColumnDef[])
|
||||
? ([...resolvedConfig.columnDefs] as WindmillColumnDef[])
|
||||
: [],
|
||||
actions,
|
||||
customActionsHeader: resolvedConfig?.customActionsHeader,
|
||||
@@ -492,7 +492,7 @@
|
||||
const agColumnDefs = transformColumnDefs({
|
||||
columnDefs:
|
||||
Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
|
||||
? ([...resolvedConfig?.columnDefs] as WindmillColumnDef[])
|
||||
? ([...resolvedConfig.columnDefs] as WindmillColumnDef[])
|
||||
: [],
|
||||
actions,
|
||||
customActionsHeader: resolvedConfig?.customActionsHeader,
|
||||
|
||||
@@ -190,7 +190,8 @@
|
||||
mounted && $styleStore && untrack(() => writeStyle())
|
||||
})
|
||||
$effect(() => {
|
||||
mounted && (!value || value) && untrack(() => parseStyle())
|
||||
value
|
||||
mounted && untrack(() => parseStyle())
|
||||
})
|
||||
$effect(() => {
|
||||
$app && untrack(() => setTopColors())
|
||||
|
||||
@@ -88,14 +88,15 @@
|
||||
}
|
||||
|
||||
for (const [key, value] of migrations) {
|
||||
if (cssString.includes(`${key} {` || `${key}{`)) {
|
||||
if (cssString.includes(`${key} {`) || cssString.includes(`${key}{`)) {
|
||||
// append value to existing value
|
||||
const regex = new RegExp(`\\${key}\\s*{\\s*([\\s\\S]*?)\\s*}`, 'g')
|
||||
|
||||
const match = regex.exec(cssString)
|
||||
|
||||
if (match) {
|
||||
const existingValue = match[1]
|
||||
// CSS allows the last declaration to omit its `;`; appending after it needs one.
|
||||
const existingValue = match[1] && !match[1].endsWith(';') ? `${match[1]};` : match[1]
|
||||
|
||||
cssString = cssString.replace(
|
||||
regex,
|
||||
|
||||
@@ -368,7 +368,8 @@
|
||||
? intersectingElement?.querySelector('.svlt-grid-container')
|
||||
: document.getElementById('root-grid')
|
||||
|
||||
const xPerPxComputed = Number(container?.getAttribute('data-xperpx')) ?? xPerPx
|
||||
const xPerPxAttr = container?.getAttribute('data-xperpx')
|
||||
const xPerPxComputed = xPerPxAttr != null ? Number(xPerPxAttr) : xPerPx
|
||||
|
||||
const position = computePosition(
|
||||
clientX,
|
||||
|
||||
@@ -335,8 +335,6 @@
|
||||
// surfaces open on the same job.
|
||||
if (!call?.adopt(run, args, flow?.schema ?? {}))
|
||||
await onNavigate('/run/' + run + '?workspace=' + workspace)
|
||||
} catch (e) {
|
||||
throw e
|
||||
} finally {
|
||||
loading = false
|
||||
}
|
||||
|
||||
@@ -415,7 +415,10 @@
|
||||
if (model == undefined) return
|
||||
diffMode = true
|
||||
|
||||
diffEditor?.showWithModelAndOriginal((savedModule?.value as RawScript).content ?? '', model)
|
||||
diffEditor?.showWithModelAndOriginal(
|
||||
(savedModule?.value as RawScript | undefined)?.content ?? '',
|
||||
model
|
||||
)
|
||||
editor?.hide()
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ export function createFlowDiffManager({ testMode = false } = {}) {
|
||||
if (!parentInBefore) {
|
||||
// Parent is missing in beforeFlow. It must be pending acceptance.
|
||||
// Accept as skeleton to avoid auto-accepting all siblings.
|
||||
acceptModule(parentLoc.parentId, flowStore, true)
|
||||
acceptModule(parentLoc.parentId, undefined, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -18,7 +18,7 @@ export async function getJsonSchemaFromResource(path: string, workspace: string)
|
||||
path,
|
||||
workspace
|
||||
})
|
||||
if (!resourceValue || !resourceValue == null) {
|
||||
if (!resourceValue) {
|
||||
console.warn(`JSON schema resource ${path} not found`)
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { isMac } from '$lib/utils'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { onDestroy, onMount, untrack } from 'svelte'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
@@ -61,12 +60,7 @@
|
||||
}: Props = $props()
|
||||
|
||||
if (untrack(() => small)) {
|
||||
kbdClass = twMerge(
|
||||
kbdClass,
|
||||
'!text-[10px] px-1',
|
||||
false && isMac() ? '!text-lg ' : 'text-xs',
|
||||
'leading-none'
|
||||
)
|
||||
kbdClass = twMerge(kbdClass, '!text-[10px] px-1', 'text-xs', 'leading-none')
|
||||
} else {
|
||||
kbdClass += ' !text-xs px-1.5'
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@
|
||||
replication_slot_name = cfg?.replication_slot_name
|
||||
permsPath = path
|
||||
permsForWrite = cfg?.extra_perms
|
||||
transaction_to_track = [...cfg?.publication?.transaction_to_track]
|
||||
transaction_to_track = [...(cfg?.publication?.transaction_to_track ?? [])]
|
||||
relations = cfg?.publication?.table_to_track ?? []
|
||||
errorHandler = handlerDraftFromStored(
|
||||
'error',
|
||||
|
||||
@@ -86,15 +86,10 @@ export class JobManager {
|
||||
throw new Error('Job was cancelled')
|
||||
}
|
||||
|
||||
let jobResult
|
||||
try {
|
||||
jobResult = await JobService.getCompletedJob({
|
||||
workspace,
|
||||
id: jobId
|
||||
})
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
const jobResult = await JobService.getCompletedJob({
|
||||
workspace,
|
||||
id: jobId
|
||||
})
|
||||
|
||||
const success = !!jobResult.success
|
||||
const status: JobStatus = {
|
||||
|
||||
@@ -919,7 +919,7 @@
|
||||
if (settings.deploy_ui != undefined && settings.deploy_ui != null) {
|
||||
deployUiSettings = {
|
||||
include_path:
|
||||
(settings.deploy_ui.include_path?.length ?? 0 > 0)
|
||||
(settings.deploy_ui.include_path?.length ?? 0) > 0
|
||||
? (settings.deploy_ui.include_path ?? [])
|
||||
: [],
|
||||
include_type: {
|
||||
|
||||
Reference in New Issue
Block a user