diff --git a/hooks/check-file-size.sh b/hooks/check-file-size.sh index bb87f8b..a71aaa0 100755 --- a/hooks/check-file-size.sh +++ b/hooks/check-file-size.sh @@ -15,9 +15,11 @@ if [ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ]; then exit 0 fi -# Skip non-code files +# Skip non-code files. .mdx and .markdown belong here with .md: they are prose, +# and a long article is a long article, not a module that wants extracting into +# types.ts. The split advice below cannot apply to any of them. case "$FILE_PATH" in - *.md|*.json|*.yaml|*.yml|*.toml|*.lock|*.svg|*.png|*.jpg|*.csv|*.txt) + *.md|*.mdx|*.markdown|*.json|*.yaml|*.yml|*.toml|*.lock|*.svg|*.png|*.jpg|*.csv|*.txt) exit 0 ;; esac @@ -40,6 +42,34 @@ case "$FILE_PATH" in Keep each layer under the warn threshold. Do NOT split in the middle of a component." ;; + *.daml) + WARN_THRESHOLD=300 + BLOCK_THRESHOLD=450 + SPLIT_ADVICE="Split by contract concern - extract into separate modules: +- Types.daml - shared data types, enums, and type aliases +- One module per template family - keep a template with its own choices, never apart +- Test suites: one module per lifecycle path (happy, edge case, multi-party) + +Keep a template and its choices together. Do NOT split a template from its choices to +get under a line count." + ;; + *.astro) + # An .astro file is a component, its scoped stylesheet, and its client script in one + # file - that colocation is the framework's unit, not a smell. A real example: a 301 + # line Header.astro was 21 frontmatter, 31 markup, 149 scoped