Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented May 11, 2025

close #457
close #458

related prettier/prettier-eslint#1190


Important

Bump prettier-eslint to support ESLint v9 flat config, update Node.js compatibility, and modernize dependencies and configurations.

  • Behavior:
    • Added support for ESLint v9 flat configuration format.
    • Updated Node.js compatibility to require version 18 or higher.
    • Introduced new configuration files for Yarn and ESLint.
  • Breaking Changes:
    • Major version bump for prettier-eslint-cli.
    • Removed legacy ESLint and npm configuration files; users may need to update their setups.
  • Dependency Updates:
    • Upgraded and modernized dependencies and development tools.
    • Replaced and reorganized several project dependencies and scripts.
  • Chores:
    • Improved project configuration, metadata, and automation scripts.
    • Updated funding link and cleaned up documentation files.
  • Style:
    • Enhanced code consistency with formatting and style improvements across the codebase.
  • Tests:
    • Improved test reliability and consistency with updated mocks and configurations.
  • Documentation:
    • Removed outdated or redundant documentation files.

This description was created by Ellipsis for ff202c9. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for ESLint v9 flat configuration format.
    • Updated Node.js compatibility to require version 18 or higher.
    • Introduced new configuration files for Yarn and ESLint.
    • Added new GitHub Actions workflows for autofix, publishing, stale issue management, and enhanced CI.
  • Breaking Changes

    • Major version bump for prettier-eslint-cli.
    • Removed legacy ESLint and npm configuration files; users may need to update their setups.
  • Dependency Updates

    • Upgraded and modernized dependencies and development tools.
    • Replaced and reorganized several project dependencies and scripts, including switching from lint-staged to nano-staged.
  • Chores

    • Improved project configuration, metadata, and automation scripts.
    • Updated funding link and cleaned up documentation files.
    • Refined project metadata and package scripts for better automation.
  • Style

    • Enhanced code consistency with formatting and style improvements across the codebase.
  • Tests

    • Improved test reliability and consistency with updated mocks and configurations.
  • Documentation

    • Removed outdated or redundant documentation files.
    • Updated contributing guidelines to use Yarn commands instead of npm.
    • Adjusted README badge links and references.

@JounQin JounQin requested a review from Copilot May 11, 2025 09:51
@JounQin JounQin self-assigned this May 11, 2025
@JounQin JounQin added enhancement dependencies Pull requests that update a dependency file breaking labels May 11, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 11, 2025

🦋 Changeset detected

Latest commit: 2a03d6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
prettier-eslint-cli Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented May 11, 2025

Walkthrough

This update modernizes project tooling, dependencies, and configuration files. It upgrades Node.js and dependency versions, migrates ESLint and Yarn configurations to new formats, and removes obsolete or redundant files. The codebase is refactored for formatting consistency, and scripts are updated to support new workflows and compatibility with ESLint 9 flat config.

Changes

File(s) / Group Change Summary
.changeset/dry-cobras-fold.md, .changeset/pre.json Introduced a major version bump for prettier-eslint-cli with ESLint 9 flat config support and added a prerelease configuration file.
.codesandbox/ci.json Updated Node.js version from 16 to 18.
.eslintignore, .eslintrc.js, .npmrc, other/EXAMPLES.md, other/manual-releases.md Deleted obsolete configuration and documentation files.
.github/FUNDING.yml Updated custom funding URL.
.gitignore Reordered and consolidated entries, updated cache and lock file patterns.
.yarnrc.yml Added Yarn 4 configuration with custom plugin and binary path.
eslint.config.mjs Added new ESLint flat config with overrides and rule customizations.
babel.config.js, jest.config.js, test/override-config.js, src/messages.js, src/parser.js, src/uncaught-exception-handler.js, src/message.spec.js, src/prettier-eslint.js, src/uncaught-exception-handler.spec.js, __mocks__/glob.js Applied formatting improvements, added trailing commas, and updated code style.
__mocks__/fs.js Improved mock logic, expanded file path checks, and simplified error handling.
__mocks__/prettier-eslint.js Removed unnecessary ESLint directive.
package-scripts.js Updated format script to include mjs files and consolidated glob patterns.
package.json Modernized metadata, updated dependencies and scripts, migrated linting and formatting tool configs, and improved automation.
src/argv.js No-op change: replaced {} with {} as reduce initial value.
src/format-files.js Refactored imports, standardized formatting, improved error logging, and updated logic for clarity without changing functionality.
src/format-files.spec.js Unified filesystem mocking, improved regex matchers, and updated test handling.
src/index.js Reordered imports and removed ESLint directive.
test/tests/cli.spec.js Improved imports, updated output expectations, and refined error handling in tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant ESLint Flat Config
    participant Prettier-ESLint Formatter

    User->>CLI: Run prettier-eslint-cli with files/globs
    CLI->>ESLint Flat Config: Load configuration (v9+)
    CLI->>Prettier-ESLint Formatter: Format files using config
    Prettier-ESLint Formatter-->>CLI: Return formatted results
    CLI-->>User: Output success/failure/unchanged messages
Loading

Assessment against linked issues

Objective Addressed Explanation
Support ESLint v9 flat configuration (#457)
Migrate to Yarn v4 (#458)

Poem

A bunny hopped through configs anew,
With flat ESLint and Yarn in view.
Old files pruned, the scripts refined,
Dependencies fresh, all realigned.
Formatting neat, the codebase bright,
With every change, it feels just right.
🐇✨
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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? Create a ticket on our support page 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 docstrings to generate docstrings for this 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR bumps the version of prettier-eslint to support ESLint v9 flat config while updating dependencies, scripts, and configuration files to align with newer versions and practices. Key changes include updates to package.json (dependency versions, scripts, and metadata), the introduction of a new ESLint flat configuration in eslint.config.mjs replacing the old .eslintrc.js, and the removal of legacy documentation files.

Reviewed Changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Updated dependency versions and Node engine constraints; refined scripts and metadata
package-scripts.js Updated glob patterns in the format script
other/manual-releases.md, other/EXAMPLES.md Removed legacy documentation files
eslint.config.mjs Introduced new ESLint flat config using modern spread syntax
babel.config.js Minor configuration tweaks
mocks/*.js Various mock updates with consistent syntax adjustments
.yarnrc.yml, .yarn/plugins/* New Yarn configuration and plugin included
.npmrc Legacy NPM configuration removed
.github/FUNDING.yml Updated funding URLs
.eslintrc.js Removed in favor of new ESLint flat config
.eslintignore Removed as ESLint ignore patterns are expected to be handled via flat config
.codesandbox/ci.json Updated Node version for CI
.changeset/* New changeset files to drive the release process
Comments suppressed due to low confidence (2)

.eslintignore:1

  • The removal of .eslintignore implies that ESLint ignore patterns should now be handled through the new ESLint flat configuration. Please ensure that all necessary ignore patterns have been migrated appropriately.
node_modules

.eslintrc.js:1

  • The .eslintrc.js file has been removed in favor of the new eslint.config.mjs. It would be beneficial to update the documentation to guide users through this migration and any potential differences in configuration.
const config = {

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 11, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 4094f31 in 2 minutes and 50 seconds. Click for details.
  • Reviewed 1861 lines of code in 34 files
  • Skipped 3 files when reviewing.
  • Skipped posting 15 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/format-files.js:18
  • Draft comment:
    Nice use of a dedicated INDENT_COUNT constant for error messages. This improves consistency.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. src/format-files.js:20
  • Draft comment:
    Renaming LINE_SEPERATOR_REGEX to LINE_SEPARATOR_REGEX fixes a typo.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
3. package.json:16
  • Draft comment:
    The updated node engine version range is clear; verify that this bump preserves backward compatibility if needed.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. src/prettier-eslint.js:15
  • Draft comment:
    Ensure the fallback to '@prettier/eslint' is intentional and documented for users who haven't installed prettier-eslint manually.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that a fallback behavior is intentional and documented. This is a request for confirmation and documentation, which violates the rules against asking for confirmation or documentation updates.
5. src/parser.js:29
  • Draft comment:
    Consistent use of oneLine/stripIndent for help text improves readability. Good pattern!
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
6. src/format-files.js:18
  • Draft comment:
    Nice improvement: using the INDENT_COUNT constant consolidates the indentation value and improves maintainability in error logging.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
7. src/prettier-eslint.js:16
  • Draft comment:
    Ensure that the fallback using '@prettier/eslint' is intended and provides the expected ESLint v9 flat config compatibility.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. test/tests/cli.spec.js:189
  • Draft comment:
    Consider relying on process exit codes (or more explicit checks) rather than only inspecting stderr contents to determine success in the CLI runner. This can make error handling more robust.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. .github/FUNDING.yml:5
  • Draft comment:
    Typographical inconsistency: 'rx-ts' (line 5) does not match the variant 'rxts' used in the custom section (line 12). If these are meant to be the same entity, please update them for consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. .github/FUNDING.yml:6
  • Draft comment:
    Typographical inconsistency: 'un-ts' (line 6) differs from 'unts' in the custom section (line 13). If these represent the same identifier, consider unifying the naming.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. CODE_OF_CONDUCT.md:6
  • Draft comment:
    Typographical suggestion: In line 6, consider changing 'pledge to making participation' to 'pledge to make participation' for improved grammatical clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
12. ROADMAP.md:20
  • Draft comment:
    It looks like there's a typographical error on line 20. "Wont do" should probably be "Won't do" with an apostrophe. Could you please update it?
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
13. src/format-files.spec.js:47
  • Draft comment:
    Typographical error: In the test description on line 47, 'inclues' should be corrected to 'includes'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
14. src/prettier-eslint.js:12
  • Draft comment:
    It might be clearer to say "You can install prettier-eslint as a dependency..." instead of "as dependency". This small change improves the grammar.
  • Reason this comment was not posted:
    Comment was on unchanged code.
15. test/tests/cli.spec.js:44
  • Draft comment:
    Typo: The term 'undeterministic' is unusual. Consider replacing it with 'non-deterministic' for better clarity.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_qU4wT2ipcrt6U28S

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/dry-cobras-fold.md (1)

5-5: Clarify changeset description.
Consider expanding the summary to guide users through migrating to ESLint v9’s flat config (e.g., mention updating .eslintrc.jseslint.config.mjs).

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bda4b7f and 4094f31.

⛔ Files ignored due to path filters (4)
  • .yarn/plugins/plugin-prepare-lifecycle.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.1.cjs is excluded by !**/.yarn/**
  • src/__snapshots__/uncaught-exception-handler.spec.js.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (31)
  • .changeset/dry-cobras-fold.md (1 hunks)
  • .changeset/pre.json (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .eslintignore (0 hunks)
  • .eslintrc.js (0 hunks)
  • .github/FUNDING.yml (1 hunks)
  • .gitignore (1 hunks)
  • .npmrc (0 hunks)
  • .yarnrc.yml (1 hunks)
  • __mocks__/fs.js (1 hunks)
  • __mocks__/glob.js (5 hunks)
  • __mocks__/prettier-eslint.js (1 hunks)
  • babel.config.js (1 hunks)
  • eslint.config.mjs (1 hunks)
  • jest.config.js (2 hunks)
  • other/EXAMPLES.md (0 hunks)
  • other/manual-releases.md (0 hunks)
  • package-scripts.js (1 hunks)
  • package.json (2 hunks)
  • src/argv.js (1 hunks)
  • src/format-files.js (14 hunks)
  • src/format-files.spec.js (15 hunks)
  • src/index.js (1 hunks)
  • src/message.spec.js (1 hunks)
  • src/messages.js (1 hunks)
  • src/parser.js (12 hunks)
  • src/prettier-eslint.js (1 hunks)
  • src/uncaught-exception-handler.js (1 hunks)
  • src/uncaught-exception-handler.spec.js (3 hunks)
  • test/override-config.js (1 hunks)
  • test/tests/cli.spec.js (10 hunks)
💤 Files with no reviewable changes (5)
  • other/EXAMPLES.md
  • .eslintignore
  • .npmrc
  • other/manual-releases.md
  • .eslintrc.js
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/uncaught-exception-handler.js (4)
src/index.js (1)
  • logger (11-11)
src/prettier-eslint.js (1)
  • logger (3-3)
src/uncaught-exception-handler.spec.js (3)
  • logger (6-6)
  • logger (31-31)
  • logger (40-40)
src/format-files.js (1)
  • logger (35-35)
src/format-files.spec.js (1)
src/format-files.js (1)
  • globOptions (219-219)
🔇 Additional comments (73)
.github/FUNDING.yml (1)

15-15: Approve updated custom funding URL
The custom URL for JounQin has been correctly updated to the new afdian link. No further changes needed.

test/override-config.js (1)

3-4: Approve addition of trailing commas
Adding trailing commas in the quotes array and closing brace improves formatting consistency without altering behavior.

.changeset/pre.json (1)

1-8: Approve new pre-release configuration
The .changeset/pre.json file correctly initializes the pre-release mode with tag “alpha” and version “8.0.1”. This complements the major bump for ESLint v9 support.

babel.config.js (1)

7-13: Approve trailing commas in Babel config
Trailing commas have been added for consistent object and array literal formatting; there’s no functional impact.

src/argv.js (1)

6-8: Approve formatting change in normalize initializer
A trailing comma was added after the reducer’s initial value. This is purely stylistic and safe.

🧰 Tools
🪛 Biome (1.9.4)

[error] 6-6: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

.codesandbox/ci.json (1)

2-2: Approve Node.js version bump.
Updating from Node 16 to 18 aligns with the package.json engines field (^18.18.0 || ^20.9.0 || >=21.1.0).

.changeset/dry-cobras-fold.md (1)

1-3: Validate changeset metadata.
The YAML front-matter correctly declares a major bump for prettier-eslint-cli.

__mocks__/prettier-eslint.js (1)

1-7: Removal of require-await disable is acceptable.
The format mock returns Promises via Promise.resolve and throws synchronously—no async/await is used, so dropping the ESLint rule override poses no risk.

src/uncaught-exception-handler.js (2)

32-32: Consistent trailing comma in array literal.
Adding a trailing comma after the template literal in resolutionSteps is a no-op for logic and improves diff cleanliness.


39-39: Trailing comma in function call is valid.
The extra comma in the logger.error argument list is supported in Node 18+ and aligns with the project’s style guidelines.

src/messages.js (3)

5-5: Reorder export declarations.
Switching to export { failure, success, unchanged } is semantically neutral, but verify no downstream modules rely on the previous export order (though named exports are order-agnostic).


10-10: Add trailing comma for consistency.
Including a trailing comma after the template string in mf.compile() improves formatting uniformity.


17-17: Add trailing comma for consistency.
Same stylistic update as above; valid and enhances diff readability.

.yarnrc.yml (1)

1-10: LGTM: Proper Yarn Berry configuration added

This new configuration file sets up Yarn Berry (v4) with appropriate settings for the project:

  • Disables telemetry for privacy
  • Uses node-modules linker for compatibility
  • Adds the prepare-lifecycle plugin (important for npm scripts compatibility)
  • Pins to a specific Yarn version for consistency

This aligns with the PR's goal of modernizing the tooling to support ESLint v9 flat config.

src/index.js (1)

3-9: Import ordering improved

The changes reorganize imports while maintaining the critical order of the exception handler (which needs to be first). This improves code organization by grouping related imports together.

src/prettier-eslint.js (2)

8-8: Simplified error handling

Removed the unused error parameter in the catch block since it wasn't being utilized.


12-12: Style consistency improvement

Added trailing comma to maintain consistent formatting with modern JavaScript style conventions.

__mocks__/glob.js (9)

8-8: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


17-17: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


25-25: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


45-45: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


54-54: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


63-63: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


71-71: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


78-78: Style consistency: Added trailing comma

Added trailing comma to array elements for consistent code style.


84-84: Style consistency: Added trailing comma

Added trailing comma to string concatenation in error message for consistent code style.

src/uncaught-exception-handler.spec.js (3)

2-2: Improved code organization

Added blank line after the first import for better visual separation and readability.


20-20: Style consistency: Added trailing comma

Added trailing comma to the mocked logger methods for consistent code style.


56-56: Simplified error handling

Removed the unused error parameter in the catch block since it wasn't being utilized, improving code clarity.

src/message.spec.js (3)

1-1: Updated ESLint directive for v9 compatibility

The ESLint directive has been updated from import/namespace to import-x/namespace to maintain compatibility with ESLint v9's flat config format.


9-10: Added trailing commas for better formatting consistency

Adding trailing commas to arrays and objects is a good practice that improves consistency, makes future additions easier, and produces cleaner git diffs.

Also applies to: 13-14, 19-20, 23-24, 29-30, 33-35


38-44: Modernized iteration with for...of loops

Replacing nested forEach loops with for...of loops improves code readability and performance by using modern JavaScript iteration patterns.

package-scripts.js (1)

55-55: Updated format script to support ESLint v9 flat config

The format script glob pattern now includes .mjs files and no longer explicitly mentions .eslintrc.js, aligning with the migration to ESLint v9's flat config format.

__mocks__/fs.js (3)

9-9: Updated mock to support ESLint v9 flat config

The file check now uses the more modern .includes() method and properly handles both legacy .eslintrc files and the new eslint.config.* files used by ESLint v9's flat config.


13-15: Modernized string checks and improved error handling

Replaced indexOf with the more readable includes() method for string checks and simplified error handling logic.

Also applies to: 17-20


23-23: Simplified readdirSync mock implementation

The mock for readdirSync has been simplified to a concise arrow function that always returns an empty array.

.gitignore (1)

5-10: Updated .gitignore patterns for modern tooling

The .gitignore file has been updated with:

  1. A more general .*cache pattern to catch all cache files
  2. Proper configuration for Yarn 2+ (berry) by ignoring .yarn/* except for .yarn/releases and .yarn/plugins

These changes align with the PR's overall modernization of the project's tooling and workflow.

src/parser.js (3)

1-1: Approve update to use explicit Node.js module specifier.

The change from 'path' to 'node:path' follows the recommended Node.js best practice for importing core modules, making the module source explicit.


4-5: Approve import statement cleanup.

The import is now properly formatted with destructuring to import only the specific functions needed from the common-tags package.


23-24: Approve formatting consistency improvements.

The addition of trailing commas to object properties and standardization of multiline template literals improves code consistency and makes future changes easier by reducing git diff noise.

Also applies to: 28-29, 32-33, 41-42, 50-51, 58-59, 65-66, 70-71, 75-76, 80-81, 92-93, 98-99, 103-104, 108-109, 112-113, 116-117, 128-129, 140-141, 148-149, 152-153, 167-168, 172-173, 183-184, 194-195, 207-208, 225-226

jest.config.js (2)

4-5: Approve JSDoc type annotation simplification.

The JSDoc type annotation has been simplified to directly import Config from Jest, improving type clarity while maintaining the same functionality.


18-20: Approve consistent formatting.

Added trailing commas and adjusted indentation in the coverageThreshold configuration object for better code consistency.

src/format-files.spec.js (7)

1-3: Approve explicit import naming for mocked filesystem.

Renamed import to mockFs which better reflects its role as a mocked module and makes the test code more readable.


6-7: Approve updated import syntax.

Updated the glob import to use the named import syntax which aligns with the package's current export style.


14-15: Approve workaround for mocking node:fs module.

The added comment and mock for 'node:fs' is necessary because of the transition to explicit Node.js module specifiers elsewhere in the codebase.


22-24: Approve consistent mock naming.

Updated references from the previous naming to the more explicitly named mockFs for better code consistency.


40-42: Approve regex pattern improvements for output matching.

Updated regex patterns to include Unicode line terminators (\u2028, \u2029) which makes the tests more robust against different types of line breaks.

Also applies to: 96-98, 126-131, 222-224, 236-238, 256-258, 270-272


280-286: Approve improved promise assertion syntax.

Updated to use modern async/await pattern with expect(...).resolves.not.toThrow() which provides clearer test assertions and better error messages.


332-333: Approve ESLint 9 flat config file support.

Updated the test to use eslint.config.mjs instead of the legacy .eslintrc, which aligns with ESLint v9's new flat configuration format that this PR is supporting.

test/tests/cli.spec.js (6)

2-5: Approve use of explicit Node.js module specifiers.

Updated imports to use the node: prefix for core modules and consolidated imports from 'common-tags', improving code clarity and maintainability.


14-14: Approve numeric separator for improved readability.

Using 20_000 instead of 20000 makes the timeout value more readable while maintaining the same numeric value.


37-38: Approve consistent formatting with trailing commas.

Added trailing commas to function calls, object literals, and array literals to maintain consistent formatting across the codebase.

Also applies to: 46-47, 58-60, 69-71, 78-79, 90-92, 99-100, 124-125, 130-134, 137-140


108-108: Approve use of globalThis instead of window.

Changed from window.baz to globalThis.baz which is a more environment-agnostic approach that works in both browser and Node.js environments.


149-152: Approve improved error handling.

Updated error variable name from stderr to error to better represent what's being caught, improving code clarity.


200-203: Approve use of replaceAll for string replacement.

Changed from regex-based replace to replaceAll which is more readable and potentially more efficient for replacing all occurrences of a string.

eslint.config.mjs (5)

1-7: Well-structured ESLint v9 flat config imports

The file correctly implements ESLint v9's flat config format with appropriate imports, including the essential typescript-eslint package for config generation. The Node.js-style imports follow modern conventions.


8-13: Good configuration structure with proper ignore patterns

The configuration extends base configs and correctly sets ignore patterns. The pattern '!test/fixtures/paths/node_modules/**/*.js' is a well-crafted negative pattern to selectively include specific files that would otherwise be ignored.


14-35: Comprehensive rule configuration aligned with project needs

The rules configuration disables formatting-related rules that would conflict with Prettier while maintaining important code quality rules. The settings for function spacing, quotes, and unused variables are appropriate for the project style.


36-45: Appropriate test file overrides

The configuration correctly overrides settings for test files by including Jest globals and disabling rules that are too restrictive for test code, such as no-magic-numbers and sonarjs/slow-regex.


46-52: File-specific rule override for hashbang

The configuration correctly disables the n/hashbang rule specifically for src/index.js, which likely contains a CLI entry point that needs a hashbang.

src/format-files.js (7)

1-5: Modern import statements with appropriate package replacements

The imports now use explicit node: protocol prefixes for Node.js built-ins, which is a recommended practice. The replacements of indent-string with @esm2cjs/indent-string and chalk with chalk-cjs address ESM compatibility issues in a CommonJS codebase.


12-14: Improved RxJS imports organization

The RxJS imports are now better organized, with base imports separated from operators, which improves code readability and maintainability.


18-20: Good constant extraction for consistent indentation

Extracting INDENT_COUNT as a constant ensures consistent indentation throughout error messages and improves maintainability. The LINE_SEPARATOR_REGEX pattern is also improved for better handling of different line endings.


73-74: Updated ESLint v9 configuration property

The property overrideConfigFile is correctly used for ESLint v9 configuration, replacing the deprecated property that would have been used with older ESLint versions.


91-108: Modern async/await syntax for stdin handling

The refactoring to use async/await for stdin handling improves code readability and maintainability compared to the previous approach. The function now properly returns the stdin value on error, which is a good error handling pattern.


225-237: Improved code formatting for file filtering logic

The refactoring of the file filtering logic improves readability with better indentation and a more concise boolean expression for determining whether to filter out files based on ignore patterns.


346-354: Updated line separator handling

The function now correctly uses the improved LINE_SEPARATOR_REGEX for splitting file content, ensuring consistent handling of different line ending formats.

package.json (6)

4-17: Updated package metadata and Node.js requirements

The package now correctly specifies:

  1. "type": "commonjs" to ensure Node.js treats the codebase as CommonJS
  2. Expanded metadata fields for better discoverability
  3. Yarn 4.9.1 as the package manager
  4. Updated Node.js engine requirements that align with current LTS versions

These changes provide better clarity for users and contributors.


28-35: Enhanced script commands for modern workflows

The updated scripts add a dedicated format command and enhance the prepare and version scripts to include additional tooling like yarn-berry-deduplicate. These changes improve the development workflow and ensure consistency.


46-63: Updated dependencies to support ESLint v9

The dependencies have been properly updated to support ESLint v9 with flat config:

  1. ESLint is updated to v9.26.0
  2. Prettier-eslint is updated to v17.0.0-alpha.0
  3. ESM packages have been replaced with CJS-compatible alternatives
  4. Other dependencies are updated to their latest compatible versions

These updates align directly with the PR objective.


66-91: Comprehensive development dependencies update

The dev dependencies have been thoroughly updated to support the modernized toolchain:

  1. Added ESLint and Prettier configs from @1stG
  2. Added typescript-eslint for ESLint v9 flat config support
  3. Added testing types and updated testing tools
  4. Added yarn-berry-deduplicate for dependency management

These changes ensure the development environment supports the updated dependencies.


92-98: Updated linting and formatting configuration

The configuration has been updated to:

  1. Replace lint-staged with nano-staged
  2. Use an external Prettier configuration
  3. Update the pre-commit hook to work with the new tools

These changes align with modern JavaScript tooling practices and ensure consistent code quality.


47-49:

Details

✅ Verification successful

Verify compatibility with alpha version dependency

The PR uses prettier-eslint@^17.0.0-alpha.0, which is an alpha version. While this is needed to support ESLint v9 flat config, alpha versions can introduce instability.


🏁 Script executed:

#!/bin/bash
# Check if there are any issues reported for the alpha version

echo "Checking for issues with prettier-eslint@17.0.0-alpha.0"
gh issue list --repo prettier/prettier-eslint --search "in:title,body 17.0.0-alpha" --state all

# Check if there are any newer versions available
echo "Checking for newer versions"
npm view prettier-eslint versions --json | grep -o '"17[^"]*"' | sort -V

Length of output: 375


No issues found with prettier-eslint@17.0.0-alpha.0

Verification shows:

  • No open or closed issues related to 17.0.0-alpha.0 in the prettier-eslint repo.
  • No newer alpha or beta releases past 17.0.0-alpha.0.

Since this alpha is required for ESLint v9 flat‐config support and there are no known blocking issues, it’s safe to proceed. Please remember to upgrade to a stable release when one becomes available.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed de8aaa1 in 2 minutes and 32 seconds. Click for details.
  • Reviewed 1837 lines of code in 31 files
  • Skipped 1 files when reviewing.
  • Skipped posting 36 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/dry-cobras-fold.md:5
  • Draft comment:
    Ensure the breaking change note clearly explains removal of legacy ESLint configs.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. eslint.config.mjs:8
  • Draft comment:
    Confirm that the flat config setup with tseslint.config meets ESLint v9 requirements.
  • Reason this comment was not posted:
    Confidence changes required: 40% <= threshold 50% None
3. package.json:15
  • Draft comment:
    Verify that the new Node engine requirements are communicated clearly in release notes.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
4. src/format-files.js:102
  • Draft comment:
    Using INDENT_COUNT consistently is good; confirm error formatting meets expectations.
  • Reason this comment was not posted:
    Confidence changes required: 10% <= threshold 50% None
5. src/format-files.spec.js:40
  • Draft comment:
    Regex patterns for snapshot matching are complex—ensure they are stable across environments.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
6. src/prettier-eslint.js:15
  • Draft comment:
    Fallback to '@prettier/eslint' is acceptable, but consider documenting differences from user-installed version.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
7. .changeset/dry-cobras-fold.md:1
  • Draft comment:
    Changelog entry clearly mentions the bump for ESLint v9 flat config support. Ensure that if needed, additional details about breaking changes and new behavior are provided.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to ensure that the changelog entry provides additional details. This falls under the rule of not asking the PR author to update the PR description or similar documentation. Therefore, this comment should be removed.
8. .changeset/pre.json:1
  • Draft comment:
    Pre-release configuration is set with mode 'pre' and tag 'alpha', which is appropriate for this major bump.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it simply states that the pre-release configuration is appropriate. It doesn't provide any actionable feedback or suggestions for improvement.
9. .codesandbox/ci.json:1
  • Draft comment:
    Node version bumped to 18 in the CI config. Verify that the sandbox environments fully support Node 18.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify compatibility with Node 18 in sandbox environments. This falls under the rule of not asking the author to ensure compatibility or verify behavior, which is not allowed.
10. .github/FUNDING.yml:15
  • Draft comment:
    Funding URL updated from afdian.net to afdian.com. Confirm that all funding links are correct and resolve as intended.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that all funding links are correct and resolve as intended. This falls under the rule of not asking the author to confirm or ensure behavior is intended.
11. .yarn/plugins/plugin-prepare-lifecycle.cjs:1
  • Draft comment:
    The new Yarn plugin for preparing the lifecycle is concise. Consider adding inline comments if future maintainers need context on its execution flow.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the code is somewhat dense without comments, it's a very small and straightforward plugin with clear purpose. The code follows a standard Yarn plugin pattern. The suggestion is more of a style preference than a critical issue. Adding comments would be nice-to-have but not essential for understanding the code. The code could become more complex in the future, making comments more valuable. Some developers might struggle with the compressed format. The code is extremely simple - just one line that follows a standard plugin pattern. Any Yarn plugin developer would understand this format. This comment should be deleted as it's more of a style suggestion than a critical issue, and the code is simple enough to understand without comments.
12. .yarnrc.yml:1
  • Draft comment:
    Yarn configuration now includes plugin details and a specific yarnPath; the settings look correct.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only states that the Yarn configuration looks correct. It doesn't provide any actionable feedback or suggestions for improvement.
13. __mocks__/fs.js:9
  • Draft comment:
    Using 'includes' instead of 'indexOf' for detecting '.eslintrc' or 'eslint.config.' improves readability and reliability in the mock.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
14. __mocks__/glob.js:3
  • Draft comment:
    Trailing commas added in returned arrays ensure consistent code style without affecting functionality.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
15. __mocks__/prettier-eslint.js:8
  • Draft comment:
    The mock for prettier-eslint correctly returns mocked outputs or throws errors for specific inputs. This keeps tests isolated.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only praises the current implementation without suggesting any changes or improvements. It doesn't provide any actionable feedback or raise any concerns.
16. babel.config.js:4
  • Draft comment:
    Babel configuration now includes trailing commas for improved formatting consistency; no semantic changes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that the Babel configuration now includes trailing commas for formatting consistency. It does not provide a suggestion, ask for confirmation of intent, or point out a potential issue. According to the rules, purely informative comments should be removed.
17. eslint.config.mjs:8
  • Draft comment:
    The new ESLint flat config using tseslint.config effectively merges multiple configurations to support ESLint v9 flat settings. Ensure that the merge order meets your linting requirements.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and suggests ensuring that the merge order meets linting requirements, which violates the rule against asking the PR author to ensure behavior is intended or tested.
18. jest.config.js:1
  • Draft comment:
    Jest configuration appears solid with strict coverage thresholds. The 100% thresholds might be strict but seem intentional for this project.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only states that the Jest configuration appears solid and that the thresholds seem intentional. It doesn't provide any actionable feedback or suggestions for improvement.
19. package-scripts.js:54
  • Draft comment:
    The format script has been updated to include the 'mjs' extension in its glob pattern, ensuring modern JS module files are formatted.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change that was made without suggesting any action or asking for clarification. It doesn't align with the rules for useful comments.
20. package.json:15
  • Draft comment:
    package.json reflects updated dependencies, Node engine requirements, and peer dependency settings for ESLint v9 support. Verify that the fallback module for prettier-eslint is consistent with the peer version.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify consistency between the fallback module and the peer version, which is not allowed according to the rules. It is related to dependencies, which should not be commented on unless it's a specific suggestion or issue.
21. src/argv.js:1
  • Draft comment:
    The normalize function properly filters out keys containing dashes. Its use of Object.entries and reduce is clear and concise.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
22. src/format-files.js:1
  • Draft comment:
    Refactoring in format-files.js is solid: use of 'node:' built-in modules, introduction of INDENT_COUNT, renaming of LINE_SEPARATOR_REGEX, and improved error logging all enhance readability and consistency. The memoization for ignore file lookups appears correct.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply praises the changes made in the code without offering any constructive criticism or questions.
23. src/format-files.spec.js:1
  • Draft comment:
    Test specifications have been updated to use the mocked 'node:fs' module consistently. The tests cover various outcomes (write, listDifferent, ignore behavior) and use snapshots to verify output.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only praises the updates made to the test specifications without providing any actionable feedback or suggestions for improvement.
24. src/index.js:1
  • Draft comment:
    The entry point imports the exception handler first, then gets and normalizes CLI arguments before invoking formatFiles. The ordering and use of imports ensure that any early exceptions are caught.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply describes what the code is doing, which violates the rule against making purely informative comments.
25. src/message.spec.js:1
  • Draft comment:
    Message tests accurately verify the output of success, failure, and unchanged messages using MessageFormat. The test structure is clear.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only praises the existing test structure without providing any actionable feedback or suggestions for improvement.
26. src/messages.js:1
  • Draft comment:
    Message functions are implemented using MessageFormat and handle pluralization correctly. The templates clearly differentiate between singular and plural cases.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
27. src/parser.js:1
  • Draft comment:
    The parser configuration using yargs is comprehensive and includes detailed option descriptions. The use of coercePath ensures relative paths are handled properly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, praising the use of yargs and coercePath. It doesn't provide any actionable feedback or suggestions for improvement.
28. src/prettier-eslint.js:5
  • Draft comment:
    The fallback mechanism in prettier-eslint.js attempts to require the user-installed 'prettier-eslint', and if unavailable, falls back to '@prettier/eslint'. This supports ESLint v9 flat config. Logging informs the user of the fallback.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining the fallback mechanism in the code without suggesting any changes or asking for confirmation on specific code behavior. It doesn't align with the rules for useful comments.
29. src/uncaught-exception-handler.js:1
  • Draft comment:
    The uncaught exception handler logs detailed resolution steps and uses oneLine templates for clarity. It rethrows the error after logging, which is the expected behavior.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
30. src/uncaught-exception-handler.spec.js:1
  • Draft comment:
    The tests for the uncaught exception handler effectively verify that errors are logged (including trace markers) and rethrown. The mock reset ensures proper isolation between tests.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, praising the tests for their effectiveness. It doesn't provide any actionable feedback or suggestions for improvement.
31. test/override-config.js:1
  • Draft comment:
    The override config sets the quotes rule to use double quotes; this simple configuration is clear and effective.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, praising the configuration without providing any actionable feedback or suggestions. It doesn't align with the rules for useful comments.
32. test/tests/cli.spec.js:1
  • Draft comment:
    The CLI tests thoroughly cover various scenarios—from help output and file formatting to handling stdin and listing differences. Notably, the expectation change from 'window.baz' to 'globalThis.baz' is intentional for Node environments. Ensure documentation reflects this change if applicable.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a test file, not production code. The change from window to globalThis appears to be an implementation detail of how the formatter handles global object references. The comment is asking for documentation updates but this seems like an internal test detail that doesn't warrant user-facing documentation. Maybe this is an important API change that users of the library need to know about? The change from window to globalThis could affect how their code gets formatted. While the formatting behavior changed, this appears to be an internal implementation detail in a test file. If this was an important API change, it should be documented where the change was made, not in the test file. Delete the comment. It's asking for documentation updates based on a test implementation detail, and starts with "Ensure that..." which violates our rules.
33. src/format-files.spec.js:47
  • Draft comment:
    Typo: 'inclues' in the test name should be corrected to 'includes'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
34. src/parser.js:213
  • Draft comment:
    Minor typographical note: In the prose-wrap option description, consider revising 'BitBucket' to 'Bitbucket' to adhere to the standard capitalization for the service.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
35. src/prettier-eslint.js:12
  • Draft comment:
    Typographical error: Consider updating the message on line 12 to 'You can install prettier-eslint as a dependency to skip this message.' for improved clarity.
  • Reason this comment was not posted:
    Comment was on unchanged code.
36. test/tests/cli.spec.js:43
  • Draft comment:
    The term 'undeterministic' appears multiple times in this file. For clarity and consistency, consider replacing it with 'nondeterministic'. This will help future readers of the code understand that the order is not deterministic.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_66KW4Z9TVxFoKbJm

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed f1cdffc in 54 seconds. Click for details.
  • Reviewed 273 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 14 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/autofix.yml:1
  • Draft comment:
    Workflow looks good. Pinning commit hashes helps reproducibility. No changes needed.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. .github/workflows/ci.yml:24
  • Draft comment:
    CI workflow updated to use newer Node versions and pinned action commits. Looks fine.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. .github/workflows/pkg-pr-new.yml:16
  • Draft comment:
    Publish workflow uses yarn and pinned versions; configuration appears correct.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. .github/workflows/release.yml:27
  • Draft comment:
    Release workflow includes appropriate permissions and uses changesets. Everything looks good.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. .github/workflows/stale.yml:21
  • Draft comment:
    Stale issues workflow configuration is clear and correctly implemented.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
6. package.json:25
  • Draft comment:
    Keywords and scripts updated; version script now uses 'nps test.update' which is consistent with changes. Looks good.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
7. src/format-files.js:20
  • Draft comment:
    Changed LINE_SEPARATOR_REGEX to non-capturing form. This simplifies splitting without unnecessary capture groups.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
8. .github/workflows/autofix.yml:1
  • Draft comment:
    Workflow name is set to 'autofix.ci' as required for security, and action versions are pinned. Looks good.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
9. .github/workflows/ci.yml:17
  • Draft comment:
    CI workflow uses an updated Node.js matrix (18, 20, 22, 24) with Yarn caching and pinned actions; configuration appears consistent.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
10. .github/workflows/pkg-pr-new.yml:15
  • Draft comment:
    Publish workflow is correctly configured with Yarn LTS and pinned action versions; no issues found.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
11. .github/workflows/release.yml:38
  • Draft comment:
    Release workflow now uses Yarn commands ('yarn release' and 'yarn run version') with proper environment settings; ensure this aligns with your release process.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
12. .github/workflows/stale.yml:1
  • Draft comment:
    Stale issues workflow is properly set up with scheduling, concurrency, and required permissions; it looks correct.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
13. package.json:25
  • Draft comment:
    Keywords and scripts have been updated for better discoverability and consistent Yarn usage (e.g., in 'release' and 'version' scripts); verify these align with your CI/CD expectations.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
14. src/format-files.js:20
  • Draft comment:
    The LINE_SEPARATOR_REGEX no longer uses a capturing group, which simplifies splitting logic in getIsIgnored; this change is appropriate.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_C2RaZ2lrRcDieKul

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
package.json (1)

16-16: Confirmed Node.js engine compatibility
The "node" range mirrors ESLint’s supported versions.

🧹 Nitpick comments (2)
package.json (2)

34-40: Streamline scripts with Yarn-centric workflows

  • Added format script via nps.
  • prepare script now runs patch-package, simple-git-hooks, and deduplication; note that || exit 0 will swallow errors—consider capturing failures explicitly if required.
  • Updated release, test, and version scripts to integrate with Changesets and Yarn.

97-99: Configure nano-staged hook execution
The glob pattern and command (node ./dist --write) look correct but consider narrowing globs to exclude node_modules and limit to source files.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between de8aaa1 and f1cdffc.

📒 Files selected for processing (7)
  • .github/workflows/autofix.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/pkg-pr-new.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • .github/workflows/stale.yml (1 hunks)
  • package.json (2 hunks)
  • src/format-files.js (14 hunks)
✅ Files skipped from review due to trivial changes (3)
  • .github/workflows/autofix.yml
  • .github/workflows/pkg-pr-new.yml
  • .github/workflows/stale.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/format-files.js
🔇 Additional comments (21)
.github/workflows/release.yml (7)

8-10: Effective concurrency control
The concurrency block correctly ensures only one release workflow per branch runs at a time, preventing overlapping deployments.


12-15: Explicit minimal permissions
Granting contents: write, id-token: write, and pull-requests: write aligns with least privilege for release tasks.


23-23: Pin checkout action to commit
Locking actions/checkout to a specific SHA guarantees reproducible CI behavior.


28-28: Pin setup-node action to commit
Using a fixed commit for actions/setup-node ensures CI stability against upstream changes.


33-33: Use yarn --immutable for reproducible installs
Switching to Yarn’s immutable install enforces lockfile consistency.


36-36: Standardized build step
Running yarn build aligns with the project’s Yarn-centric workflow.


43-47:

Details

❓ Verification inconclusive

Update Changesets action for Yarn workflows
Using yarn release and yarn run version integrates Changesets with Yarn scripts. Adding NPM_CONFIG_PROVENANCE=true is a good step toward reproducible metadata, but please verify that this env var is honored in Yarn v4.


🏁 Script executed:

#!/bin/bash
# Verify that Yarn v4 recognizes the npmConfigProvenance setting
yarn config get npmConfigProvenance

Length of output: 176


Verify Yarn v4 honors NPM_CONFIG_PROVENANCE
You’ve added NPM_CONFIG_PROVENANCE=true for reproducible metadata, but yarn config get npmConfigProvenance didn’t report a value (Yarn v4 doesn’t expose env-only configs via config get). Please manually confirm that your release artifacts include the provenance metadata when running under Yarn v4. For example:

  • Run
    NPM_CONFIG_PROVENANCE=true yarn run version && yarn release --dry-run
  • Inspect the generated package metadata (e.g., the .npmrc or provenance section) to ensure the setting was applied.
.github/workflows/ci.yml (7)

7-9: Apply concurrency control to CI runs
Ensures that only one CI workflow per branch/ref is active and stale runs are canceled.


17-21: Expand Node.js matrix to match engines
Testing against Node 18, 20, 22, and 24 aligns with the updated package.json engines.


24-25: Pin checkout action for CI
Locking actions/checkout to a specific SHA enhances reproducibility.


27-31: Pin setup-node and enable Yarn caching
The pinned actions/setup-node version and cache: yarn setting will speed up installs and avoid upstream surprises.


34-34: Reproducible install step
Using yarn --immutable enforces lockfile integrity in CI.


37-37: Consolidated lint/test/build command
Switching from npm start validate to yarn start validate keeps scripts consistent.


40-42: Pin Codecov action and require token
Updating to codecov-action@v5.4.2 and explicitly providing CODECOV_TOKEN improves security and reliability.

package.json (7)

4-14: Enhance project metadata and package format
Adding "type": "commonjs", expanded repository, homepage, author, maintainers, license, and packageManager fields modernizes the package manifest.


21-31: Define published files and keywords
Setting "main": "dist/no-main.js", "files": ["dist"], and an explicit "keywords" list ensures correct package contents and discoverability.


51-60: Upgrade and alias core dependencies
Introducing packages like @esm2cjs/indent-string, @prettier/eslint alias, and upgrading eslint to ^9.26.0 aligns this CLI with modern tooling.


71-79: Adopt standardized ESLint and Prettier configs
Adding @1stg/eslint-config and @1stg/prettier-config with Jest plugins ensures consistent linting across the codebase.


85-85: Introduce build and release tooling
Adding nano-staged, prettier@^3.5.3, rimraf, simple-git-hooks, typescript-eslint, and yarn-berry-deduplicate modernizes the pre-commit and build processes.

Also applies to: 90-95


102-103: Update pre-commit hook to use nano-staged
The pre-commit hook runs yarn nano-staged && yarn start validate, matching the new linting flow.


100-100:

Details

❓ Verification inconclusive

Centralize Prettier config
Pointing "prettier" to @1stg/prettier-config/semi simplifies formatting rules. Please verify that Prettier picks up this external preset.


🏁 Script executed:

#!/bin/bash
# Verify Prettier finds the external config
prettier --find-config-path .

Length of output: 130


Centralize Prettier config
You’ve updated the prettier field in package.json to point at @1stg/prettier-config/semi. To ensure Prettier picks up this external preset, please verify:

  • @1stg/prettier-config appears under devDependencies in package.json.
  • After running your install command (e.g. npm install), execute:
    npx prettier --find-config-path .
    and confirm it returns the path to
    node_modules/@1stg/prettier-config/semi (not null).
  • If it doesn’t resolve, inspect the package’s package.json (its "main" or "exports") to ensure the semi preset is correctly exported.

File: package.json
Lines: 100

  "prettier": "@1stg/prettier-config/semi",

@codecov-commenter
Copy link

codecov-commenter commented May 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (83691c5) to head (688a488).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #460   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          166       162    -4     
  Branches        29        25    -4     
=========================================
- Hits           166       162    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 49b88a9 in 1 minute and 11 seconds. Click for details.
  • Reviewed 47 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 9 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. package.json:51
  • Draft comment:
    Removed dependencies 'arrify' and 'boolify'. Confirm they're no longer used elsewhere.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that the removed dependencies are no longer used elsewhere. This falls under the rule of not asking the author to confirm or double-check things. Therefore, this comment should be removed.
2. package.json:59
  • Draft comment:
    Downgraded 'get-stdin' from ^9.0.0 to ^8.0.0. Verify this change doesn't affect functionality.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to verify that a downgrade in a dependency doesn't affect functionality. This falls under the rule of not asking the author to ensure behavior is intended or tested. The comment doesn't provide a specific suggestion or point out a specific issue with the code.
3. src/parser.js:6
  • Draft comment:
    Inline arrify function replicates the external module's behavior. Consider adding a brief comment for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. src/parser.js:243
  • Draft comment:
    Helper function 'coercePath' is declared after export. For clarity, consider moving it above the export statement.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. package.json:53
  • Draft comment:
    Remove 'arrify' dependency; replaced by inline implementation in src/parser.js.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that a dependency has been removed and replaced by an inline implementation. It does not provide any actionable feedback or suggestions for improvement.
6. package.json:54
  • Draft comment:
    Remove unused 'boolify' dependency.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
7. package.json:59
  • Draft comment:
    Downgrade 'get-stdin' to ^8.0.0; ensure API compatibility remains intact.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is about a dependency change, specifically downgrading a package version. The comment suggests ensuring API compatibility, which is a form of asking the author to double-check something. This violates the rules against commenting on dependency changes and asking for confirmation of intentions.
8. src/parser.js:6
  • Draft comment:
    Replace imported 'arrify' with an inline implementation; verify behavior matches the original module.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50% The comment suggests replacing an imported module with an inline implementation and asks to verify behavior. This violates the rule against asking the PR author to verify behavior. The suggestion to replace with an inline implementation could be useful, but the verification request is not allowed.
9. package.json:11
  • Draft comment:
    There is an unusual capitalization in the maintainer name "JounQin". Please confirm if this is the intended spelling or if it should be normalized (e.g., "Jounqin"). It might be a typo.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_slTBBCHPMbDJgfbB

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 79672a6 in 36 seconds. Click for details.
  • Reviewed 42 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/autofix.yml:14
  • Draft comment:
    Correctly granting write permissions for contents in autofix workflow, matching security requirements.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. .github/workflows/ci.yml:11
  • Draft comment:
    Setting contents permission to read in CI workflow ensures minimal access; looks good.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. .github/workflows/pkg-pr-new.yml:11
  • Draft comment:
    Appropriate read permissions provided for publish workflow.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. .github/workflows/autofix.yml:14
  • Draft comment:
    Good: Explicit 'permissions: contents: write' is added as required for the autofix workflow.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. .github/workflows/ci.yml:11
  • Draft comment:
    Good: 'permissions: contents: read' is explicitly set, enforcing least privilege in the CI workflow.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
6. .github/workflows/pkg-pr-new.yml:11
  • Draft comment:
    Good: 'permissions: contents: read' is defined, aligning with best security practices in the publish workflow.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_hM0bj31lt7e8eJtM

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/prettier-eslint-cli@460

commit: 688a488

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed bfe1847 in 40 seconds. Click for details.
  • Reviewed 27 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .gitattributes:1
  • Draft comment:
    Explicitly enforcing LF line endings with 'eol=lf' is acceptable, but ensure this change doesn't impact any non-UNIX environments.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. .nvmrc:1
  • Draft comment:
    Updated Node version to 22.15.0 meets the requirement for Node 18+.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. .prettierignore:1
  • Draft comment:
    Review the changes to ignored paths; removal of node_modules, coverage, etc. is intentional and won't affect Prettier's behavior.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. .gitattributes:1
  • Draft comment:
    Combined rule now forces LF for all files. Confirm that applying eol=lf universally (instead of only for .js files) is intentional.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. .nvmrc:1
  • Draft comment:
    Node version bumped to 22.15.0. Verify that this higher version (beyond the stated 18+) meets project compatibility requirements.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
6. .prettierignore:1
  • Draft comment:
    Updated ignore patterns: removal of node_modules, .nyc_output, coverage, and dist; addition of .yarn. Confirm this aligns with the intended project structure and that no essential folders are now skipped.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_Ek25FXq2OrCSMwUE

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed ab24813 in 1 minute and 32 seconds. Click for details.
  • Reviewed 97 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 14 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .gitattributes:1
  • Draft comment:
    Consider confirming that forcing LF endings on all text files (* text=auto eol=lf) won't disrupt developers on Windows.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. .nvmrc:1
  • Draft comment:
    Bumping Node version to 22.15.0 is consistent with requiring Node 18+; ensure this matches your CI and documentation.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. .prettierignore:1
  • Draft comment:
    Removing common directories (node_modules, .nyc_output, coverage, dist) from the prettier ignore list may impact users with these files; confirm this change is intended.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
4. CONTRIBUTING.md:11
  • Draft comment:
    Good update switching from npm to yarn commands; ensure all internal references and scripts align with Yarn usage.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. README.md:15
  • Draft comment:
    Removal of the Examples badge and updating LICENSE and CODE_OF_CONDUCT links appear correct. Verify that this removal is intentional and that corresponding documentation elsewhere is updated.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
6. .gitattributes:1
  • Draft comment:
    The consolidated setting '* text=auto eol=lf' now applies to all files. Please double‐check that removing the explicit '*.js' rule doesn’t inadvertently affect file types (e.g. binary or generated files) that might need different handling.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to double-check the impact of a change, which violates the rule against asking for confirmation or double-checking. It does not provide a specific suggestion or point out a clear issue.
7. .nvmrc:1
  • Draft comment:
    Bumping the Node version from 16.20.2 to 22.15.0 is a significant change. Make sure this upgrade is intentional and that the documentation and contributor guidelines reflect the new Node requirement.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is related to a dependency change, specifically the Node version. The comment asks the author to ensure the upgrade is intentional and to update documentation and guidelines, which violates the rules against asking for confirmation or updates to documentation.
8. .prettierignore:1
  • Draft comment:
    The ignore patterns have been revised—removing directories like 'node_modules', '.nyc_output', 'coverage', and 'dist' while adding '.yarn' and 'test/fixtures'. Confirm that these changes are intentional and won’t cause unintended formatting of generated or dependency files.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
9. CONTRIBUTING.md:11
  • Draft comment:
    The instructions have been updated from npm to yarn commands, which is clear and consistent. Please ensure that all referenced scripts (e.g. 'yarn start validate', 'yarn start test.update', etc.) are correctly defined in the project configuration.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
10. README.md:314
  • Draft comment:
    The links for LICENSE, Code of Conduct, and Roadmap have been updated and the Examples badge removed. Verify that removing the Examples section is intentional and that no essential documentation has been lost.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
11. CONTRIBUTING.md:61
  • Draft comment:
    Typographical error: Consider changing 'on you pull request' to 'on your pull request' for correct grammar.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and focuses on a typographical error, which does not impact the functionality or logic of the code. It does not provide a code suggestion or address a potential issue in the code itself.
12. CONTRIBUTING.md:74
  • Draft comment:
    Typographical error: 'Please checkout the [the open issues]' contains a duplicated 'the'. Consider removing one for clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
13. README.md:229
  • Draft comment:
    Typo: In the heading '### Knowed integrated package helpers', 'Knowed' should be corrected to 'Known'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
14. README.md:173
  • Draft comment:
    Typo: The word 'usefull' should be corrected to 'useful'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_pcz02KAqDf0ckxez

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed ff202c9 in 1 minute and 58 seconds. Click for details.
  • Reviewed 117 lines of code in 6 files
  • Skipped 1 files when reviewing.
  • Skipped posting 17 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .gitattributes:1
  • Draft comment:
    Ensure adding 'eol=lf' globally won’t affect files with intentional CRLF. Usually ok, but consider verifying on Windows.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
2. .nvmrc:1
  • Draft comment:
    Updated Node version to 22.15.0; verify that other tooling supports this version.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
3. .prettierignore:1
  • Draft comment:
    Review removal of common ignores (node_modules, nyc_output, coverage, dist). Confirm this change is intentional since now only '.yarn' and 'test/fixtures' are ignored.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment violates several rules. It's asking for confirmation of intention ("Confirm this change is intentional"). It's also speculative - it's not pointing out a definite issue, just asking if the author meant to do this. The author clearly made these changes deliberately, and if there are issues it would show up in the build or formatting checks. Maybe removing these common ignores could cause real formatting issues in the codebase that should be flagged? If removing these ignores caused actual problems, it would be caught by the build process when Prettier runs. We don't need to speculatively ask about it. Delete this comment as it's asking for confirmation of intention and making speculative concerns rather than pointing out a definite issue.
4. CONTRIBUTING.md:11
  • Draft comment:
    Updated instructions from npm to yarn commands; please double-check that all commands (including test updates and contributor scripts) work as expected.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
5. README.md:313
  • Draft comment:
    Links to LICENSE, CODE_OF_CONDUCT, and ROADMAP have been updated. Confirm that these updated paths reflect the repository structure.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
6. package.json:75
  • Draft comment:
    Replacing 'patch-package' with '@unts/patch-package' in devDependencies is noted. Please verify that the prepare script’s call to 'patch-package' still correctly resolves to the new package’s binary.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that a script still works after a dependency change. This falls under asking the author to double-check things, which is against the rules.
7. .gitattributes:1
  • Draft comment:
    Good consolidation of text settings; adding 'yarn.lock -diff' is a neat way to suppress diff noise for lock files.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
8. .nvmrc:1
  • Draft comment:
    Bumping the Node version from 16.20.2 to 22.15.0 aligns with the new engine requirements in package.json.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
9. .prettierignore:1
  • Draft comment:
    The ignore list is now limited to '.yarn' and 'test/fixtures'. Confirm that removal of common directories (like node_modules, coverage, and dist) is intentional to avoid formatting build or dependency files.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment violates several rules. It's asking for confirmation/verification rather than pointing out a clear issue. It's also about dependency/build related files which we're told to ignore. The author likely had a good reason for changing these patterns. The removal of node_modules could lead to performance issues with Prettier trying to format dependency files. Maybe this is a legitimate concern? Per the rules, we should not comment on dependency-related changes, and we should not ask for confirmations. The author must have intentionally made this change. This comment should be deleted as it violates rules about asking for confirmations and commenting on dependency/build related changes.
10. CONTRIBUTING.md:10
  • Draft comment:
    Updated commands from npm to yarn, which aligns with the updated project tooling.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
11. README.md:312
  • Draft comment:
    Updated link references for LICENSE and CODE_OF_CONDUCT (and removal of the Examples badge) make the docs cleaner and more accurate.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
12. package.json:75
  • Draft comment:
    The dependency switch from 'patch-package' to '@unts/patch-package' should be verified to ensure compatibility with existing patches.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
13. CONTRIBUTING.md:61
  • Draft comment:
    Typographical error: 'on you pull request' should be corrected to 'on your pull request'.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and focuses on a typographical error in a non-code part of the pull request. It doesn't provide any code suggestions or improvements.
14. CONTRIBUTING.md:74
  • Draft comment:
    Typographical error: Duplicate article in 'checkout the [the open issues]'. Consider revising to 'checkout the [open issues]'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
15. README.md:173
  • Draft comment:
    Typo: 'usefull' should be corrected to 'useful'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
16. README.md:230
  • Draft comment:
    Typographical error: 'Knowed integrated package helpers' should be 'Known integrated package helpers'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
17. package.json:78
  • Draft comment:
    The dependency '@unts/patch-package' appears to be a potential typo. Please double-check if this is the intended package name, or if it should instead be 'patch-package' (as was previously used).
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to double-check the dependency name, which is not allowed according to the rules. It is not making a specific code suggestion or asking for a test to be written. Therefore, it should be removed.

Workflow ID: wflow_UrHLMMLhS1TQNJ2A

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@JounQin
Copy link
Member Author

JounQin commented May 11, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented May 11, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (3)
__mocks__/fs.js (1)

21-21: Better error message formatting with template literals

The change to use template literals for the error message improves readability and is consistent with modern JavaScript practices.

jest.config.js (1)

4-5: Non-standard JSDoc import syntax.

The JSDoc block uses @import { Config } from 'jest' which is non-standard syntax for type imports in JSDoc. Consider revising this to a more conventional format.

Replace with one of these standard approaches:

- @type {Config}
- @import { Config } from 'jest'
+ @type {import('jest').Config}

Or:

- @type {Config}
- @import { Config } from 'jest'
+ @typedef {import('jest').Config} Config
+ @type {Config}
src/message.spec.js (1)

1-1: ⚠️ Potential issue

Fix typographical error in ESLint directive

The ESLint directive appears to contain a typographical error: import-x/namespace should likely be import/namespace, which is the standard ESLint rule name for this purpose.

-/* eslint import-x/namespace: [2, { allowComputed: true }] */
+/* eslint import/namespace: [2, { allowComputed: true }] */
🧹 Nitpick comments (2)
babel.config.js (1)

7-7: Update Node.js target in Babel configuration

Since the project is being updated to require Node.js 18+ (as seen in .nvmrc and PR objectives), consider updating the Babel target from Node 12 to at least Node 18 to maintain consistency.

- node: '12',
+ node: '18',
.github/workflows/pkg-pr-new.yml (1)

3-5: Consider refining workflow triggers to avoid duplicate runs

This workflow is configured to run on both push and pull_request events, which could lead to duplicate runs when a PR is created or updated (as both events would trigger). Consider using more specific event triggers or conditions to prevent unnecessary workflow executions.

on:
-  - push
-  - pull_request
+  push:
+    branches:
+      - main
+  pull_request:
+    types: [opened, synchronize]
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bda4b7f and ff202c9.

⛔ Files ignored due to path filters (4)
  • .yarn/plugins/plugin-prepare-lifecycle.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.1.cjs is excluded by !**/.yarn/**
  • src/__snapshots__/uncaught-exception-handler.spec.js.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (41)
  • .changeset/dry-cobras-fold.md (1 hunks)
  • .changeset/pre.json (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .eslintignore (0 hunks)
  • .eslintrc.js (0 hunks)
  • .gitattributes (1 hunks)
  • .github/FUNDING.yml (1 hunks)
  • .github/workflows/autofix.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/pkg-pr-new.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • .github/workflows/stale.yml (1 hunks)
  • .gitignore (1 hunks)
  • .npmrc (0 hunks)
  • .nvmrc (1 hunks)
  • .prettierignore (1 hunks)
  • .yarnrc.yml (1 hunks)
  • CONTRIBUTING.md (3 hunks)
  • README.md (1 hunks)
  • __mocks__/fs.js (1 hunks)
  • __mocks__/glob.js (5 hunks)
  • __mocks__/prettier-eslint.js (1 hunks)
  • babel.config.js (1 hunks)
  • eslint.config.mjs (1 hunks)
  • jest.config.js (2 hunks)
  • other/EXAMPLES.md (0 hunks)
  • other/manual-releases.md (0 hunks)
  • package-scripts.js (1 hunks)
  • package.json (2 hunks)
  • src/argv.js (1 hunks)
  • src/format-files.js (14 hunks)
  • src/format-files.spec.js (15 hunks)
  • src/index.js (1 hunks)
  • src/message.spec.js (1 hunks)
  • src/messages.js (1 hunks)
  • src/parser.js (12 hunks)
  • src/prettier-eslint.js (1 hunks)
  • src/uncaught-exception-handler.js (1 hunks)
  • src/uncaught-exception-handler.spec.js (3 hunks)
  • test/override-config.js (1 hunks)
  • test/tests/cli.spec.js (10 hunks)
💤 Files with no reviewable changes (5)
  • other/EXAMPLES.md
  • .eslintignore
  • other/manual-releases.md
  • .npmrc
  • .eslintrc.js
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/uncaught-exception-handler.js (4)
src/index.js (1)
  • logger (11-11)
src/prettier-eslint.js (1)
  • logger (3-3)
src/format-files.js (1)
  • logger (35-35)
src/uncaught-exception-handler.spec.js (3)
  • logger (6-6)
  • logger (31-31)
  • logger (40-40)
src/format-files.spec.js (1)
src/format-files.js (1)
  • globOptions (219-219)
src/format-files.js (3)
__mocks__/prettier-eslint.js (1)
  • format (8-17)
src/index.js (1)
  • logger (11-11)
src/prettier-eslint.js (1)
  • logger (3-3)
🔇 Additional comments (91)
README.md (3)

316-316: Update license link path
Removed the other/ prefix so that the [license] badge points to LICENSE at the repository root.


322-322: Update Code of Conduct link path
Removed the other/ prefix so that the [coc] badge now links to CODE_OF_CONDUCT.md at the repository root.


324-324: Update Roadmap link path
Removed the other/ prefix so that the [roadmap] badge now references ROADMAP.md at the repository root.

.github/FUNDING.yml (1)

15-15:

Details

✅ Verification successful

Verify updated Afdian funding URL.

The custom funding link for JounQin was changed to https://afdian.com/a/JounQin. Please confirm this URL is correct, reachable, and directs to the intended sponsorship page.


🏁 Script executed:

#!/bin/bash
# Verify the Afdian URL returns HTTP 200
curl -s -o /dev/null -w "%{http_code}" https://afdian.com/a/JounQin

Length of output: 73


Afdian funding URL verified and reachable

The URL https://afdian.com/a/JounQin returns HTTP 200, confirming it’s accessible and directs to the intended sponsorship page. No further action required.
File: .github/FUNDING.yml (Line 15)

.nvmrc (1)

1-1: Node.js version updated to 22.15.0

This upgrade aligns with the PR objective to require Node.js version 18+ and modernize the project's tooling environment.

babel.config.js (1)

10-13: LGTM: Improved code formatting with trailing commas

The addition of trailing commas improves code consistency and aligns with modern JavaScript style practices.

src/uncaught-exception-handler.js (1)

32-32: LGTM: Improved code formatting with trailing commas

The addition of trailing commas improves code consistency and aligns with modern JavaScript style practices.

Also applies to: 39-39

.gitattributes (1)

1-2: LGTM: Git attributes correctly configured for cross-platform development

The changes properly configure:

  1. Consistent line endings (LF) across all text files
  2. Disabled diff generation for yarn.lock to reduce noise in PRs

These changes align with the project's transition to Yarn and modern development practices.

__mocks__/prettier-eslint.js (1)

7-7: Whitespace change looks good

This is a minor formatting adjustment that improves code readability without changing functionality, consistent with the PR's goal of enhancing code consistency.

src/argv.js (1)

7-7: Trailing comma addition looks good

Adding the trailing comma follows modern JavaScript conventions and improves consistency in the codebase. This change has no functional impact but makes future diffs cleaner.

src/uncaught-exception-handler.spec.js (3)

2-2: Improved import organization

Adding a blank line between import groups improves readability by visually separating different types of imports.


20-20: Trailing comma addition is good

Adding the trailing comma follows modern JavaScript conventions and improves consistency in the codebase.


56-56: Good removal of unused error variable

Removing the unused e variable in the catch block is a good practice that aligns with modern JavaScript and linting standards. Empty catch blocks with no reference to the error are cleaner when you're intentionally ignoring the error.

__mocks__/fs.js (3)

9-9: Good addition of ESLint flat config support

The change to include eslint.config. in the file path check ensures that the fs mock correctly handles both traditional .eslintrc files and the new ESLint v9 flat configuration files. This directly supports the PR's main objective.

Using includes() instead of indexOf() !== -1 also improves code readability.


13-13: Improved string checking with includes()

Replacing indexOf() !== -1 with includes() is a good modernization that makes the code more readable while maintaining the same functionality.

Also applies to: 17-17


24-24: Simplified readdirSync mock

The concise arrow function implementation is cleaner and maintains the same functionality. This is a good simplification.

jest.config.js (1)

18-20: LGTM: Improved formatting with trailing commas.

Adding trailing commas improves consistency and makes future changes cleaner in version control.

.codesandbox/ci.json (1)

2-2: LGTM: Node.js version updated to 18.

This update aligns with the project-wide Node.js version upgrade and ensures compatibility with ESLint v9 and other updated dependencies.

.prettierignore (2)

1-1: LGTM: Added .yarn to ignore list.

Adding .yarn to the ignore list aligns with the new Yarn 4 configuration.


1-3:

Details

❓ Verification inconclusive

Verify removal of standard ignore directories.

Common directories like node_modules, coverage, and dist have been removed from the ignore list. Please confirm this is intentional as these are typically excluded from Prettier formatting.


🏁 Script executed:

#!/bin/bash
# Check if other configuration files might be handling these ignore patterns

echo "Checking .gitignore for common ignore patterns:"
if [ -f .gitignore ]; then
  grep -E "node_modules|coverage|dist|.nyc_output" .gitignore
fi

echo -e "\nChecking for eslint.config.mjs ignore patterns:"
if [ -f eslint.config.mjs ]; then
  grep -E "ignores|ignorePath|ignorePatterns" eslint.config.mjs
fi

echo -e "\nChecking package.json for prettier configuration:"
if [ -f package.json ]; then
  grep -A 10 "prettier" package.json
fi

Length of output: 3200


.prettierignore missing standard ignore patterns

The .prettierignore file now only excludes:

.yarn
test/fixtures

—but no longer ignores the usual directories (node_modules, coverage, dist) that are still listed in .gitignore. This may cause Prettier to format files in those folders.

Please confirm whether dropping these patterns was intentional. If not, consider restoring them, e.g.:

 .yarn
 test/fixtures
+node_modules
+coverage
+dist

Files to review:

  • .prettierignore (lines 1–3)
  • .gitignore (to see existing ignore patterns)
test/override-config.js (1)

3-4: LGTM: Added trailing commas for consistent formatting.

Adding trailing commas improves maintainability and makes future changes cleaner in version control by reducing diff noise.

.changeset/pre.json (1)

1-8: Changeset pre-release configuration is correctly setup

The configuration properly sets up an alpha pre-release track for the prettier-eslint-cli package with version 8.0.1 as the starting point, which aligns with the major version bump specified in the changeset file.

.changeset/dry-cobras-fold.md (1)

1-5: Major version bump is appropriately documented

The changeset correctly specifies a major version bump with the conventional commit syntax "feat!" indicating a breaking change for ESLint v9 flat config support. This is consistent with the project objectives.

CONTRIBUTING.md (5)

11-11: Package manager migration: npm to yarn

The replacement of npm commands with yarn commands is consistent with the project's migration to Yarn as the primary package manager.


12-12: Package manager command updated consistently

Changed npm start validate to yarn start validate, maintaining the same functionality while updating to the new package manager.


15-15: Updated nps command reference

The help command reference is properly updated to use yarn while maintaining the same nps functionality.


41-41: Contributors command updated

The all-contributors command is correctly updated to use yarn instead of npm.


58-58: Test update command migrated to yarn

The snapshot test update command is properly converted to use yarn while preserving the same functionality.

src/messages.js (3)

5-5: Export order changed for alphabetization

The export order has been changed to alphabetical order (failure, success, unchanged). This is a style improvement that makes exports easier to locate and is consistent with common JavaScript conventions.


10-10: Added trailing comma for better maintainability

Adding a trailing comma in the template string argument improves git diff readability for future changes and is consistent with modern JavaScript style conventions.


17-17: Consistent trailing comma style applied

Similarly to line 10, a trailing comma has been added here for consistency and to improve future diff readability.

.yarnrc.yml (1)

1-10:

Details

✅ Verification successful

Yarn configuration aligns with project modernization

The new Yarn configuration file correctly sets up the modern Yarn environment with appropriate settings:

  • Telemetry disabled for privacy
  • Node modules linking strategy specified
  • Prepare lifecycle plugin properly configured with security checksum
  • Specific Yarn version pinned for consistency

It's good practice to verify the plugin checksum. Run this script to validate the plugin file against its expected checksum:


🏁 Script executed:

#!/bin/bash
# Verify the checksum of the Yarn plugin

if [ -f ".yarn/plugins/plugin-prepare-lifecycle.cjs" ]; then
  echo "Calculating SHA-512 checksum of plugin file..."
  shasum -a 512 .yarn/plugins/plugin-prepare-lifecycle.cjs
  echo "Compare this with the checksum in .yarnrc.yml"
else
  echo "Plugin file not found in .yarn/plugins/"
fi

Length of output: 415


Let’s compute the SHA-512 using Python (since shasum isn’t available):


🏁 Script executed:

#!/bin/bash
# Verify SHA-512 checksum of the Yarn plugin via Python

if [ -f ".yarn/plugins/plugin-prepare-lifecycle.cjs" ]; then
  echo "Calculating SHA-512 checksum of plugin file via Python..."
  python3 - << 'EOF'
import hashlib
with open('.yarn/plugins/plugin-prepare-lifecycle.cjs','rb') as f:
    h = hashlib.sha512()
    for chunk in iter(lambda: f.read(8192), b''):
        h.update(chunk)
print(h.hexdigest())
EOF
  echo "Compare this output with the checksum in .yarnrc.yml"
else
  echo "Plugin file not found in .yarn/plugins/"
fi

Length of output: 436


✅ Plugin checksum verified and Yarn configuration approved

All settings are correct and the SHA-512 checksum of plugin-prepare-lifecycle.cjs matches the value in .yarnrc.yml.

  • Telemetry is disabled for privacy
  • nodeLinker: node-modules is specified
  • Prepare-lifecycle plugin is configured with a valid checksum
  • Yarn version is pinned for consistency
src/prettier-eslint.js (2)

8-8: Improved catch block syntax

The error parameter was removed from the catch block since it's not being used, which is a good practice to avoid unused variables.


12-12: Consistent trailing comma style

Adding the trailing comma to the string improves consistency with the codebase style and makes future additions cleaner.

__mocks__/glob.js (1)

8-8: Consistent trailing comma usage

All array elements and string concatenations now have trailing commas, ensuring consistent code style throughout the codebase. This improves readability and produces cleaner diffs when changes are made in the future.

Also applies to: 17-17, 25-25, 45-45, 54-54, 63-63, 71-71, 78-78, 84-84

src/index.js (2)

3-4: Removed unnecessary ESLint directive

The ESLint directive for disabling the "import/no-unassigned-import" rule was removed as it's no longer needed with the new ESLint v9 flat configuration. This aligns with the PR's goals of modernizing the linting setup.


6-9: Optimized import ordering

The imports have been reordered to group related functionality, with formatFiles now imported before parser. This improves code organization and readability.

src/message.spec.js (2)

9-10: LGTM: Style improvements with trailing commas

Adding trailing commas to the end of object properties and array elements is a good practice that minimizes diff changes in version control when new items are added later.

Also applies to: 13-14, 19-20, 23-24, 29-30, 33-35


38-44: LGTM: Improved iteration with for...of loops

Refactoring from nested forEach calls to nested for...of loops is a good change. This approach can make debugging easier since you can use break and continue statements if needed, and it slightly improves performance over array methods.

package-scripts.js (1)

55-55: LGTM: Updated format script for ESLint v9 compatibility

The format script has been appropriately updated to:

  1. Add .mjs file extension support, which is necessary for ESLint v9 flat config files
  2. Remove the explicit .eslintrc.js reference since this file is being removed as part of migrating to ESLint's flat config format

These changes align perfectly with the PR objective to support ESLint v9's flat configuration.

.gitignore (1)

8-10: LGTM: Yarn 2+ (Berry) specific ignore patterns

The added Yarn-specific patterns correctly follow modern Yarn 2+ practices where:

  1. Most of the .yarn/ directory is ignored
  2. .yarn/releases and .yarn/plugins are explicitly included in version control

This is the recommended approach for Yarn 2+ projects and aligns with the PR's dependency modernization efforts.

.github/workflows/pkg-pr-new.yml (3)

11-12: LGTM: Security best practice with explicit permissions

Explicitly setting minimal permissions (contents: read) is a security best practice for GitHub Actions workflows. This limits the scope of what the workflow can access, reducing potential security risks.


22-27: LGTM: Proper Node.js setup with caching

The workflow correctly sets up Node.js with the latest LTS version and enables Yarn caching, which helps improve workflow performance by reusing cached dependencies across runs.


28-35: LGTM: Efficient build and publish process

The workflow efficiently handles dependencies, building, and publishing the package:

  1. Uses --immutable flag for deterministic installations
  2. Builds the project before publishing
  3. Uses dlx to run the publishing tool without installing it globally

This approach follows modern CI/CD best practices.

.github/workflows/autofix.yml (1)

1-42: Good implementation of the autofix.ci workflow

The workflow is properly configured with necessary permissions, concurrency control, and pinned action versions. The implementation follows security best practices by explicitly setting permissions and using immutable Yarn installation.

src/parser.js (3)

1-1: Good update to use explicit Node.js module specifier

Using the node:path format follows current Node.js best practices for importing built-in modules.


6-16: Nice implementation of local arrify function

Replacing the external dependency with a local implementation reduces package dependencies and improves maintainability.


35-237: Good formatting and documentation improvements

The consistent addition of trailing commas and improved documentation strings throughout the file enhances code readability and maintainability.

.github/workflows/release.yml (2)

8-16: Good workflow security improvements

The addition of concurrency controls and explicit permissions follows GitHub Actions best practices and improves security.


23-47: Great modernization of the release process

Updating to pinned action versions and switching to Yarn with immutable installations improves reproducibility. The addition of NPM provenance is also a good security practice.

.github/workflows/stale.yml (1)

1-29: Well-configured stale issue management workflow

This workflow follows best practices for GitHub Actions with appropriate permissions, concurrency settings, and pinned action versions. The stale issue management will help maintain repository cleanliness.

src/format-files.spec.js (4)

1-16: Good mock standardization approach

The approach to standardize filesystem mocking by using the same mock for both fs and node:fs ensures consistent behavior across the test suite.


40-42: Improved test robustness for cross-platform compatibility

The updated regular expressions that handle Unicode line terminators improve test reliability across different platforms and environments.

Also applies to: 96-101, 126-131, 222-224, 236-238, 256-258, 270-272


280-286: Better promise handling in tests

Using await expect(...).resolves.not.toThrow() pattern is a more robust way to test that async operations don't throw exceptions.


332-333: Updated for ESLint v9 flat config

The test has been correctly updated to use the new ESLint v9 flat config file eslint.config.mjs instead of the legacy .eslintrc format.

.github/workflows/ci.yml (8)

7-9: Good addition of concurrency control!

Adding concurrency control prevents redundant CI runs on the same branch and improves CI efficiency by canceling in-progress runs when new commits are pushed.


11-12: Explicit permissions follow security best practices

Setting explicit permissions to read-only follows the principle of least privilege, which is a security best practice for GitHub Actions workflows.


20-24: Appropriate Node.js version updates

The updated Node.js matrix aligns with the Node.js engine requirement specified in package.json (18.18.0+). Testing across multiple Node.js versions (18, 20, 22, 24) ensures broad compatibility.


27-28: Security improvement: Pinning action to specific commit hash

Pinning the checkout action to a specific commit hash rather than a version tag is a security best practice that prevents supply chain attacks.


30-34: Improved Node.js setup with Yarn caching

Using an updated setup-node action with Yarn caching will significantly improve CI performance by avoiding redundant dependency downloads.


36-37: Migration from npm to Yarn package manager

Switching from npm i to yarn --immutable is consistent with the project's migration to Yarn as the package manager. The --immutable flag ensures reproducible installs.


39-40: Updated script execution for better consistency

Changing from npm start validate to yarn start validate maintains consistency with the package manager choice throughout the workflow.


42-45: Updated codecov action with explicit token

Upgrading the codecov action and using an explicit token parameter from secrets follows current best practices for the codecov integration.

test/tests/cli.spec.js (7)

2-5: Improved import organization and style

The changes use explicit node: specifiers for Node.js core modules and consolidated imports from common-tags, which improves import clarity and follows modern Node.js best practices.


14-14: Enhanced readability with numeric separator

Using the numeric separator in 20_000 for the Jest timeout improves readability while maintaining the same functionality.


46-47: Standardized formatting with trailing comma

Adding trailing commas in function arguments improves consistency across the codebase and makes future diffs cleaner when adding new items to lists.


107-108: Updated test to use globalThis instead of window

The replacement of window.baz with globalThis.baz in the expected output is appropriate since Node.js doesn't have a window object. globalThis provides a standardized way to reference the global this value across environments.


138-138: Simplifying error handling with a catch-all block

Using a simpler catch block without explicitly naming the error is sufficient here since the error is directly passed to the snapshot assertion.


149-151: Improved error handling generalization

Removing the specific error.stderr reference in favor of directly using the error object makes the error handling more general and robust, especially for different types of errors that might be thrown.


200-202: Enhanced string replacement using replaceAll

Using replaceAll instead of regex with the global flag is a more modern and readable approach for string replacement.

eslint.config.mjs (5)

1-7: Good ESLint flat config implementation

The new ESLint configuration uses the modern flat config format introduced in ESLint v9, properly importing dependencies and implementing TypeScript ESLint configuration.


8-13: Well-structured configuration with appropriate ignore patterns

The configuration extends from base configs and includes appropriate ignore patterns. The pattern '!test/fixtures/paths/node_modules/**/*.js' correctly includes JavaScript files in nested node_modules for testing purposes while ignoring other fixtures.


14-35: Comprehensive rule configuration

The rules configuration disables conflicting rules (like prettier/prettier), sets appropriate code style rules, and configures import and arrow function behavior consistently.


36-45: Appropriate test file overrides

The test file configuration correctly includes Jest globals and disables rules that would be problematic in test contexts, such as no-magic-numbers and sonarjs/slow-regex.


46-51: Specific override for src/index.js

Disabling the n/hashbang rule specifically for src/index.js is appropriate since this file likely contains a shebang line for CLI execution.

src/format-files.js (9)

1-5: Improved import organization with explicit Node.js specifiers

Using node: prefixes for core modules is a best practice that makes it clear these are Node.js built-in modules and helps prevent confusion with similarly named npm packages.


4-14: Updated dependencies and import structure

The changes replace chalk with chalk-cjs, use @esm2cjs/indent-string instead of indent-string, and reorganize RxJS imports for better clarity. These changes align with the project's dependency updates in package.json.


18-18: Added constant for consistent indentation

Adding the INDENT_COUNT constant ensures consistent indentation across error messages and improves maintainability.


20-20: Improved line separator regex pattern

The updated regex pattern properly handles different line ending styles (CR, LF, CRLF) without unnecessary capturing groups.


81-89: Enhanced function call formatting

Improved formatting with one argument per line and consistent trailing commas makes the code more readable and leads to cleaner diffs when arguments change in the future.


91-108: Simplified async/await pattern in formatStdin

The function now properly uses async/await throughout, making the code flow more readable and consistent. The error handling maintains the same behavior while using the new INDENT_COUNT constant for error formatting.


232-235: Improved condition readability

The conditional logic was refactored to be more expressive by using a negative condition directly in the return statement, which makes the code more concise while maintaining the same behavior.


255-263: Enhanced RxJS operator formatting

The RxJS pipe operators are now consistently formatted with proper indentation, making the reactive data flow easier to understand.


349-349: Using consistent line separator for file reading

The file now uses the updated LINE_SEPARATOR_REGEX constant when splitting lines from ignore files, ensuring consistent handling of different line ending styles.

package.json (7)

4-14: Add CommonJS module type and update project metadata
The new "type": "commonjs" and enriched metadata fields (repository, homepage, author, maintainers, license, packageManager) correctly reflect the migration to Yarn Berry and ESLint v9 flat config.


16-17: Align Node.js engine range with ESLint's requirements
Requiring Node.js ^18.18.0 || ^20.9.0 || >=21.1.0 follows ESLint v9’s own engine strategy and ensures compatibility across supported versions.


21-24: Reposition main field and restrict published files
Moving "main" and adding a "files": ["dist"] array cleanly scopes the package to compiled artifacts only.


25-31: Update project keywords
The expanded keyword list enhances discoverability in npm registries while remaining on-point for this CLI tool.


34-41: Modernize npm scripts for Yarn Berry workflows
Scripts (format, prepare, release, test, version) have been updated to use nps, simple-git-hooks, and yarn-berry-deduplicate. Please verify that the patch-package CLI is correctly resolved (especially if relying on @unts/patch-package).


51-67: Upgrade runtime dependencies
Dependencies have been bumped to support ESLint v9 flat config (e.g., eslint@^9.26.0, @prettier/eslint@^17.0.0-alpha.0, chalk-cjs, @esm2cjs/indent-string). These changes align with the PR objectives.


95-100: Configure nano-staged and simple-git-hooks
The nano-staged pattern and pre-commit hook (yarn nano-staged && yarn start validate) integrate formatting/validation nicely. Ensure the glob covers all relevant file types and that validate maps to a defined nps task.

Signed-off-by: JounQin <admin@1stg.me>
@JounQin
Copy link
Member Author

JounQin commented May 11, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented May 11, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (7)
src/message.spec.js (1)

1-1: Verify the ESLint rule name.

The ESLint directive has been changed from import/namespace to import-x/namespace. This appears to be a typographical error, as standard ESLint plugin rules typically use the format import/namespace. This matches the observations from previous review comments.

/* eslint import/namespace: [2, { allowComputed: true }] */
__mocks__/fs.js (1)

21-22: Improved error message with template literals

Using template literals for the error message improves readability.

.gitignore (1)

5-7: Remove duplicate .*cache entry

There's a duplicate .*cache pattern on lines 5 and 7. Having the same pattern twice in a .gitignore file is unnecessary and should be removed.

coverage
dist
node_modules
.DS_Store
.*cache
*.log
-.*cache
.yarn/*
!.yarn/releases
!.yarn/plugins
jest.config.js (1)

4-5: Non-standard JSDoc import syntax

The JSDoc block uses @import { Config } from 'jest' which is non-standard syntax for type imports in JSDoc. Consider revising this to a more conventional format:

- @type {Config}
- @import { Config } from 'jest'
+ @type {import('jest').Config}
src/format-files.js (1)

20-20: Fixed regular expression for line separation

The variable was renamed from LINE_SEPERATOR_REGEX to LINE_SEPARATOR_REGEX (fixing the typo) and the pattern was improved.

package.json (2)

16-16: Node.js engine requirement
The Node.js engine range matches ESLint's strategy for v9 support.


69-93: Check for typos in devDependencies
Entries such as @unts/patch-package and typescript-eslint likely contain typos and may cause resolution failures. Please confirm and update:

-  "@unts/patch-package": "^8.1.1",
+  "patch-package": "^8.1.1",

-  "typescript-eslint": "^8.32.0"
+  // e.g., "@typescript-eslint/parser": "^8.32.0" and/or "@typescript-eslint/eslint-plugin": "^8.32.0"
🧹 Nitpick comments (3)
.github/workflows/pkg-pr-new.yml (1)

3-5: Consider refining the workflow trigger conditions.

The workflow currently runs on both push and pull_request events, which might cause duplicate runs when PRs are updated with new commits. Consider refining the triggers to avoid this overlap:

on:
-  - push
-  - pull_request
+  push:
+    branches: [main]
+  pull_request:
+    branches: [main]

Alternatively, you could use conditional steps to avoid duplicate operations.

.github/workflows/stale.yml (1)

25-28: Consider adding more informative stale messages

The current stale messages are quite terse. Consider providing more context about why the item is being marked as stale and what actions users can take.

-          stale-issue-message: 'Stale issue'
-          stale-pr-message: 'Stale pull request'
+          stale-issue-message: 'This issue has been automatically marked as stale due to lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
+          stale-pr-message: 'This pull request has been automatically marked as stale due to lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
package.json (1)

95-97: Refactor nano-staged pattern for broader tool compatibility
Most glob libraries support brace expansion over extglob. To ensure all files match consistently, consider:

-  "*.+(js|json|md|mjs|yml)": "node ./dist --write"
+  "*.{js,json,md,mjs,yml}": "node ./dist --write"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bda4b7f and 8cd2cc6.

⛔ Files ignored due to path filters (4)
  • .yarn/plugins/plugin-prepare-lifecycle.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.1.cjs is excluded by !**/.yarn/**
  • src/__snapshots__/uncaught-exception-handler.spec.js.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (41)
  • .changeset/dry-cobras-fold.md (1 hunks)
  • .changeset/pre.json (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .eslintignore (0 hunks)
  • .eslintrc.js (0 hunks)
  • .gitattributes (1 hunks)
  • .github/FUNDING.yml (1 hunks)
  • .github/workflows/autofix.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/pkg-pr-new.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • .github/workflows/stale.yml (1 hunks)
  • .gitignore (1 hunks)
  • .npmrc (0 hunks)
  • .nvmrc (1 hunks)
  • .prettierignore (1 hunks)
  • .yarnrc.yml (1 hunks)
  • CONTRIBUTING.md (3 hunks)
  • README.md (1 hunks)
  • __mocks__/fs.js (1 hunks)
  • __mocks__/glob.js (5 hunks)
  • __mocks__/prettier-eslint.js (1 hunks)
  • babel.config.js (1 hunks)
  • eslint.config.mjs (1 hunks)
  • jest.config.js (2 hunks)
  • other/EXAMPLES.md (0 hunks)
  • other/manual-releases.md (0 hunks)
  • package-scripts.js (1 hunks)
  • package.json (2 hunks)
  • src/argv.js (1 hunks)
  • src/format-files.js (14 hunks)
  • src/format-files.spec.js (15 hunks)
  • src/index.js (1 hunks)
  • src/message.spec.js (1 hunks)
  • src/messages.js (1 hunks)
  • src/parser.js (12 hunks)
  • src/prettier-eslint.js (1 hunks)
  • src/uncaught-exception-handler.js (1 hunks)
  • src/uncaught-exception-handler.spec.js (3 hunks)
  • test/override-config.js (1 hunks)
  • test/tests/cli.spec.js (10 hunks)
💤 Files with no reviewable changes (5)
  • .npmrc
  • other/EXAMPLES.md
  • .eslintignore
  • .eslintrc.js
  • other/manual-releases.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/format-files.spec.js (1)
src/format-files.js (1)
  • globOptions (219-219)
🔇 Additional comments (97)
README.md (3)

316-316: Update LICENSE link to new path
The “other/” prefix has been removed to match relocation of the LICENSE file. Please verify that the link still points to the correct LICENSE in the repository root.


322-322: Correct CODE_OF_CONDUCT link path
Removed the outdated other/ subdirectory from the CODE_OF_CONDUCT link. Ensure the file is now available at the updated location.


324-324: Adjust ROADMAP link to reflect file relocation
The “other/” prefix has been dropped for the ROADMAP link. Confirm that ROADMAP.md exists at the new path.

.github/FUNDING.yml (1)

15-15: URL updated to the correct domain

The funding URL has been updated from "afdian.net/@JounQin" to "afdian.com/a/JounQin", reflecting the current valid domain and path format for this funding platform.

test/override-config.js (1)

3-4: Added trailing commas for better maintainability

Adding trailing commas after the last items in objects and arrays is a good practice as it:

  1. Creates cleaner diffs when adding new items
  2. Reduces syntax errors during future modifications
  3. Aligns with modern JavaScript style conventions

This change is consistent with the formatting standards being applied across the codebase.

src/uncaught-exception-handler.js (2)

32-32: Added trailing comma in array element

Adding trailing commas in multi-line array elements improves maintainability. This change is consistent with the formatting standards being applied throughout the codebase.


39-39: Added trailing comma in function arguments

Added trailing comma after the second argument in the logger.error call, maintaining consistent style with other similar changes in the codebase.

src/messages.js (2)

5-5: Reordered exports alphabetically

The exports have been reordered from { success, failure, unchanged } to { failure, success, unchanged }, which appears to follow alphabetical ordering. This improves readability without affecting functionality since named exports can be imported in any order.


10-10: Added trailing commas in function arguments

Added trailing commas after template strings passed to mf.compile() in both the success and failure functions. This maintains consistent style with other similar changes in the codebase.

Also applies to: 17-17

src/message.spec.js (2)

38-44: LGTM: Improved iteration with modern syntax.

Replacing nested forEach calls with for...of loops improves both readability and performance, as it avoids creating closures for each callback.


9-34: LGTM: Added trailing commas for better diffs.

Adding trailing commas to object properties and array elements is a good practice. It makes future diffs cleaner when new elements are added and aligns with modern JavaScript style guides.

src/uncaught-exception-handler.spec.js (2)

56-56: LGTM: Removed unused parameter.

Removing the unused error parameter from the catch block is a good improvement. It eliminates an unused variable and improves code clarity.


2-2: LGTM: Style improvements.

The added blank line after imports and trailing comma in the mock object definition improve code consistency and follow modern JavaScript style conventions.

Also applies to: 20-20

.codesandbox/ci.json (1)

2-2: LGTM: Updated Node.js version requirement.

Updating the Node.js version from 16 to 18 in the CodeSandbox CI configuration aligns with the project's updated requirements and supports compatibility with ESLint v9.

.nvmrc (1)

1-1: Verify Node.js version consistency across configurations.

The Node.js version has been updated to 22.15.0, which is significantly newer than the version 18 specified in .codesandbox/ci.json. While both versions satisfy the minimum requirement for ESLint v9 compatibility, this inconsistency could lead to different behavior between development and CI environments.

Consider either:

  1. Using the same Node.js version across all configuration files, or
  2. Ensuring that the project is tested against all supported Node.js versions, including this version 22.15.0.
.prettierignore (1)

1-1: Simplification of Prettier ignore patterns

The change to only explicitly ignore .yarn and retain test/fixtures is appropriate, as Prettier already handles common directories like node_modules by default. This change aligns with the project's migration to Yarn and modernized configuration approach.

.changeset/pre.json (1)

1-8: Well-structured pre-release configuration for changesets

The changeset pre-release configuration is properly set up with "alpha" tag and initial version 8.0.1, which correctly prepares for the major version bump to support ESLint v9 flat config.

CONTRIBUTING.md (1)

11-12: Package manager commands updated to use Yarn

All npm commands have been consistently replaced with their Yarn equivalents throughout the contribution guidelines, aligning with the project's migration to Yarn.

Also applies to: 15-15, 41-41, 58-58

.changeset/dry-cobras-fold.md (1)

1-5: Correctly configured changeset for major version bump

The changeset properly marks this as a major version change using conventional commit syntax with "feat!" prefix, accurately reflecting the breaking changes introduced by supporting ESLint v9 flat config.

__mocks__/prettier-eslint.js (1)

7-7:

Details

✅ Verification successful

Cleanup of unnecessary ESLint directive

The removal of the ESLint directive for disabling "require-await" is appropriate as part of the broader ESLint configuration modernization. Since the mock function is already returning promises without using async/await syntax, test functionality should remain unchanged.


🏁 Script executed:

#!/bin/bash
# Check if tests that use this mock are still passing
cd "$(git rev-parse --show-toplevel)"
fd --type file --extension spec.js | grep -E "format|prettier-eslint" | xargs grep -l "format" 

Length of output: 176


I’d like to confirm how the mock is being imported and used in the spec to ensure test behavior is unaffected:

This will help verify that removing the ESLint directive doesn’t alter runtime behavior.


🏁 Script executed:

#!/bin/bash
# Show imports and usage of the prettier-eslint mock in the spec
grep -R -n "prettier-eslint" src/format-files.spec.js
sed -n '1,200p' src/format-files.spec.js

Length of output: 7894


Let's verify that the mock isn’t using an async function and indeed only returns promises:


🏁 Script executed:

#!/bin/bash
# Inspect the mock to confirm no async/await usage
cd "$(git rev-parse --show-toplevel)"
grep -R -n 'async ' __mocks__/prettier-eslint.js || true
sed -n '1,200p' __mocks__/prettier-eslint.js

Length of output: 902


Cleanup of unnecessary ESLint directive

Verified that __mocks__/prettier-eslint.js contains no async functions (it returns Promises via jest.fn) and that all tests import and exercise this mock unchanged. Removing the /* eslint-disable require-await */ override has no effect on functionality or test outcomes.

babel.config.js (2)

7-7: Update to Node.js 18 is appropriate for ESLint v9 compatibility.

Upgrading the Node.js target from 12 to 18 aligns with the broader project modernization and is necessary for ESLint v9 compatibility, which requires Node.js 16+.


10-13: Formatting consistency with trailing commas.

Adding trailing commas throughout the configuration improves code formatting consistency and aligns with modern JavaScript style conventions. This change also makes future diffs cleaner when adding new items to arrays or objects.

src/argv.js (1)

7-7: LGTM! Trailing comma added for consistent formatting.

This is a non-functional change that adds a trailing comma to match the formatting style applied throughout the codebase.

.gitattributes (2)

1-1: Improved global line ending configuration.

Consolidating text attribute and line ending normalization into a single global rule ensures consistent line endings across all text files, which is especially important for cross-platform development.


2-2: Good practice for yarn.lock management.

Disabling diff generation for yarn.lock with -diff is a recommended practice when migrating to Yarn. This prevents large, automatically generated changes from cluttering PRs and code reviews.

src/prettier-eslint.js (2)

8-8: Removing unused error parameter in catch block.

Good cleanup of the unused error parameter in the catch block. This follows best practices for keeping code clean and avoiding unused variables. The Istanbul ignore comment is preserved to maintain coverage reporting.


12-12: Formatting consistency with trailing comma.

Adding a trailing comma to the string argument maintains consistent formatting with the rest of the codebase and matches the modern JavaScript style conventions applied throughout this PR.

.yarnrc.yml (1)

1-10: Well-structured Yarn configuration that follows best practices

The new Yarn configuration properly sets up the project with modern package management practices including security (plugin checksum), privacy (disabled telemetry), and reproducibility (pinned Yarn version).

__mocks__/glob.js (9)

8-9: Consistent code style with trailing commas

Adding trailing commas improves git diff cleanliness for future changes.


17-18: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


25-26: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


45-46: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


54-55: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


63-64: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


71-72: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


78-79: Consistent code style with trailing commas

Adding trailing commas follows modern JavaScript style guidelines.


84-85: Consistent code style with trailing commas

Adding trailing commas in the string concatenation improves consistency with the rest of the file.

src/index.js (2)

3-4: Improved code organization by removing unnecessary ESLint directive

Removing the ESLint disable comment aligns with the project's move to ESLint v9 flat config.


6-9: Improved import organization

Reordering imports and adding consistent spacing enhances code readability.

__mocks__/fs.js (4)

9-10: Added support for ESLint v9 flat config

The condition now properly handles both traditional .eslintrc files and the new flat config eslint.config.* files, which is essential for supporting ESLint v9.


13-15: Improved code readability with modern JavaScript features

Using includes() instead of indexOf() >= 0 makes the code more readable and concise.


17-19: Improved code readability with modern JavaScript features

Using includes() instead of indexOf() >= 0 makes the code more readable and concise.


24-25: Simplified mock implementation

Using an arrow function to return an empty array makes the mock implementation more concise.

package-scripts.js (1)

55-55: Good update to support ESLint v9 flat configuration.

The format script has been correctly updated to include .mjs files in the glob pattern while removing the explicit reference to .eslintrc.js. This change properly supports the migration to ESLint v9's flat configuration format.

.gitignore (1)

8-10: Good addition of Yarn 2+ configuration patterns.

The added Yarn-specific patterns correctly follow best practices for Yarn 2+/Berry projects:

  • Ignoring the .yarn/ directory contents
  • Preserving the releases and plugins subdirectories in Git

This aligns with the PR's migration to modern tooling.

jest.config.js (1)

18-20: Good style improvement with trailing commas.

Adding trailing commas to the coverage thresholds improves code consistency and makes future additions easier.

.github/workflows/pkg-pr-new.yml (4)

11-12: Good security practice with explicit permissions.

Setting explicit permissions with the minimum required scope (contents: read) follows security best practices by adhering to the principle of least privilege.


7-9: Good use of concurrency control.

The concurrency configuration properly prevents redundant workflow runs and cancels in-progress runs when new commits are pushed, which saves CI resources.


28-29: Good practice using Yarn with immutable installs.

Using yarn --immutable ensures reproducible builds by requiring the lockfile to match the current dependencies without modifications during installation.


20-20: Good security practice pinning action versions.

Pinning the action version with a full SHA hash (actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683) instead of just using a tag like v4 is a security best practice that prevents supply chain attacks.

.github/workflows/autofix.yml (2)

1-42: Well-structured GitHub workflow for automated code fixes 👍

This new workflow is well-configured with proper security considerations, pinned action versions, and modern CI practices.


14-16: Good security practice with explicitly defined permissions

Explicitly setting permissions to the minimum required level follows the principle of least privilege.

src/parser.js (3)

1-1: Good use of explicit Node.js built-in module specifier

Using node:path instead of path makes it clear this is a Node.js built-in module, which is a recommended practice for newer Node.js versions.


6-16: Nice implementation of local arrify function to reduce dependencies

Replacing the external dependency with a simple local implementation reduces the package's dependency footprint.


40-44: Consistent code formatting with trailing commas

Adding trailing commas throughout the codebase makes future modifications cleaner in version control and follows modern JavaScript style conventions.

Also applies to: 52-53, 61-62, 69-70, 81-82, 91-92, 103-104, 109-110, 114-115, 119-120, 123-124, 127-128, 139-140, 151-152, 159-160, 163-164, 178-179, 183-184, 194-195, 205-206, 218-219, 236-237

.github/workflows/release.yml (5)

8-10: Good use of concurrency controls

Adding concurrency controls to prevent multiple workflow runs executing simultaneously improves CI efficiency by canceling outdated runs.


12-16: Proper explicit permission settings for GitHub Actions

Setting explicit permissions follows security best practices by limiting the access scope of the GitHub token.


23-23: Great practice pinning GitHub Actions to specific commit hashes

Pinning to specific commit hashes rather than just version tags prevents supply chain attacks and ensures reproducible CI builds.

Also applies to: 28-28


33-33: Consistent use of Yarn commands

Replacing npm commands with Yarn commands ensures consistency with the project's package management approach.

Also applies to: 36-36, 43-44


47-47: Enabling npm package provenance for enhanced security

Setting NPM_CONFIG_PROVENANCE=true enables npm's package provenance which cryptographically verifies the package's source and build environment.

.github/workflows/stale.yml (1)

1-29: Automated workflow for handling stale issues/PRs

This workflow helps maintain repository cleanliness by automatically identifying and handling stale issues and pull requests.

src/format-files.spec.js (5)

1-3: Good test improvements for module consistency

The changes to import statements and mocking approach ensure that both regular and Node.js protocol imports are properly mocked, which is important for the modernized codebase.

Also applies to: 6-7, 10-11, 14-16


22-23: Consistent mock naming

Renaming fsMock to mockFs throughout the file improves code consistency and readability.


40-42: Improved regex patterns for test output matching

The updated regular expressions for matching console output are more robust by explicitly excluding newline characters and including Unicode line terminators.

Also applies to: 96-101, 126-131, 222-224, 236-238, 256-258, 270-272


280-286: Better Promise handling in tests

Using await expect(...).resolves.not.toThrow() is a more modern and clearer way to test asynchronous code that's expected to resolve without errors.


332-333: Updated test to use new ESLint config filename

The test now correctly uses eslint.config.mjs instead of .eslintrc, aligning with ESLint v9's flat configuration format.

.github/workflows/ci.yml (6)

7-9: Great addition of concurrency control!

Adding concurrency settings is a best practice that prevents redundant workflow runs, saving CI resources and reducing noise in the PR timeline.


11-12: Security improvement with explicit permissions

Explicitly setting minimal permissions (read-only for contents) follows the principle of least privilege and improves security.


20-24: Appropriate Node.js version updates

The Node.js versions now align with the project's requirement for Node.js 18+ as specified in package.json, and include testing across the current active LTS versions.


27-34: Improved action versioning and caching

Pinning to specific commit hashes rather than version tags provides better security and reproducibility. The addition of Yarn caching improves workflow performance.


36-40: Consistent package manager usage

Switching from npm to yarn with immutable installs ensures consistent dependencies across different environments and aligns with the project's migration to Yarn.


42-45:

Details

❓ Verification inconclusive

Updated codecov configuration

The codecov action has been updated to a newer version with proper token handling. Make sure the CODECOV_TOKEN secret is properly configured in the repository settings.


🏁 Script executed:

#!/bin/bash
# Check if the CODECOV_TOKEN is configured in repository secrets
gh api repos/{owner}/{repo}/actions/secrets | grep -q CODECOV_TOKEN && echo "✅ CODECOV_TOKEN is configured" || echo "❌ CODECOV_TOKEN is not configured"

Length of output: 275


Verify CODECOV_TOKEN secret configuration

Please confirm that the CODECOV_TOKEN secret is present under your repository Settings → Secrets. You can verify by running:

gh secret list --repo <owner>/<repo> | grep -q CODECOV_TOKEN && echo "✅ configured" || echo "❌ missing"

• File: .github/workflows/ci.yml (lines 42–45)
• Action: codecov/codecov-action@ad3126e

test/tests/cli.spec.js (6)

2-4: Improved module import style

Using the node: prefix for built-in modules is a recommended practice that explicitly indicates these are Node.js core modules and prevents potential conflicts with similarly named modules.


5-5: Cleaner import syntax

Consolidating imports from the same package improves code readability and maintainability.


14-14: Modern numeric separator usage

Using numeric separators for the timeout value improves readability.


108-108: Environment agnostic global object reference

Replacing window.baz with globalThis.baz is more appropriate for code that can run in both browser and Node.js environments, as window is browser-specific while globalThis works across environments.


138-140: Improved error handling

Catching a generic error instead of specifically stderr improves error handling robustness.


200-203: Better string replacement method

Using replaceAll instead of replace with a global regex is cleaner and more explicit about the intent to replace all occurrences.

eslint.config.mjs (5)

1-11: Well-structured ESLint flat config implementation

The new ESLint flat config properly imports and extends base configurations while utilizing TypeScript ESLint's config wrapper. This approach aligns with ESLint v9's recommended configuration pattern.


12-12: Comprehensive ignore patterns

The ignore patterns correctly exclude test fixtures while making an exception for JavaScript files in nested node_modules, which is important for testing path handling.


15-34: Well-balanced rule configuration

The rule configurations strike a good balance between code quality and practicality:

  • Disabling Prettier enforcement avoids conflicts with the project's own formatting
  • Setting specific spacing rules for different function types improves readability
  • Arrow function parentheses and quote style rules maintain consistent code style
  • SonarJS fixme/todo tags as warnings encourage addressing these markers without blocking development

These settings align with modern JavaScript development practices.


36-45: Appropriate test file overrides

The configuration correctly relaxes certain rules for test files, such as allowing magic numbers and disabling slow regex warnings, which are common in test scenarios.


46-51: File-specific rule exception

Disabling the hashbang rule specifically for src/index.js is appropriate as this is likely an executable entry point script.

src/format-files.js (7)

1-14: Modernized imports and dependencies

The changes make several improvements to imports:

  1. Using node: prefixes for Node.js core modules
  2. Switching to ESM-to-CJS variants of dependencies to maintain compatibility
  3. Improving organization and readability of imports

These changes help ensure compatibility while following modern JavaScript practices.


18-18: Good use of constant for indentation

Introducing the INDENT_COUNT constant improves maintainability by centralizing the indentation value used throughout the file.


78-89: Improved control flow

The conditional block has been simplified by removing an unnecessary else and returning directly. The code is now more concise and easier to follow.


91-94: Clearer stdin processing

Separating the getStdin() call and trimming into two steps improves readability and makes the code's intent clearer.


170-205: More explicit array length checks

Changing from truthy checks to explicit > 0 comparisons for array lengths makes the intent clearer and is more robust against potential edge cases.


226-236: Improved functional programming style

The refactored code uses a more concise arrow function style with implicit returns and cleaner conditional logic, making the code more readable and maintainable.


256-262: Simplified conditional logic

Removing the unnecessary else block and directly returning the result of the pipe operation makes the code more concise and easier to follow.

package.json (7)

4-8: Metadata updates look good
The addition of "type": "commonjs" and enrichment of repository, homepage, and author fields aligns with project requirements and improves package metadata.


10-14: Maintainers, license, and package manager fields updated
The maintainers list and license declaration appear correct, and the explicit packageManager ensures consistency in development environments.


21-31: Main entry and published files configuration
Defining main, files, and keywords ensures consumers install only the necessary output and improves discoverability.


34-41: Script commands updated for Yarn-based workflows
Switching format to nps, enhancing prepare, and integrating yarn-berry-deduplicate aligns the scripts with the new Yarn-centric CI/CD flows.


51-67: Validate alias dependencies mapping
You've aliased @prettier/eslint via npm:prettier-eslint@^17.0.0-alpha.0. Please verify that Yarn resolves this alias correctly and does not introduce duplicate package installs.


98-98: Verify external Prettier config resolution
Using a string to point at @1stg/prettier-config/semi is valid, but please ensure that Prettier can locate this package-based config in all environments.


100-101: Confirm existence of validate command in nps config
The pre-commit hook runs yarn start validate. Please verify that your nps configuration defines a validate script to avoid hook failures.

JounQin added 2 commits May 11, 2025 19:33
Signed-off-by: JounQin <admin@1stg.me>
Signed-off-by: JounQin <admin@1stg.me>
@JounQin
Copy link
Member Author

JounQin commented May 11, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented May 11, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/format-files.js (1)

20-20: Improved line separator regex pattern

The updated regex /\r|\r?\n/ properly handles all line ending types without capturing groups that get filtered out later.

🧹 Nitpick comments (5)
src/uncaught-exception-handler.js (2)

32-32: Added trailing comma for code consistency.

This change adds a trailing comma at the end of the template literal in the resolutionSteps array, improving code style consistency throughout the project.


39-39: Added trailing comma after the second argument in the logger.error call.

This change adds a trailing comma at the end of the second argument in the logger.error call, maintaining consistent code style with the other trailing comma changes in the file.

babel.config.js (1)

10-13: Added trailing commas for consistent formatting.

Added trailing commas after the corejs: 3 property and the inner and outer array elements. This improves code consistency and follows modern JavaScript style conventions.

package-scripts.js (1)

55-55: Consider adding .yaml support
If your repo contains .yaml files (e.g. CI configs), you may want to adjust the glob to **/*.{js,json,md,mjs,yml,yaml} for full coverage.

.gitignore (1)

3-9: Verify .yarn re-inclusion patterns
The rules
.yarn/*
!.yarn/releases
!.yarn/plugins
will ignore all of .yarn then re-include only the empty directories. To un-ignore their contents, you may need:

 .yarn/*
-!.yarn/releases
-!.yarn/plugins
+!.yarn/releases/
+!.yarn/releases/**
+!.yarn/plugins/
+!.yarn/plugins/**

This ensures files under those folders are tracked.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bda4b7f and 688a488.

⛔ Files ignored due to path filters (4)
  • .yarn/plugins/plugin-prepare-lifecycle.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.1.cjs is excluded by !**/.yarn/**
  • src/__snapshots__/uncaught-exception-handler.spec.js.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (41)
  • .changeset/dry-cobras-fold.md (1 hunks)
  • .changeset/pre.json (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .eslintignore (0 hunks)
  • .eslintrc.js (0 hunks)
  • .gitattributes (1 hunks)
  • .github/FUNDING.yml (1 hunks)
  • .github/workflows/autofix.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/pkg-pr-new.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • .github/workflows/stale.yml (1 hunks)
  • .gitignore (1 hunks)
  • .npmrc (0 hunks)
  • .nvmrc (1 hunks)
  • .prettierignore (1 hunks)
  • .yarnrc.yml (1 hunks)
  • CONTRIBUTING.md (3 hunks)
  • README.md (1 hunks)
  • __mocks__/fs.js (1 hunks)
  • __mocks__/glob.js (5 hunks)
  • __mocks__/prettier-eslint.js (1 hunks)
  • babel.config.js (1 hunks)
  • eslint.config.mjs (1 hunks)
  • jest.config.js (2 hunks)
  • other/EXAMPLES.md (0 hunks)
  • other/manual-releases.md (0 hunks)
  • package-scripts.js (1 hunks)
  • package.json (2 hunks)
  • src/argv.js (1 hunks)
  • src/format-files.js (14 hunks)
  • src/format-files.spec.js (15 hunks)
  • src/index.js (1 hunks)
  • src/message.spec.js (1 hunks)
  • src/messages.js (1 hunks)
  • src/parser.js (12 hunks)
  • src/prettier-eslint.js (1 hunks)
  • src/uncaught-exception-handler.js (1 hunks)
  • src/uncaught-exception-handler.spec.js (3 hunks)
  • test/override-config.js (1 hunks)
  • test/tests/cli.spec.js (10 hunks)
💤 Files with no reviewable changes (5)
  • other/EXAMPLES.md
  • .eslintignore
  • .npmrc
  • .eslintrc.js
  • other/manual-releases.md
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/uncaught-exception-handler.js (4)
src/index.js (1)
  • logger (11-11)
src/prettier-eslint.js (1)
  • logger (3-3)
src/uncaught-exception-handler.spec.js (3)
  • logger (6-6)
  • logger (31-31)
  • logger (40-40)
src/format-files.js (1)
  • logger (35-35)
src/format-files.spec.js (1)
src/format-files.js (1)
  • globOptions (219-219)
🔇 Additional comments (80)
.github/FUNDING.yml (1)

15-15: Approve updated Afdian funding URL
The custom funding link for “JounQin” has been updated to the new Afdian format (https://afdian.com/a/JounQin), which aligns with the current domain conventions.

README.md (3)

316-316: Updated license badge link
The [license] reference has been corrected to point at LICENSE in the repository root (dropping the removed other/ directory). This aligns with the cleanup of the other/ folder.


322-322: Updated Code of Conduct badge link
The [coc] reference now points to CODE_OF_CONDUCT.md in the repo root, matching the removal of the legacy file under other/.


324-324: Updated Roadmap badge link
The [roadmap] reference has been updated to the root-level ROADMAP.md, consistent with the directory restructuring.

.changeset/pre.json (1)

1-8: LGTM - Proper changesets pre-release configuration

The configuration correctly sets up an alpha pre-release mode for the prettier-eslint-cli package with version 8.0.1 as the starting point. This aligns with the PR's goal of preparing for a major version bump to support ESLint v9.

CONTRIBUTING.md (4)

11-12: LGTM - Updated npm commands to yarn

Correctly updated installation commands to use yarn instead of npm, which aligns with the project's migration to Yarn as indicated in the PR objectives.


15-15: LGTM - Updated help command reference

Consistently updated to reference yarn instead of npm while keeping the same nps functionality.


41-41: LGTM - Updated contributors command

Correctly updated to use yarn instead of npm for the contributors script.


58-58: LGTM - Updated test command

Consistently updated to reference yarn instead of npm for the test update command.

src/argv.js (1)

7-7: LGTM - Minor formatting improvement

The change adds a trailing comma to the reduce function's initial value, which is a stylistic improvement for consistency with modern JavaScript coding standards and doesn't affect functionality.

.gitattributes (1)

1-2: LGTM - Improved Git attributes configuration

This update makes two good improvements:

  1. Consolidated text and line ending normalization into a single global rule
  2. Added the -diff attribute for yarn.lock to prevent showing it in diffs, which is a best practice for lock files as they can be large and machine-generated

These changes align with modern Git workflow best practices and support the project's move to Yarn.

.github/workflows/stale.yml (1)

1-29: Well-structured GitHub Action for stale issues management

The implementation follows GitHub Actions best practices with clear scheduling, concurrency controls, and explicit permissions. The action is correctly pinned to a specific version with full commit hash for security.

.codesandbox/ci.json (1)

2-2: Node.js version update aligns with project requirements

The update from Node 16 to 18 aligns with the broader project-wide upgrade seen in other configuration files and the requirements mentioned in the PR objectives.

.prettierignore (1)

1-2: Simplified .prettierignore with Yarn-specific additions

The updated file removes standard directories that are now likely handled by default configurations or other mechanisms, while adding .yarn to support the Yarn 4 configuration mentioned in the PR objectives.

test/override-config.js (1)

3-4: Style improvement with trailing commas

The addition of trailing commas improves code consistency and aligns with modern JavaScript style practices. This change supports easier version control diffs when items are added to objects or arrays in the future.

.changeset/dry-cobras-fold.md (1)

1-6: Appropriate usage of changeset for breaking changes.

This changeset correctly identifies this as a major version bump due to ESLint v9 flat config support, which is a breaking change. The format follows the expected changeset structure with package name, bump type, and clear description.

__mocks__/prettier-eslint.js (1)

7-7: Removed ESLint disable comment for require-await.

The ESLint directive comment /* eslint-disable require-await */ has been removed. This is appropriate since the mock format function appears to be synchronous in its implementation but returns Promises, meaning the rule is no longer needed or is being handled at the project configuration level with the new ESLint flat config.

babel.config.js (1)

7-7: Updated Node.js target to version 18.

Updated the Babel configuration to target Node.js version 18 instead of the previous version 12. This aligns with the PR objective of requiring Node.js 18 or higher and supports the modernization efforts across the project.

src/messages.js (2)

5-5: Export order change looks good

The reordering of named exports is a style preference and doesn't affect functionality.


10-10: Style consistency improvement

Added trailing commas to template strings, which is consistent with modern JavaScript style guidelines and helps with cleaner git diffs when adding new items.

Also applies to: 17-17

src/prettier-eslint.js (2)

8-8: Improved catch block syntax

Removed unused error parameter from the catch block, which is a good practice when the error isn't being used.


12-12: Style consistency improvement

Added trailing comma to the log message, maintaining consistent style throughout the codebase.

.yarnrc.yml (1)

1-10: Yarn configuration looks good

The Yarn configuration is well-structured with appropriate settings:

  • Telemetry disabled for privacy
  • Using node-modules linker for compatibility
  • Properly configured plugin with checksum verification
  • Pinned to a specific Yarn version for consistency

This aligns with the PR objective of modernizing tooling and dependencies.

__mocks__/glob.js (1)

8-8: Style consistency improvement across mock data

Added trailing commas to all array elements and string concatenations in the mock implementation. This provides:

  • Consistent code style across the codebase
  • Cleaner git diffs when adding new items
  • Alignment with modern JavaScript style guidelines

These changes don't affect the functionality of the mock implementation.

Also applies to: 17-17, 25-25, 45-45, 54-54, 63-63, 71-71, 78-78, 84-84

__mocks__/fs.js (3)

9-9: Good update to support ESLint v9 flat configuration.

The mock now correctly handles both traditional .eslintrc and the new eslint.config.* format files, which aligns with the PR's goal to support ESLint v9 flat configuration.


21-21: Improved error message with template literals.

This change addresses a previous review comment by interpolating the filePath directly into the error message using template literals.


24-24: Clean simplification of the readdirSync mock.

The readdirSync mock has been simplified to a more concise arrow function, which is cleaner and follows modern JavaScript patterns.

src/index.js (2)

3-4: Improved code style by removing unnecessary ESLint directive.

The ESLint directive is no longer needed, which aligns with the move to the new ESLint v9 flat configuration.


7-9: Better import organization.

Reordering imports for better logical grouping and consistency.

src/message.spec.js (3)

9-10: Good use of trailing commas.

Adding trailing commas to objects and arrays is a good practice for cleaner version control diffs when items are added or removed.

Also applies to: 13-14, 19-20, 23-24, 29-30, 33-35


38-44: Improved test loop structure.

Replacing nested forEach loops with for...of loops improves readability and debugging capabilities.


1-1:

Details

✅ Verification successful

Verify the ESLint directive change.

The ESLint directive was changed from import/namespace to import-x/namespace, which contradicts previous review comments suggesting the opposite change. Please verify if this is intentional or a mistake.


🌐 Web query:

Is "import-x/namespace" a valid ESLint rule?

💡 Result:

Yes, import-x/namespace is a valid ESLint rule provided by the eslint-plugin-import-x plugin. This rule ensures that all properties accessed from a namespace import are exported by the module. For example, if you have import * as foo from './foo'; and then access foo.bar();, the rule will report an error if bar is not exported by ./foo. (github.com)

To use this rule, you need to install the eslint-plugin-import-x plugin and enable the rule in your ESLint configuration. Here's how you can do it:

  1. Install the Plugin:

    npm install eslint-plugin-import-x --save-dev
  2. Update Your ESLint Configuration:

    In your .eslintrc file, add import-x to the plugins array and enable the namespace rule:

    {
      "plugins": ["import-x"],
      "rules": {
        "import-x/namespace": "error"
      }
    }

This configuration will report an error whenever a property is accessed from a namespace import that isn't exported by the module. (github.com)

For more details on this rule and its options, you can refer to the official documentation. (github.com)

Citations:


No issues with import-x/namespace directive

The change from import/namespace to import-x/namespace is intentional and valid—this rule is provided by the eslint-plugin-import-x plugin and will correctly enforce namespace import checks. All other style and readability updates (trailing commas, blank line, for…of loops) look good.

src/uncaught-exception-handler.spec.js (2)

20-21: Consistent use of trailing commas.

Adding a trailing comma after the last property in the object is consistent with modern JavaScript style and improves version control diffs.


56-56: Removed unused catch parameter.

Good cleanup by removing the unused error parameter (e) in the catch block, which avoids declaring unused variables.

package-scripts.js (1)

55-55: Approve format script update for .mjs files
Including mjs in the glob ensures your new ESLint flat‐config (eslint.config.mjs) is formatted alongside other sources.

jest.config.js (1)

18-20: Approve added trailing commas
The extra commas in the coverageThreshold.global object improve diff stability and match the project’s style conventions.

.github/workflows/pkg-pr-new.yml (3)

1-6: Approve workflow name and triggers
Naming the workflow “Publish Any Commit” and running on both push and pull_request aligns with the intended use case.


7-10: Approve concurrency control
Using ${{ github.workflow }}-${{ github.ref }} with cancel-in-progress: true prevents duplicate runs per branch, which is a best practice.


11-13: Approve minimal permissions block
Specifying contents: read limits the GITHUB_TOKEN scope to just reading repo contents—good for security.

.github/workflows/autofix.yml (2)

1-1: Approve workflow naming requirement
The workflow’s name autofix.ci satisfies the security constraint of the autofix-ci/action.


14-16: Approve write permission for autofix
Granting contents: write is necessary for the action to push formatting fixes back to the PR.

src/parser.js (3)

1-1: Good modernization of Node.js imports

Using the explicit node:path import follows Node.js best practices for built-in modules, making the code more maintainable and explicit about its dependencies.


6-16: Great replacement of external dependency with local implementation

Replacing the external arrify dependency with a local implementation reduces package dependencies while maintaining the same functionality. The implementation properly handles all edge cases (null/undefined values, arrays, and non-arrays).


103-103:

Details

✅ Verification successful

Verify that all arrify calls use the local implementation

Make sure all calls to arrify in the codebase have been updated to use this local implementation.


🏁 Script executed:

#!/bin/bash
# Search for any remaining imports of the 'arrify' package
rg -l "import.*arrify" --type js

# Look for direct uses of arrify that may need to be updated
rg -l "\barrify\(" --type js

Length of output: 65


🏁 Script executed:

#!/bin/bash
# Search for any CommonJS requires of the 'arrify' package
rg -l "require\(['\"]arrify['\"]\)" --type js

Length of output: 51


All external arrify references removed

No remaining imports or requires of the external arrify package were found, and there are no direct calls to arrify( in the codebase. The local implementation is now used everywhere.

.github/workflows/release.yml (5)

8-10: Great addition of concurrency controls

Adding concurrency settings prevents multiple release workflows from running simultaneously on the same branch, which helps avoid race conditions and ensures reliable releases.


12-15: Improved security with explicit permissions

Following the principle of least privilege by explicitly setting required permissions is a security best practice for GitHub Actions.


23-23: Good practice pinning GitHub Actions to specific commits

Pinning to specific commit hashes rather than version tags adds security and reproducibility to your workflows.

Also applies to: 28-28


33-33: Standardized on Yarn package manager

Switching from npm to Yarn with the --immutable flag ensures consistent and reproducible builds across environments.

Also applies to: 36-36, 43-44


47-47: Enhanced security with npm provenance

Adding NPM_CONFIG_PROVENANCE=true improves supply chain security by generating provenance statements that verify the package was built in this specific GitHub Actions environment.

src/format-files.spec.js (4)

1-2: Improved mocking setup for Node.js module imports

The changes to explicitly mock both fs and node:fs imports with the same mock object ensures consistent behavior in tests when code uses either import style. The comment explaining this workaround is helpful for future maintainers.

Also applies to: 14-15


40-42: Enhanced output validation with improved regular expressions

The updated regular expressions now correctly handle all line terminator characters by explicitly excluding \n, \r, and Unicode line terminators (\u2028\u2029). This makes the tests more robust against different output formatting scenarios.

Also applies to: 96-101, 126-131, 222-224, 236-238, 256-258, 270-272


280-285: Improved async test pattern

Using await expect(...).resolves.not.toThrow() is a more explicit and clearer pattern for testing asynchronous code that should not throw exceptions, following Jest best practices.


332-332: Updated test to use ESLint's flat config format

Updating the eslintConfigPath to use 'eslint.config.mjs' instead of '.eslintrc' correctly adapts the test to the ESLint v9 flat configuration format, which is a key part of this PR's objectives.

.github/workflows/ci.yml (5)

7-9: Great addition of concurrency controls

Adding concurrency settings prevents multiple CI workflows from running simultaneously on the same branch, optimizing CI resources and preventing potential race conditions.


11-12: Improved security with explicit permissions

Explicitly setting minimal required permissions follows security best practices for GitHub Actions.


20-24: Modernized Node.js version matrix

Updating the test matrix to use Node.js 18, 20, 22, and 24 aligns with the PR's objective to support modern Node.js versions and drops support for EOL versions.


34-34: Enabled Yarn caching for faster CI runs

Adding the cache configuration for Yarn will significantly speed up CI runs by caching dependencies between workflow runs.


43-45: Updated CodeCov integration

Using a pinned version of the codecov action and explicitly providing the token improves security and reliability of the coverage reporting.

test/tests/cli.spec.js (5)

2-3: Good use of explicit Node.js module imports

Using the node: prefix for core Node.js modules is a best practice that helps clarify which imports are from Node.js core vs external packages.


14-14: Good use of numeric separator for improved readability

The numeric separator _ in 20_000 improves readability of the timeout value.


108-108: Appropriate replacement of window with globalThis

Replacing window.baz with globalThis.baz is a good improvement as it's more environment-agnostic and will work correctly in Node.js environments.


138-138: Modern error handling pattern applied

Using the parameter-less catch clause is a good modern JavaScript practice when you don't need to reference the error object.


200-203: Improved string replacement with replaceAll

Using replaceAll instead of a regex-based replacement is cleaner and more intuitive for replacing all occurrences of a string.

eslint.config.mjs (5)

1-7: Well-structured ESLint flat config imports

The imports correctly set up the necessary components for ESLint v9's flat configuration format, including the TypeScript ESLint config wrapper and other plugins.


8-13: Properly configured base and plugin extensions with ignore patterns

The configuration correctly extends the base configs and includes the recommended flat config from node-dependencies plugin. The ignore patterns are appropriately set to exclude test fixtures while allowing nested JavaScript files in node_modules for testing purposes.


14-35: Comprehensive rule customizations for project requirements

The rule customizations appropriately disable Prettier-related rules, JSDoc validation, and other rules that conflict with the project's style. The error level settings for unused variables with parameter exceptions and space-before-function-paren are well configured for the codebase style.


36-45: Well-defined test file overrides

The file-specific overrides for test files correctly add Jest globals and disable rules that would interfere with testing patterns like magic numbers and slow regex patterns.


46-51: Targeted rule exemption for entry point file

The specific override for src/index.js that disables the hashbang rule is appropriate for an executable entry point file.

src/format-files.js (6)

1-3: Good use of explicit Node.js module imports

Using the node: prefix for core Node.js modules is a best practice that helps clarify which imports are from Node.js core vs external packages.


4-6: Updated dependencies to address ESM compatibility

Switching to @esm2cjs/indent-string and chalk-cjs addresses ESM/CommonJS compatibility issues, which is important for the project's type: "commonjs" configuration.


18-18: Good extraction of magic number into constant

Creating the INDENT_COUNT constant improves code maintainability by centralizing the indentation value used across the codebase.


73-73: Updated ESLint config option name

The property name change from likely configFile to overrideConfigFile reflects updates in ESLint v9 API for configuration overrides.


81-88: Improved function call formatting

The formatting changes to this function call with one parameter per line and trailing commas improve readability and make future changes less prone to git diff issues.


232-234: Simplified conditional logic

The refactored return statement using !(condition) pattern improves readability over nested if/else conditions.

package.json (6)

4-4: Important module type specification

Adding "type": "commonjs" explicitly defines the module system, which is crucial for Node.js to correctly interpret imports/requires, especially with the move toward ESM in the ecosystem.


16-16: Updated Node.js engine requirements

The more specific Node.js version requirement aligns with ESLint v9's requirements and follows ESLint's versioning strategy.


36-38: Modern tooling workflow setup

The updated prepare and release scripts integrate patch-package, simple-git-hooks, and yarn-berry-deduplicate, creating a comprehensive development environment setup.


95-97: Switch from lint-staged to nano-staged

Replacing lint-staged with nano-staged is a good performance improvement as nano-staged is generally faster and lighter.


98-98: Simplified Prettier configuration

Using @1stg/prettier-config/semi instead of inline Prettier configuration improves maintainability and ensures consistency with the organization's style guidelines.


51-59:

Details

✅ Verification successful

Verify alpha dependency stability

The use of @prettier/eslint aliased to prettier-eslint@^17.0.0-alpha.0 could introduce instability. While necessary for ESLint v9 compatibility, monitor for any issues this might cause.


🏁 Script executed:

#!/bin/bash
# Check if there are any recent issues or PRs related to the alpha version
gh api graphql -f query='
{
  repository(owner: "prettier", name: "prettier-eslint") {
    issues(last: 5, states: OPEN) {
      nodes {
        title
        url
        createdAt
      }
    }
    pullRequests(last: 5, states: OPEN) {
      nodes {
        title
        url
        createdAt
      }
    }
  }
}'

Length of output: 524


Prettier-Eslint Alpha Dependency Stability Verified
A review of the last five open issues and pull requests on the prettier-eslint repo shows no reported problems with the ^17.0.0-alpha.0 release. The @prettier/eslint alias can remain as is—just continue to monitor upstream for any future fixes.

@JounQin JounQin merged commit 4fe5b81 into master May 11, 2025
17 checks passed
@JounQin JounQin deleted the feat/eslint_v9 branch May 11, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking dependencies Pull requests that update a dependency file enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: migrate to yarn v4 feat: support ESLint v9

4 participants