Skip to content

Make npm run lint work in code-reference-finder - #260

Open
Hotragn wants to merge 2 commits into
tinyfish-io:mainfrom
Hotragn:hotragn/fix-code-reference-finder-lint
Open

Make npm run lint work in code-reference-finder#260
Hotragn wants to merge 2 commits into
tinyfish-io:mainfrom
Hotragn:hotragn/fix-code-reference-finder-lint

Conversation

@Hotragn

@Hotragn Hotragn commented Aug 18, 2026

Copy link
Copy Markdown

The 8th and last recipe from #248.

Stacked on #259 — it includes that PR's commit, because #259 creates code-reference-finder/package-lock.json and adding ESLint has to rewrite it. Keeping them separate would have meant two PRs both touching a file that doesn't exist on main yet, and a guaranteed conflict for whichever merged second. Merge #259 first and this rebases to just the lint change; or merge this one and you get both.

The bug

$ cd code-reference-finder && npm run lint
> next lint
Invalid project directory provided, no such directory: .../code-reference-finder/lint
exit 1

Next 16.1.6 with "lint": "next lint", and next lint was removed in Next 16 — the CLI reads lint as a directory argument.

This one was the emptiest of the eight: no eslint.config.*, no eslint, no eslint-config-next. fast-qa in #258 at least had a config file to resolve; here there was nothing.

The fix

  • eslint: ^9 and eslint-config-next: 16.1.6 as devDependencies, matching pharmacy-panic — also on Next 16.1.6, same pin.
  • eslint.config.mjs in the subpath style used by all ten already-working Next 16 recipes, byte-identical to theirs.
  • Script to eslint.

The one error its first lint run surfaced

src/components/LiveBrowserPreview.tsx:22react-hooks/set-state-in-effect, and the same pattern as tenders-finder in #250:

// before
const [isLoading, setIsLoading] = useState(true);
useEffect(() => { setIsLoading(true); }, [streamingUrl]);

// after — derived, no effect
const [loadedUrl, setLoadedUrl] = useState<string | null>(null);
const isLoading = loadedUrl !== streamingUrl;
// ...
<iframe onLoad={() => setLoadedUrl(streamingUrl)} />

Tracking which URL loaded instead of a boolean means a new streamingUrl brings the spinner back on its own, with no effect and no synchronising render. Fixed the same way here as in #250 so the two recipes don't diverge on identical code. useEffect was the file's only use, so the import goes too.

Left alone

src/lib/search.ts:13'_analysis' is defined but never used, a warning, not an error. The underscore prefix is the conventional marker for a deliberately unused binding, so I read it as intentional and didn't touch it. Lint exits 0 with it present.

Verification

cd code-reference-finder && rm -rf node_modules && npm ci
npm run lint      # exit 0
npx tsc --noEmit  # exit 0

Lockfile grows by ~370 entries — the ESLint toolchain, same as #258. That delta sits on top of the lockfile #259 introduces.

#248 is now complete

Recipe PR
stay-scout-hub #249
restaurant-comparison-tool, tutor-finder, scholarship-finder, summer-school-finder, tenders-finder #250
fast-qa #258
code-reference-finder this one

All eight verified the same way: npm run lint and tsc --noEmit exit 0 from a clean npm ci.

research-sentry remains the only recipe with no lint script at all — nothing broken to fix, but worth deciding whether that's intended.

…entry

These were the only two recipes with a package.json and no lockfile, so
npm ci cannot run in either and there is nothing pinned: every install
re-resolves every caret range, and OSV-Scanner has no lock to read, which
means neither recipe's dependency tree is covered by the repo's own
vulnerability scanning.

Checked first that the absence looks accidental rather than deliberate.
Neither declares a packageManager, neither has a yarn/pnpm/bun lockfile,
and neither .gitignore mentions lockfiles -- both ignore only
node_modules. The other 30 recipes all commit one.

Generated with npm install --package-lock-only, so no source and no
package.json changes. lockfileVersion 3 in both, matching all 32 existing
lockfiles.

Both recipes declare "@tiny-fish/sdk": "latest", which the lock now pins
to 0.4.1. That is what an install already produced, so it is not a
behaviour change, and it matches how the repo already works: 17 recipes
declare latest and commit a lockfile pinning it.

Verified from scratch in both: rm -rf node_modules && npm ci exits 0, and
tsc --noEmit exits 0.
The eighth and last recipe from tinyfish-io#248.

npm run lint fails because this is Next 16.1.6 with "lint": "next lint",
and next lint was removed in Next 16 -- the CLI reads "lint" as a
directory argument:

  Invalid project directory provided, no such directory: .../code-reference-finder/lint

This was the emptiest of the eight: no eslint.config.*, no eslint and no
eslint-config-next. fast-qa in tinyfish-io#258 at least had a config file that could
not resolve; here there was nothing at all.

Adds eslint ^9 and eslint-config-next 16.1.6 as devDependencies, matching
pharmacy-panic, which is also on Next 16.1.6 and pins the same version,
plus an eslint.config.mjs identical to the one the ten already-working
Next 16 recipes use. Script moves to eslint.

The first lint run surfaced one error, in LiveBrowserPreview.tsx: an
effect resetting an iframe loading flag whenever streamingUrl changed,
tripping react-hooks/set-state-in-effect. Same code and same fix as
tenders-finder in tinyfish-io#250 -- track which URL actually loaded instead of a
boolean, so a new URL restores the spinner with no effect at all. Fixed
identically so the two recipes do not diverge on the same component.
useEffect was the file's only use, so the import goes too.

Left the '_analysis is defined but never used' warning in lib/search.ts
alone: it is a warning rather than an error, and the underscore prefix
reads as a deliberate unused binding.

Verified from scratch: rm -rf node_modules && npm ci, then npm run lint
and tsc --noEmit, all exit 0.

Stacked on tinyfish-io#259, which introduces this recipe's lockfile -- adding ESLint
has to rewrite it, so the two cannot be independent without conflicting.
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 22f74888-e34a-4e3e-963f-caf8c107c330

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant