Skip to content

Commit e52dfaa

Browse files
authored
Adopt Fallow as a PR quality gate (#768)
* Adopt Fallow as a PR quality gate Model Storybook MDX and the Rsbuild compatibility config as runtime entries. Keep Rsbuild and Size Limit packages as dependency exceptions because their CLI/config loading is not visible to static imports, and keep verified Storybook package subpaths as resolver exceptions. Mark the published reset helper as public API and limit the Storybook-only CRAP override to 60 because interactive demos are intentionally excluded from unit coverage while structural thresholds remain unchanged. * Tighten Fallow policy exceptions Remove the duplication threshold because zero disables Fallow's percentage limit. Scope Storybook CRAP exceptions to the four exact uncovered functions with the smallest passing ceilings, and inline the one-use options serializer so the health cleanup does not add indirection merely to move complexity between functions. * Close remaining Fallow gate gaps Treat production imports from dev dependencies as errors and inline the one-use Storybook wrapper. Keep the UseOnInViewRender exception function-scoped at the smallest passing CRAP ceiling because Storybook demos are intentionally outside unit coverage.
1 parent 8a31336 commit e52dfaa

10 files changed

Lines changed: 2680 additions & 5764 deletions

File tree

‎.fallowrc.json‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json",
3+
"entry": [
4+
"fixtures/react-compat/rsbuild.config.mjs",
5+
"storybook/stories/**/*.mdx"
6+
],
7+
"ignoreDependencies": [
8+
"@rsbuild/core",
9+
"@rsbuild/plugin-react",
10+
"@size-limit/preset-small-lib"
11+
],
12+
"ignoreUnresolvedImports": [
13+
"storybook/actions",
14+
"storybook/manager-api",
15+
"storybook/theming"
16+
],
17+
"rules": {
18+
"unused-files": "error",
19+
"unused-exports": "error",
20+
"unused-dependencies": "error",
21+
"unused-dev-dependencies": "error",
22+
"dev-dependencies-in-production": "error",
23+
"unresolved-imports": "error",
24+
"unlisted-dependencies": "error",
25+
"circular-dependencies": "error",
26+
"stale-suppressions": "error"
27+
},
28+
"duplicates": {
29+
"minOccurrences": 2
30+
},
31+
"health": {
32+
"maxCyclomatic": 20,
33+
"maxCognitive": 15,
34+
"maxCrap": 30,
35+
"maxUnitSize": 60,
36+
"coverage": "coverage/coverage-final.json",
37+
"thresholdOverrides": [
38+
{
39+
"files": ["storybook/stories/elements.tsx"],
40+
"functions": ["EntryDetails", "ScrollWrapper"],
41+
"maxCrap": 31,
42+
"reason": "Interactive Storybook demos are intentionally excluded from unit coverage; retain the default structural complexity limits while allowing these two estimated CRAP scores."
43+
},
44+
{
45+
"files": ["storybook/stories/useInView.story.tsx"],
46+
"functions": ["HooksRender"],
47+
"maxCrap": 43,
48+
"reason": "This interactive Storybook demo is intentionally excluded from unit coverage; retain the default structural complexity limits while allowing its estimated CRAP score."
49+
},
50+
{
51+
"files": ["storybook/stories/useOnInView.story.tsx"],
52+
"functions": ["UseOnInViewRender"],
53+
"maxCrap": 57,
54+
"reason": "This interactive Storybook demo is intentionally excluded from unit coverage; retain the default structural complexity limits while allowing its measured CRAP score of 56."
55+
}
56+
],
57+
"suggestInlineSuppression": false
58+
}
59+
}

‎.github/workflows/test.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v7
15+
with:
16+
fetch-depth: 0
1517
- run: corepack enable
1618
- name: Setup Node.js
1719
uses: actions/setup-node@v6
@@ -28,6 +30,9 @@ jobs:
2830
run: pnpm vitest --coverage
2931
env:
3032
CI: true
33+
- name: Fallow audit
34+
if: github.event_name == 'pull_request'
35+
run: pnpm fallow audit --base "origin/${{ github.base_ref }}"
3136
- name: Build
3237
run: pnpm build
3338

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ storybook-static
2020
test-utils.js
2121
test-utils.d.ts
2222
__screenshots__
23+
.fallow/

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@
135135
"@vitest/browser-playwright": "^4.0.16",
136136
"@vitest/coverage-istanbul": "^4.0.16",
137137
"bumpp": "^10.3.2",
138+
"fallow": "3.10.0",
138139
"lint-staged": "^16.2.7",
139-
"microbundle": "^0.15.1",
140140
"npm-run-all": "^4.1.5",
141141
"playwright": "^1.57.0",
142142
"publint": "^0.3.16",

0 commit comments

Comments
 (0)