Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Format staged sources only. Framework/SwiftyUpdateKit.xcframework/ is a
// generated distribution artifact: running uncrustify over its generated
// headers reorders their #include lines and invalidates the bundle signature,
// so the formatters must never see it.
const GENERATED = 'Framework/SwiftyUpdateKit.xcframework/'

const format = (command) => (files) => {
const targets = files.filter((file) => !file.includes(GENERATED))
return targets.length ? [`${command} ${targets.map((f) => `'${f}'`).join(' ')}`] : []
}

module.exports = {
'**/*.swift': format('./.codeformat/swiftformat'),
'**/*.{m,h}': format('./.codeformat/uncrustify -c uncrustify-objc.cfg --no-backup -l OC'),
}
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ prompts, release notes, and review requests.

- Format Swift code according to `.swiftformat`. The expected SwiftFormat version is defined in
`codeformat.sh`.
- Formatters run on staged files through `.lintstagedrc.cjs`, which excludes
`Framework/SwiftyUpdateKit.xcframework/`. Do not widen those globs to cover it: uncrustify
reorders the `#include` lines in its generated headers and invalidates the bundle signature.
- Follow the existing naming, access control, documentation comment, and closure styles.
- Keep code comments self-contained. When referring to an issue or external resource, summarize
the reason and include the complete URL.
Expand Down
8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,5 @@
"devDependencies": {
"husky": "^8.0.3",
"lint-staged": "^13.1.2"
},
"lint-staged": {
"./**/*.swift": [
"./.codeformat/swiftformat"
],
"./**/*.{m,h}": [
"./.codeformat/uncrustify -c uncrustify-objc.cfg --no-backup -l OC"
]
}
}
Loading