Skip to content

refactor: Bump lint-staged from 15.5.2 to 16.0.0 #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github May 12, 2025

Bumps lint-staged from 15.5.2 to 16.0.0.

Release notes

Sourced from lint-staged's releases.

v16.0.0

Major Changes

  • #1546 158d15c Thanks @​iiroj! - Processes are spawned using nano-spawn instead of execa. If you are using Node.js scripts as tasks, you might need to explicitly run them with node, especially when using Windows:

    {
      "*.js": "node my-js-linter.js"
    }
  • #1546 158d15c Thanks @​iiroj! - The --shell flag has been removed and lint-staged no longer supports evaluating commands directly via a shell. To migrate existing commands, you can create a shell script and invoke it instead. Lint-staged will pass matched staged files as a list of arguments, accessible via "$@":

    # my-script.sh
    #!/bin/bash
    echo "Staged files: $@"

    and

    { "*.js": "my-script.sh" }

    If you were using the shell option to avoid passing filenames to tasks, for example bash -c 'tsc --noEmit', use the function syntax instead:

    export default { '*.ts': () => 'tsc --noEmit' }
  • #1546 158d15c Thanks @​iiroj! - Validation for deprecated advanced configuration has been removed. The advanced configuration was removed in lint-staged version 9 and until now validation has failed if advanced configuration options were detected. Going forward the entire configuration will be treated with the same logic and if these advanced options are still present, they might be treated as valid globs for staged files instead.

  • #1546 158d15c Thanks @​iiroj! - The lowest supported Node.js version is 20.18. Please upgrade your Node.js version.

Minor Changes

  • #1401 27110ef Thanks @​RohitLuthra19! - Added support for directly running functions on staged files. To configure a function task, use an object with a title and the task itself:

    export default {
      '*.js': {
        title: 'My task',
        task: async (files) => {
          console.log('Staged JS files:', files)
        },
      },
    }

... (truncated)

Changelog

Sourced from lint-staged's changelog.

16.0.0

Major Changes

  • #1546 158d15c Thanks @​iiroj! - Processes are spawned using nano-spawn instead of execa. If you are using Node.js scripts as tasks, you might need to explicitly run them with node, especially when using Windows:

    {
      "*.js": "node my-js-linter.js"
    }
  • #1546 158d15c Thanks @​iiroj! - The --shell flag has been removed and lint-staged no longer supports evaluating commands directly via a shell. To migrate existing commands, you can create a shell script and invoke it instead. Lint-staged will pass matched staged files as a list of arguments, accessible via "$@":

    # my-script.sh
    #!/bin/bash
    echo "Staged files: $@"

    and

    { "*.js": "my-script.sh" }

    If you were using the shell option to avoid passing filenames to tasks, for example bash -c 'tsc --noEmit', use the function syntax instead:

    export default { '*.ts': () => 'tsc --noEmit' }
  • #1546 158d15c Thanks @​iiroj! - Validation for deprecated advanced configuration has been removed. The advanced configuration was removed in lint-staged version 9 and until now validation has failed if advanced configuration options were detected. Going forward the entire configuration will be treated with the same logic and if these advanced options are still present, they might be treated as valid globs for staged files instead.

  • #1546 158d15c Thanks @​iiroj! - The lowest supported Node.js version is 20.18. Please upgrade your Node.js version.

Minor Changes

  • #1401 27110ef Thanks @​RohitLuthra19! - Added support for directly running functions on staged files. To configure a function task, use an object with a title and the task itself:

    export default {
      '*.js': {
        title: 'My task',
        task: async (files) => {
          console.log('Staged JS files:', files)
        },
      },
    }

... (truncated)

Commits
  • dad5490 chore(changeset): release
  • 1c19e82 build(deps): update dependencies and require Node.js 20.18
  • 08cf8f5 docs: update README.md and bump nano-spawn as major change
  • 276dcc8 refactor: simplify config validation
  • d4b7cac test: update tests
  • 0ee9ab8 fix: update TypeScript type definitions
  • 12525b2 refactor: rename functions
  • 541c353 refactor: separate "make cmd tasks" and "make function tasks"
  • 27110ef feat: added support for custom configuration
  • 52366f9 ci: update Node.js versions used in CI
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Summary by CodeRabbit

  • Chores
    • Updated the lint-staged tool to the latest version for development.

@dependabot dependabot bot added dependencies Bot label; pull requests that updates a dependency file javascript Pull requests that update javascript code labels May 12, 2025
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title refactor: bump lint-staged from 15.5.2 to 16.0.0 refactor: Bump lint-staged from 15.5.2 to 16.0.0 May 12, 2025
Copy link

coderabbitai bot commented May 12, 2025

📝 Walkthrough

Walkthrough

The version of the lint-staged package in the devDependencies section of package.json was updated from 15.5.2 to 16.0.0. No other changes were made to the file or project configuration.

Changes

File Change Summary
package.json Updated lint-staged in devDependencies from 15.5.2 to 16.0.0

Tip

⚡️ Free AI Code Reviews for VS Code, Cursor, Windsurf
  • CodeRabbit now supports VS Code, Cursor and Windsurf. This brings free AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Learn more

[!ANNOUNCEMENT]

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 8cbce7e and 25ddddb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-16.0.0 branch 2 times, most recently from 396ad63 to d7ec8ed Compare May 14, 2025 09:20
Bumps [lint-staged](https://github.com/lint-staged/lint-staged) from 15.5.2 to 16.0.0.
- [Release notes](https://github.com/lint-staged/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md)
- [Commits](lint-staged/lint-staged@v15.5.2...v16.0.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-version: 16.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-16.0.0 branch from d7ec8ed to 25ddddb Compare May 14, 2025 16:36
@parseplatformorg
Copy link
Contributor

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@mtrezza
Copy link
Member

mtrezza commented May 14, 2025

@coderabbitai review

Copy link

coderabbitai bot commented May 14, 2025

You are on the CodeRabbit Free Plan. In order to use the Chat feature, please upgrade to CodeRabbit Pro.

Copy link

coderabbitai bot commented May 14, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mtrezza
Copy link
Member

mtrezza commented May 14, 2025

@coderabbitai identify any necessary changes for upgrade

Copy link

coderabbitai bot commented May 14, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🌐 Web query:

lint-staged 16.0.0 release notes changelog breaking changes

💡 Result:

Lint-staged 16.0.0 was released with several major changes that could impact existing workflows. The new version introduces significant modifications to how commands are executed and raises the minimum Node.js version requirements.

Breaking Changes

Removed Shell Support

One of the most significant changes in lint-staged 16.0.0 is the removal of the --shell flag[2]. Previously, this flag allowed commands to be evaluated directly via a shell, but this functionality has been completely removed. Instead of using shell commands directly, you'll need to create a shell script and invoke it[2]. When using a shell script, lint-staged will pass matched staged files as a list of arguments, which you can access via "$@" in your script[2].

Updated Node.js Requirements

Lint-staged 16.0.0 has increased its Node.js version requirements. The minimum supported Node.js version is now 18.19.0 or 20.5.0, following requirements of its dependencies[6]. If you're using an older version of Node.js, you'll need to upgrade before you can use this version of lint-staged.

Process Spawning Changes

The library now uses nano-spawn instead of execa for spawning processes[2]. This change particularly affects users who run Node.js scripts as tasks, especially on Windows systems. If you're using Node.js scripts as tasks, you might need to explicitly run them with node[2]. For example:

{
  "*.js": "node my-js-linter.js"
}

Configuration Validation Changes

Advanced configuration options that were removed in version 9 are no longer separately validated[6]. These might now be treated as valid globs for tasks. If you were still attempting to use these advanced config options (even though they haven't been supported since v8), your configuration might now behave differently.

Other Features and Enhancements

In addition to the breaking changes, lint-staged provides TypeScript types for the configuration and main Node.js API[2][5]. You can use JSDoc syntax in your JS configuration files, and it's also possible to use the .ts file extension for configuration if your Node.js version supports it[2].

For reference, the previous version (15.x) included features like more detailed debug logs, better messaging around the automatic git stash that lint-staged creates as a backup, and TypeScript type definitions[2].

Citations:


🏁 Script executed:

#!/bin/bash
# Check Node.js engine requirements in package.json
echo "Checking Node.js engine requirements in package.json:"
grep -A 5 '"engines"' package.json || echo "No engines field found in package.json"

# Check lint-staged configuration in package.json
echo -e "\nChecking lint-staged configuration in package.json:"
grep -A 15 '"lint-staged"' package.json || echo "No lint-staged configuration found in package.json"

# Check for separate lint-staged config files
echo -e "\nChecking for separate lint-staged config files:"
find . -maxdepth 1 -name ".lintstagedrc*" -o -name "lint-staged.config.*"

# Check for package.json scripts that use lint-staged
echo -e "\nChecking for package.json scripts that use lint-staged:"
grep -A 20 '"scripts"' package.json | grep -i "lint-staged"

# Check Node.js version
echo -e "\nNode.js version required by package.json (if specified):"
grep "node" package.json | grep "engines" -A 2 || echo "Node.js version not explicitly specified in engines"

Length of output: 1551


🏁 Script executed:

#!/bin/bash
# Get the complete package.json
echo "Full package.json content:"
cat package.json

# Check for husky configuration
echo -e "\nChecking for husky configuration:"
grep -A 10 '"husky"' package.json || echo "No husky configuration found in package.json"
find . -maxdepth 1 -name ".husky" -type d

# Search for any files that might be using lint-staged
echo -e "\nSearching for files that reference lint-staged:"
grep -r "lint-staged" --include="*.js" --include="*.json" --include="*.md" . | grep -v "node_modules" | head -n 20

Length of output: 5696


🏁 Script executed:

#!/bin/bash
# Check for potential lint-staged config locations
echo "Checking for potential lint-staged configuration locations:"
find . -maxdepth 3 -name ".huskyrc*" 

# Check for GitHub workflow files that might use lint-staged
echo -e "\nChecking for GitHub workflow files:"
find .github -type f -name "*.yml" 2>/dev/null

# Check for commitlint config that might reference lint-staged
echo -e "\nChecking for commitlint config:"
find . -maxdepth 1 -name "commitlint*" -o -name ".commitlint*"

# Check for package manager config files that might reference lint-staged
echo -e "\nChecking for package manager config files:"
find . -maxdepth 1 -name ".npmrc" -o -name ".yarnrc" -o -name ".pnpmrc"

# Search JavaScript files for lint-staged references
echo -e "\nSearching for js files that might be using lint-staged:"
find . -name "*.js" -not -path "./node_modules/*" -not -path "./dist/*" | xargs grep -l "lint-staged" 2>/dev/null || echo "No JS files with lint-staged references found"

Length of output: 1144


🏁 Script executed:

#!/bin/bash
# Checking GitHub workflows for lint-staged references
echo "Checking GitHub workflow files for lint-staged references:"
grep -r "lint-staged" .github/workflows/ || echo "No references to lint-staged found in workflow files"

# Check if there's a .husky directory with pre-commit hooks
echo -e "\nChecking for pre-commit hooks in .husky directory:"
find .husky -type f -name "pre-commit" 2>/dev/null | xargs cat 2>/dev/null || echo "No pre-commit hook found in .husky directory"

# Looking for git hook related scripts in package.json
echo -e "\nChecking for git hook related scripts in package.json:"
grep -E '"(prepare|precommit|pre-commit|postinstall)"' package.json -A 2 || echo "No git hook related scripts found in package.json"

Length of output: 743


@mtrezza Based on my investigation of the codebase, I don't see any necessary changes required for upgrading lint-staged from 15.5.2 to 16.0.0. While lint-staged 16.0.0 does introduce breaking changes, they don't appear to impact this project because:

  1. I couldn't find any active configuration or usage of lint-staged in the repository:

    • No lint-staged configuration in package.json
    • No separate configuration files (.lintstagedrc)
    • No pre-commit hooks using lint-staged in .husky directory
    • No references to lint-staged in workflow files or scripts
  2. Your Node.js version requirements ("node": "18 || 19 || 20 || 22") are already compatible with lint-staged 16.0.0's requirements (18.19.0+ or 20.5.0+).

The upgrade appears to be a straightforward dependency update with no required configuration changes since lint-staged doesn't seem to be actively used in the project workflows.

@mtrezza mtrezza merged commit 15d3e7e into alpha May 14, 2025
11 checks passed
@mtrezza mtrezza deleted the dependabot/npm_and_yarn/lint-staged-16.0.0 branch May 14, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Bot label; pull requests that updates a dependency file javascript Pull requests that update javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants