Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

test: use oxlint instead of eslint #519

Closed
wants to merge 3 commits into from
Closed

test: use oxlint instead of eslint #519

wants to merge 3 commits into from

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Jun 28, 2024

eggjs/egg#5329

Summary by CodeRabbit

  • Chores

    • Switched linting script from eslint to oxlint for improved code quality checks.
    • Removed unnecessary dependencies: @tsconfig/node18 and @tsconfig/strictest.
    • Updated dependency list by removing specific versions of eslint and eslint-config-egg, and adding oxlint.
  • Style

    • Cleaned up code by removing unnecessary commented-out ESLint directives.
  • Tests

    • Updated test cases to correct regular expression patterns and improve readability.
    • Adjusted JSON response assertions to remove unnecessary escape characters.

Copy link

coderabbitai bot commented Jun 28, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes involve a significant update to the project's linting setup and dependency management. The lint script now utilizes oxlint instead of eslint, leading to the removal of several eslint-related dependencies. Additionally, configuration improvements and code cleanups enhance maintainability and readability.

Changes

File Change Summary
package.json Updated lint script to use oxlint. Removed dependencies @tsconfig/node18, @tsconfig/strictest, and specific versions of eslint and eslint-config-egg. Added oxlint dependency.
src/utils.ts Removed commented-out ESLint directive /* eslint no-control-regex: "off"*/.
test/mts/tsconfig.json Removed "extends" field referencing two other configuration files and adjusted compiler options.
test/options.dataType.test.ts Updated regular expression pattern in an assertion statement to match a specific string more accurately.
test/options.fixJSONCtlChars.test.ts Corrected control characters in a JSON response assertion by removing unnecessary escape characters.
test/user-agent.test.ts Updated regular expression pattern in an assertion related to the 'user-agent' header in a response object.

Poem

In the realm of code so bright,
Oxlint emerges, a new light.
Dependencies trimmed, clutter fades,
In clean code, progress pervades.
Tests refined, regex anew,
Oh, what a joy for the dev crew!
🌟🚀🐰


Tip

Early access features
  • OpenAI gpt-4o model for reviews and chat.

Note:

  • You can disable early access features from the CodeRabbit UI or by setting early_access: false in the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

socket-security bot commented Jun 28, 2024

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f1e546d and e19bb17.

Files selected for processing (6)
  • package.json (3 hunks)
  • src/utils.ts (1 hunks)
  • test/mts/tsconfig.json (1 hunks)
  • test/options.dataType.test.ts (1 hunks)
  • test/options.fixJSONCtlChars.test.ts (1 hunks)
  • test/user-agent.test.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • test/mts/tsconfig.json
  • test/options.dataType.test.ts
  • test/options.fixJSONCtlChars.test.ts
  • test/user-agent.test.ts
Additional context used
Biome
src/utils.ts

[error] 15-15: Unexpected control character(s) in regular expression: \u0000, \u001F

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)


[error] 125-125: Use the '**' operator instead of 'Math.pow'.

Unsafe fix: Use the '**' operator instead of 'Math.pow'.

(lint/style/useExponentiationOperator)

Additional comments not posted (3)
package.json (1)

26-26: Verify the new lint configuration.

The lint script has been updated to use oxlint. Ensure that oxlint is configured correctly to cover all the checks previously handled by eslint.

src/utils.ts (2)

15-15: Refactor to use the exponentiation operator.

The use of Math.pow can be modernized to use the exponentiation operator for better readability and performance.

- const MAX_ID_VALUE = Math.pow(2, 31) - 10;
+ const MAX_ID_VALUE = (2 ** 31) - 10;

Likely invalid or redundant comment.

Tools
Biome

[error] 15-15: Unexpected control character(s) in regular expression: \u0000, \u001F

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)


15-15: Confirm removal of ESLint directive.

Ensure that the removal of the ESLint directive no-control-regex: "off" does not lead to linting issues with oxlint, especially concerning control characters in regular expressions.

Tools
Biome

[error] 15-15: Unexpected control character(s) in regular expression: \u0000, \u001F

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)

"iconv-lite": "^0.6.3",
"oxlint": "^0.5.0",
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Remove residual eslint references.

Ensure that all references to eslint are removed or updated in the following files to avoid conflicts with the new oxlint setup:

  • src/HttpAgent.ts
  • src/HttpClient.ts
  • test/cjs/index.js
Analysis chain

Check for residual eslint references.

Ensure that all references to eslint and related configurations are removed from the project to avoid conflicts with the new oxlint setup.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Search for residual eslint references.

# Test: Search for eslint references. Expect: No occurrences.
rg --type json --type js --type ts 'eslint'

Length of output: 260

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.75%. Comparing base (21d4260) to head (2516adf).
Report is 1 commits behind head on master.

Files Patch % Lines
src/utils.ts 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #519      +/-   ##
==========================================
- Coverage   97.86%   97.75%   -0.12%     
==========================================
  Files          10       10              
  Lines        1596     1601       +5     
  Branches      256      257       +1     
==========================================
+ Hits         1562     1565       +3     
- Misses         30       32       +2     
  Partials        4        4              

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

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e19bb17 and b742796.

Files selected for processing (1)
  • package.json (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

@fengmk2 fengmk2 marked this pull request as draft June 29, 2024 02:18
@fengmk2
Copy link
Member Author

fengmk2 commented Jun 29, 2024

oxlint 目前规则太弱。。。估计搞不定。还是先保持目前的 eslint 8

@fengmk2
Copy link
Member Author

fengmk2 commented Jun 29, 2024

#520

@fengmk2 fengmk2 closed this Jun 29, 2024
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.

None yet

1 participant