mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-04 12:40:00 +00:00
Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019bd8c8-bce1-70bc-a125-baf2a1503ee8
25 lines
798 B
TypeScript
25 lines
798 B
TypeScript
import path from 'node:path'
|
|
|
|
export default {
|
|
'tests-ui/**': () =>
|
|
'echo "Files in tests-ui/ are deprecated. Colocate tests with source files." && exit 1',
|
|
|
|
'./**/*.js': (stagedFiles: string[]) => formatAndEslint(stagedFiles),
|
|
|
|
'./**/*.{ts,tsx,vue,mts}': (stagedFiles: string[]) => [
|
|
...formatAndEslint(stagedFiles),
|
|
'pnpm typecheck'
|
|
]
|
|
}
|
|
|
|
function formatAndEslint(fileNames: string[]) {
|
|
// Convert absolute paths to relative paths for better ESLint resolution
|
|
const relativePaths = fileNames.map((f) => path.relative(process.cwd(), f))
|
|
const joinedPaths = relativePaths.map((p) => `"${p}"`).join(' ')
|
|
return [
|
|
`pnpm exec oxfmt ${joinedPaths}`,
|
|
`pnpm exec oxlint --fix ${joinedPaths}`,
|
|
`pnpm exec eslint --cache --fix --no-warn-ignored ${joinedPaths}`
|
|
]
|
|
}
|