Skip to content
Visual explainer 2h 30m to learn 5 steps

Run repository checks and review the pull request

Run lint, type checks, tests and the build, inspect package and lockfile changes and write a compact pull request review.

By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 9 minutes to read.

Topic 18 of 29

In short

Before a pull request is reviewed, run the same checks the project runs: lint, type check, tests and the build. Then look at what the change added, especially new packages and lockfile edits. Finish with a short review that says what you checked and what you did not.

Think of it like this: It is like a pre-flight checklist: each item is quick, and skipping one is how small problems reach the air.

Explained simply

Before anyone reviews a pull request, you should have already run the checks the project uses. Those are usually lint, a type check, the tests and a production build. Each one catches a different kind of problem, so passing one does not excuse skipping another.

Run them from a clean install so a missing dependency cannot hide. Use the scripts in package.json rather than your own variants. If a check fails, fix it or say clearly in the pull request that it fails and why.

Then read what the change added to the project. A new package is code you did not write and will now trust. Ask whether it is needed, still maintained and from the publisher you expect. Look at the lockfile diff for surprises.

Finish with a short review: what changed, what you ran and its result, what you did not check, and any risks. A few honest lines beat a quick approval.

Press Play on a diagram to walk through it one step at a time.

FlowPre-review gate
  1. 1
    Lint

    Style and common mistakes

  2. 2
    Type check

    tsc finds type errors without running code

  3. 3
    Tests

    Unit, integration and end-to-end suites

  4. 4
    Build

    Proves the app compiles for production

  5. 5
    Diff audit

    Package and lockfile changes, unexpected files

SequenceFrom local checks to merge
Author
CI
Reviewer
  1. 1Run lint, types, tests, build locally
    Author to Author: Run lint, types, tests, build locally
  2. 2Push branch and open pull request
    Author to CI: Push branch and open pull request
  3. 3Report check results
    CI to Author: Report check results
  4. 4Request review with notes
    Author to Reviewer: Request review with notes
  5. 5Comments or approval
    Reviewer to Author: Comments or approval
  6. 6Fix, push, checks run again
    Author to CI: Fix, push, checks run again

In depth

The four local checks

Lint finds style problems and common mistakes. A type check, often npx tsc --noEmit, finds type errors without producing output. Tests prove behaviour. The build proves the app compiles the way production will, and in Next.js it also catches some route and import errors.

Use npm ci for a clean, exact install from the lockfile. It fails if package.json and the lockfile disagree, which is useful information. Script names differ per project, so read the scripts section of package.json.

  • npm ci: exact install from the lockfile
  • Lint: style and common mistakes
  • tsc --noEmit: type errors
  • Tests, then the build
FlowOrder of checks, cheapest first
  1. 1
    npm ci

    Clean install

  2. 2
    Lint

    Seconds

  3. 3
    Type check

    Seconds to a minute

  4. 4
    Tests

    Minutes

  5. 5
    Build

    Minutes, closest to production

Inspecting new packages

Diff package.json against the main branch. Every added line under dependencies is new code that runs in your app. Under devDependencies it runs on your machine and in CI.

For each new package, ask: is this needed, or does the platform already do it? Is it maintained? Does the name match the real project, since look-alike names are a known attack? What licence does it use? GitHub dependency review shows added packages, known vulnerabilities and licences in a pull request.

CompareQuestions for a new dependency
Need
  • Does the platform already do this?
  • Used in more than one place?
  • Small enough to write ourselves?
Trust
  • Name matches the real project
  • Recent releases and maintainers
  • Known vulnerabilities checked
Fit
  • Licence allowed
  • Size acceptable
  • Works with our versions

Reading lockfile changes

package-lock.json records the exact version and source of every package, including indirect ones. A small package.json change can add dozens of lockfile lines, which is normal. Look for changes that do not match the story: many unrelated version bumps, packages that appear with no parent, or a different registry in the resolved field.

Use git diff on the lockfile and scan the resolved URLs. If the lockfile changed but package.json did not, ask why. The assistant may have run an install or an update you did not request.

  • Resolved URLs should point to the expected registry
  • Lockfile change without package.json change needs an explanation
  • Unrelated version bumps are suspicious
  • Commit the lockfile with the change that needs it

A compact pull request review

Write the review so someone else can trust it quickly. Say what the change does in one line. List the checks you ran with their results. List new packages and your decision. Note risks and what you did not test. End with approve, request changes or comment.

GitHub pull request reviews let you comment on lines, then submit as approve, comment or request changes. Keep comments specific and actionable, and tie each to a line or a criterion.

LayersShape of a compact review
  1. 1
    Summary

    One line on what changed

  2. 2
    Checks run

    Lint, types, tests, build with results

  3. 3
    Packages and lockfile

    Added packages and verdict

  4. 4
    Risks

    What is untested or uncertain

  5. 5
    Decision

    Approve, comment or request changes

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Run lint and the type check~30m
  2. 2
    Run tests and the build~30m
  3. 3
    Inspect new packages~30m
  4. 4
    Read lockfile changes~30m
  5. 5
    Write a compact review~30m

Key points

  • Run lint, type check, tests and build from a clean install, using the project's own scripts.
  • Check package.json for new dependencies. Ask whether each one is needed, maintained and trusted.
  • Read the lockfile diff for surprises: many new packages, changed registries or unrelated version jumps.
  • A compact review lists what changed, what you ran, what passed, and risks that remain.

Key terms

Tap a card to flip it. 0/5 known

Examples

bash
npm ci
npm run lint
npx tsc --noEmit
npm test
npm run build
git diff --stat main...HEAD
git diff main...HEAD -- package.json
git diff main...HEAD -- package-lock.json | head -80

Local gate commands and diff checks. Script names depend on your package.json.

Auditing a change that added a package

An assistant built a date picker and the diff shows a new package. Step 1: run npm ci and the four checks; all pass. Step 2: diff package.json and see one new dependency. Step 3: check the package name against its official repository and recent releases. Step 4: look at the lockfile diff for extra packages and resolved URLs. Step 5: ask whether the browser input type=date would do the job. Decide and write it in the review.

bash
npm ci && npm run lint && npx tsc --noEmit && npm test && npm run build
git diff --stat main...HEAD
git diff main...HEAD -- package.json
git diff main...HEAD -- package-lock.json | grep resolved | head -20
npm ls --depth=0

A compact review you can paste

This review is short but tells the author and the next reader what was verified. Step 1: summary. Step 2: results of each check. Step 3: package decision. Step 4: gaps. Step 5: decision. Replace the details with your own results. It avoids vague phrases like looks good and states what remains unknown.

text
Summary: adds a character counter to NoteForm (2 files).
Checks: lint pass, tsc pass, tests 14/14, build pass.
Packages: none added. Lockfile unchanged.
Not checked: Safari, screen reader.
Risk: counter counts UTF-16 units, so some emoji count as 2.
Decision: approve with one comment on line 31.

Quick reference

  • Run npm ci, then lint, npx tsc --noEmit, tests and the build.
  • Use the project's own scripts. Check package.json for the names.
  • git diff main...HEAD -- package.json shows added dependencies.
  • Check each new package: needed, maintained, correct name, licence.
  • Lockfile change without a package.json change needs an explanation.
  • Resolved URLs in the lockfile should point at the expected registry.
  • A review lists changes, checks run, packages, risks and a decision.

Common mistakes

  • Reading only the source files and skipping package.json and the lockfile.
  • Running tests with a stale install, so a missing dependency goes unnoticed.
  • Writing "LGTM" with no note of what was actually run.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Why run npm ci rather than npm install before checks?

Question 2

2What does a production build catch that tests may not?

Question 3

3The lockfile changed but package.json did not. What should you do?

Question 4

4Which review comment is most useful?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Write the command sequence for the four local checks in a project with scripts named lint, test and build.

  2. Exercise 2medium

    A diff adds one dependency named left-padd. Describe three checks before accepting it.

  3. Exercise 3hard

    Write a compact review for a pull request where tests fail in one file and the lockfile has 40 new lines but package.json is unchanged.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Do I need CI if I run checks locally?
Yes. CI runs the same checks on a clean machine for everyone, so results do not depend on your setup.
Is a lockfile change always bad?
No. Adding a package changes it, and it should be committed. The concern is a change you cannot explain.
How long should a review be?
Short enough to read in a minute, with the checks you ran and any real risks. Length is not the goal.

Go deeper

ShareXLinkedInWhatsApp