chore(lint): enforce single-parameter function style with custom check#2429
chore(lint): enforce single-parameter function style with custom check#2429andrew-bierman wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for API Unit Tests Coverage (./packages/api)
File CoverageNo changed files found. |
Coverage Report for Expo Unit Tests Coverage (./apps/expo)
File CoverageNo changed files found. |
|
Closing as superseded by #2422. After comparing the two checks, #2422's
#2422 also ships the fix alongside the check (206 violations refactored across 260 files), which is what unblocks the check from being red on day one. #2429 only added the check without addressing existing violations. If we later want the Branch |
Motivation
biome) is set to allow up to 2 parameters, but the team wants to tighten style to prefer a single typed object parameter for first-party code.Description
packages/checks/src/check-max-params.tswhich scansapps/andpackages/TypeScript files and reports any function-like node with more than one parameter.node_modules/dist/build, and treats callbacks passed directly into call expressions as non-violations to reduce false positives.@allow-multi-paramthat can be placed on a leading comment to exempt specific functions.check:max-paramstopackages/checks/package.jsonand a root-levelcheck:max-paramsand appended it to thelint:custompipeline in the rootpackage.jsonwhile leaving Biome'suseMaxParamsatmax: 2as the baseline.Testing
bunx biome format --write packages/checks/src/check-max-params.tswhich formatted the new file successfully.biome check --no-errors-on-unmatchedagainst the changed files as part of the pre-commit hook which succeeded after formatting.bun run --cwd packages/checks check:max-paramswhich intentionally failed because it reported existing multi-parameter functions in first-party code (this is expected and indicates the check is detecting current violations).Codex Task