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

bump eslint v9.5.0 #1268

Merged
merged 3 commits into from
Jun 17, 2024
Merged

bump eslint v9.5.0 #1268

merged 3 commits into from
Jun 17, 2024

Conversation

shogo82148
Copy link
Owner

@shogo82148 shogo82148 commented Jun 17, 2024

Summary by CodeRabbit

  • New Features

    • Introduced TypeScript checking for ESLint configurations for improved code quality.
  • Bug Fixes

    • Corrected a logic error in the creation process that could lead to unintended behavior.

Copy link

coderabbitai bot commented Jun 17, 2024

Walkthrough

The recent updates brought essential enhancements and fixes to the project. The primary focuses were updating TypeScript-related ESLint packages for better code quality, introducing a robust ESLint configuration with TypeScript checking in eslint.config.mjs, and correcting a logic error in src/create.ts where an assignment operator was mistakenly used in an if condition instead of a comparison operator.

Changes

Files Change Summary
package.json Updated versions of @typescript-eslint/parser and eslint-plugin-jest for better code compliance tools.
eslint.config.mjs Introduced with TypeScript checking, combining ESLint rulesets, and exporting the ESLint configuration.
src/create.ts Fixed a logic error by replacing an assignment operator with a comparison operator in an if condition.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant ESLint
    participant TypeScript

    Developer->>ESLint: Run linting
    ESLint->>TypeScript: Parse and check types
    TypeScript-->>ESLint: Return type checking results
    ESLint-->>Developer: Report linting results

    Note over Developer,ESLint: Developer writes code
    Note over ESLint,TypeScript: ESLint & TypeScript ensure code quality

Poem

In the land of code so bright and keen,
Updates come to keep it clean.
ESLint checks with a sharper eye,
Bugs in create.ts bid goodbye!
With tools so new, our code's delight,
We craft the future in purest light. ✨


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

@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 089689d and 923f26c.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (1)
  • package.json (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json

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 923f26c and 83fde3d.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (2)
  • eslint.config.mjs (1 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json
Additional comments not posted (3)
eslint.config.mjs (3)

1-1: Ensure @ts-check is effectively utilized by confirming TypeScript is enabled in the project settings.


3-4: Verify that the imports for @eslint/js and typescript-eslint are correctly named and accessible.


6-10: The configuration syntax for ESLint and TypeScript ESLint seems correct, but ensure that the spread operators are used properly to merge configurations.

Verification successful

The configuration syntax for ESLint and TypeScript ESLint appears correct, and the spread operators are used properly to merge configurations. No other ESLint configuration files were found in the repository.

  • eslint.config.mjs: Correct usage of spread operators to merge ESLint configurations.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of spread operators in ESLint configuration.

# Test: Check for other usages of spread operators in ESLint configurations.
rg --type js '...config' *.config.mjs

Length of output: 167



Script:

#!/bin/bash
# Description: Verify the presence of other ESLint configuration files and inspect their contents.

# Find all .config.mjs files in the repository.
fd --type f --extension mjs --exec cat {} +

Length of output: 299

src/create.ts Outdated
@@ -24,7 +24,7 @@ async function run(): Promise<void> {
const notes_start_tag = core.getInput("notes_start_tag");
const overwrite = core.getBooleanInput("overwrite");

if (tag_name === "") {
if (tag_name = "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <no-cond-assign> reported by reviewdog 🐶
Expected a conditional expression and instead saw an assignment.

Copy link
Owner Author

Choose a reason for hiding this comment

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

nice catch!

src/create.ts Outdated
@@ -24,7 +24,7 @@ async function run(): Promise<void> {
const notes_start_tag = core.getInput("notes_start_tag");
const overwrite = core.getBooleanInput("overwrite");

if (tag_name === "") {
if (tag_name = "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <no-constant-condition> reported by reviewdog 🐶
Unexpected constant condition.

This reverts commit c0587b3.
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 83fde3d and c0587b3.

Files selected for processing (1)
  • src/create.ts (1 hunks)
Additional context used
Biome
src/create.ts

[error] 27-27: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.


[error] 27-27: Unexpected constant condition. (lint/correctness/noConstantCondition)

src/create.ts Outdated
@@ -24,7 +24,7 @@ async function run(): Promise<void> {
const notes_start_tag = core.getInput("notes_start_tag");
const overwrite = core.getBooleanInput("overwrite");

if (tag_name === "") {
if (tag_name = "") {
Copy link

Choose a reason for hiding this comment

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

Replace the assignment operator with a comparison operator in the if condition.

- if (tag_name = "") {
+ if (tag_name === "") {

This change fixes the logic error introduced by mistakenly replacing the equality comparison operator (===) with an assignment operator (=), which could lead to unintended behavior and is a common source of bugs in JavaScript and TypeScript.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (tag_name = "") {
if (tag_name === "") {
Tools
Biome

[error] 27-27: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.


[error] 27-27: Unexpected constant condition. (lint/correctness/noConstantCondition)

@shogo82148 shogo82148 merged commit 44d5568 into main Jun 17, 2024
13 checks passed
@shogo82148 shogo82148 deleted the bump-eslint-v9.5.0 branch June 17, 2024 06:05
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