Skip to content

Use TroJS lint rules#63

Merged
w3nl merged 4 commits intomainfrom
feature/trojs-lint
Jun 16, 2025
Merged

Use TroJS lint rules#63
w3nl merged 4 commits intomainfrom
feature/trojs-lint

Conversation

@w3nl
Copy link
Contributor

@w3nl w3nl commented Jun 16, 2025

Summary by CodeRabbit

  • Chores
    • Updated Node.js version to 24 in all workflows and environment files.
    • Enabled automatic merging of dependency update pull requests.
    • Updated test scripts to use Node.js's built-in test coverage.
    • Updated and simplified ESLint configuration and dependencies.
  • Style
    • Improved code formatting and consistency in source and test files.
  • Tests
    • Adjusted test matrix to cover newer Node.js versions and removed older ones.

@w3nl w3nl requested a review from Copilot June 16, 2025 09:40
@coderabbitai
Copy link

coderabbitai bot commented Jun 16, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The updates focus on modernizing the Node.js version used across workflows, scripts, and configuration files, moving to Node.js 24. The ESLint configuration is refactored to use a consolidated linting package. Test scripts now leverage Node.js's built-in coverage. Renovate is configured for automatic PR merges. Minor formatting and syntax improvements are made.

Changes

Files/Group Change Summary
.github/workflows/cpd.yml,
.github/workflows/lint.yml,
.github/workflows/sonarcloud.yml,
.github/workflows/vulnerabilities.yml
Updated Node.js version from 20 to 24 in workflow setup steps.
.github/workflows/npm-publish.yml Updated Node.js to 24, added explicit GH_PAT usage, and introduced a step to set the package version from release tag before publishing. Minor formatting changes.
.github/workflows/test.yml Updated test matrix: removed Node.js 18.x, added 23.x and 24.x, retained 20.x–22.x.
.nvmrc Changed Node.js version from 22.11.0 to 24.
eslint.config.js Refactored to use @trojs/lint for plugins and rules, removed explicit rule definitions, updated globals and ECMAScript options, added JSDoc settings.
package.json Test scripts now use Node.js experimental coverage features; removed c8 and several ESLint-related devDependencies, added @trojs/lint, upgraded eslint and globals.
renovate.json Enabled automatic PR merging by adding automerge and automergeType.
src/form-data.js Added parentheses around single arrow function parameters in map and filter calls. No functional changes.
src/form-data.test.js Reformatted test data string concatenation and cleaned up whitespace and trailing commas. No logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant Node.js Environment
    participant NPM
    participant Renovate Bot

    Developer->>GitHub Actions: Push/PR triggers workflows
    GitHub Actions->>Node.js Environment: Setup Node.js 24
    GitHub Actions->>NPM: Run tests with built-in coverage
    GitHub Actions->>NPM: Publish package (npm-publish.yml)
    GitHub Actions->>Node.js Environment: Set package version from release tag
    Renovate Bot->>GitHub Actions: Create dependency update PR
    GitHub Actions->>Renovate Bot: Automerge PR (if enabled)
Loading

Poem

Hopping through code with a modern twist,
Node 24 leads the list!
Linting’s now neat, with rules all in one,
Coverage by Node, no more c8 run.
Renovate merges while I munch on hay—
This bunny’s proud of the work today! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-16T09_50_52_058Z-debug-0.log


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 556c00b and 7ad157f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .github/workflows/cpd.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/npm-publish.yml (2 hunks)
  • .github/workflows/sonarcloud.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .github/workflows/vulnerabilities.yml (1 hunks)
  • .nvmrc (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (2 hunks)
  • renovate.json (1 hunks)
  • src/form-data.js (2 hunks)
  • src/form-data.test.js (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

Need help? 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.

@w3nl
Copy link
Contributor Author

w3nl commented Jun 16, 2025

⚠️ Snyk checks are incomplete.

⚠️ security/snyk check encountered an error. (View Details)

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 updates the project’s linting and testing configurations to adopt TroJS lint rules while modernizing the Node.js version and CI workflows.

  • Updated lint rules and ESLint configuration to integrate @trojs/lint.
  • Modified test scripts and Node.js version configurations in package.json and .nvmrc.
  • Expanded supported Node versions in CI workflows and added automated version-setting in the npm publish workflow.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/form-data.test.js Reformatted form-data sample and test validation error messages.
src/form-data.js Minor code style adjustments in arrow function formatting.
renovate.json Added automerge settings to recommended configuration.
package.json Updated test commands and changed devDependencies for linting.
eslint.config.js Integrated TroJS lint plugins and rules with updated language options.
.nvmrc Upgraded Node version from 22.11.0 to 24.
.github/workflows/test.yml Extended Node.js version matrix for testing.
.github/workflows/npm-publish.yml Updated Node version, and added automated versioning before publishing.

git pull
npm version $TAG --no-git-tag-version
git add package.json package-lock.json
git commit -m "ci: set version to $TAG [skip ci]" || true
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

[nitpick] The use of '|| true' here may suppress commit errors and hide potential issues in the version update process. Consider handling commit failures explicitly so that any unexpected issues can be detected and addressed.

Suggested change
git commit -m "ci: set version to $TAG [skip ci]" || true
if ! git diff --cached --quiet; then
git commit -m "ci: set version to $TAG [skip ci]" || { echo "Error: git commit failed"; exit 1; }
else
echo "No changes to commit."
fi

Copilot uses AI. Check for mistakes.
languageOptions: { globals: globals.node },

languageOptions: {
ecmaVersion: 'latest',
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

[nitpick] Using 'latest' for ecmaVersion can expose the project to future breaking changes in ECMAScript standards. Consider pinning a specific version to maintain consistent behavior over time.

Suggested change
ecmaVersion: 'latest',
ecmaVersion: 2023,

Copilot uses AI. Check for mistakes.
@w3nl w3nl merged commit f457004 into main Jun 16, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments