Skip to content

[FIX] linting scripts for lintstaged#591

Merged
surchs merged 1 commit into
mainfrom
issue590
Jul 25, 2025
Merged

[FIX] linting scripts for lintstaged#591
surchs merged 1 commit into
mainfrom
issue590

Conversation

@surchs
Copy link
Copy Markdown
Contributor

@surchs surchs commented Jul 25, 2025

Changes proposed in this pull request:

  • Create separate scripts for single file (:file and global runs)
  • we could also hard-code the script in lintstaged - but then it's harder to keep them in sync

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass
  • If the PR changes the participant-level and/or the dataset-level result file, the query-tool-results files in the neurobagel_examples repo have been regenerated

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

Summary by Sourcery

Fix and enhance linting and formatting scripts by introducing separate file-scoped commands and updating lint-staged configuration

Bug Fixes:

  • Fix lint:check and lint:fix scripts to correctly target files in lint-staged

Enhancements:

  • Add dedicated file-scoped npm scripts for lint:check:file, lint:fix:file, format:check:file, and format:fix:file
  • Update root-level lint:check, lint:fix, format:check, and format:fix commands to explicitly include project directory

Chores:

  • Align .lintstagedrc.json to use the new file-scoped scripts

@surchs surchs requested a review from rmanaem July 25, 2025 14:20
@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 25, 2025

Deploy Preview for neurobagel-query ready!

Name Link
🔨 Latest commit d1da6c4
🔍 Latest deploy log https://app.netlify.com/projects/neurobagel-query/deploys/6883929be8c3d800089596a2
😎 Deploy Preview https://deploy-preview-591--neurobagel-query.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 25, 2025

Reviewer's Guide

Separated linting and formatting scripts into file-scoped and global variants and updated lint-staged configuration to leverage the new file-level commands for staged files.

File-Level Changes

Change Details Files
Split lint and format scripts into file-scoped and global commands
  • Added lint:check:file and lint:fix:file scripts without a target path for single-file runs
  • Updated lint:check and lint:fix to explicitly include “.” for project-wide runs
  • Introduced format:fix:file and format:check:file for per-file formatting
  • Adjusted format:fix and format:check to target project root with “.”
package.json
Updated lint-staged to use new file-scoped scripts
  • Changed ts/tsx lint-staged entries to invoke lint:check:file and lint:fix:file
  • Updated formatting tasks to call format:check:file and format:fix:file
.lintstagedrc.json

Assessment against linked issues

Issue Objective Addressed Explanation
#590 Update linting and formatting scripts in package.json so that when run via lint-staged, they only operate on staged files (not the entire repo).
#590 Ensure that global scripts (for running on the entire repo) and per-file scripts (for lint-staged) are both available and appropriately separated.
#590 Remove the use of the '.' context from scripts intended for lint-staged, so that lint-staged can pass the list of staged files directly.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

Copy link
Copy Markdown
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @surchs! 🧑‍🍳
P.S. don't forget the PR label

@surchs surchs added the pr-internal Non-user-facing code improvement, will increment patch version when merged (0.0.+1) label Jul 25, 2025
@surchs surchs merged commit a07cb24 into main Jul 25, 2025
16 checks passed
@surchs surchs deleted the issue590 branch July 25, 2025 17:17
@neurobagel-bot
Copy link
Copy Markdown
Contributor

neurobagel-bot Bot commented Aug 6, 2025

🚀 PR was released in v0.11.0 🚀

@neurobagel-bot neurobagel-bot Bot added the released This issue/pull request has been released. label Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-internal Non-user-facing code improvement, will increment patch version when merged (0.0.+1) released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linting scripts are not correctly setup for lintstaged

2 participants