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

feat(eslint): change editor rules from disable to non-fixable #224

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

mheob
Copy link
Owner

@mheob mheob commented Jan 22, 2025

Summary by CodeRabbit

  • Dependency Updates

    • Updated eslint-flat-config-utils to version 1.1.0
    • Updated @eslint-react/eslint-plugin to version 1.24.1
  • Configuration Changes

    • Modified ESLint rules to provide different severity levels in editor vs. terminal environments
    • Added ability to disable auto-fixing for specific rules when editing in an IDE
  • Documentation

    • Updated README to clarify ESLint rule behavior in different contexts

@mheob mheob added enhancement New feature or request eslint Belongs to ESLint config labels Jan 22, 2025
Copy link

height bot commented Jan 22, 2025

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Copy link

changeset-bot bot commented Jan 22, 2025

🦋 Changeset detected

Latest commit: 76d241d

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

This PR includes changesets to release 1 package
Name Type
@mheob/eslint-config Minor

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

Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eslint-config ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 8:23am

Copy link

coderabbitai bot commented Jan 22, 2025

Walkthrough

This pull request introduces modifications to the ESLint configuration across multiple files in the @mheob/eslint-config package. The changes primarily focus on adjusting rule behaviors in different environments, specifically when the code is being edited in an IDE versus being linted in a terminal. Key modifications include changing the severity levels of certain rules like prefer-const, unused-imports/no-unused-imports, and test/no-only-tests, and implementing a mechanism to disable auto-fixing for these rules when in an editor environment.

Changes

File Change Summary
.changeset/gold-rats-judge.md Minor dependency update noted
packages/eslint-config/README.md Updated documentation explaining ESLint rule behavior in different environments
packages/eslint-config/package.json Updated dependency versions:
- eslint-flat-config-utils: ^1.0.0^1.1.0
- @eslint-react/eslint-plugin: ^1.24.0^1.24.1
packages/eslint-config/src/configs/javascript.ts Modified rule handling for prefer-const and unused-imports/no-unused-imports:
- Set to warn when in editor
- Remain error outside editor
packages/eslint-config/src/configs/test.ts Changed test/no-only-tests rule from off to warn in editor environment
packages/eslint-config/src/factory.ts Added logic to disable rule fixes for specific rules when in editor environment

Possibly related PRs

Suggested labels

documentation, Configuration changes


📜 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 68ba8c8 and 76d241d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .changeset/gold-rats-judge.md (1 hunks)
  • packages/eslint-config/README.md (1 hunks)
  • packages/eslint-config/package.json (2 hunks)
  • packages/eslint-config/src/configs/javascript.ts (2 hunks)
  • packages/eslint-config/src/configs/test.ts (1 hunks)
  • packages/eslint-config/src/factory.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/gold-rats-judge.md
🔇 Additional comments (7)
packages/eslint-config/src/configs/test.ts (1)

50-50: LGTM! Rule severity change aligns with PR objectives.

The change from disabling to warning for test/no-only-tests in editor mode maintains rule feedback while preventing auto-fixes.

packages/eslint-config/src/factory.ts (1)

246-254: LGTM! Well-implemented rule fix prevention.

The implementation correctly uses the disableRulesFix helper to prevent auto-fixing while maintaining rule feedback in editor mode. The dynamic import of builtinRules is a safe approach.

packages/eslint-config/src/configs/javascript.ts (2)

198-204: LGTM! Consistent rule severity change for prefer-const.

The change to warning level in editor mode while maintaining error level otherwise is well-implemented and preserves the rule's configuration options.


224-224: LGTM! Consistent rule severity change for unused-imports.

The change to warning level for unused-imports in editor mode aligns with the PR objectives and factory implementation.

packages/eslint-config/README.md (1)

529-537: LGTM! Clear and accurate documentation update.

The documentation clearly explains:

  • The rules affected by auto-fix prevention
  • The change from disabled to non-fixable behavior
  • The rationale behind preventing auto-fixes during refactoring
packages/eslint-config/package.json (2)

76-76: LGTM: Patch update for @eslint-react/eslint-plugin.

The patch version bump (1.24.0 → 1.24.1) indicates bug fixes without breaking changes.


47-47: Verify the compatibility of [email protected].

The minor version bump of eslint-flat-config-utils aligns with the PR's objective to change editor rules. Let's verify the changes introduced in this version.

✅ Verification successful

The update to [email protected] is safe and beneficial

The minor version bump adds a new disableRulesFix helper that aligns with the PR's objective of managing editor rules. No breaking changes were introduced.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the changelog or release notes for eslint-flat-config-utils v1.1.0
# to ensure it supports the required editor rule changes.

# Fetch the package details and changelog
curl -s https://registry.npmjs.org/eslint-flat-config-utils | jq '.versions["1.1.0"].time, .versions["1.1.0"].description'

# Check for any reported issues
gh api graphql -f query='
{
  repository(owner: "eslint", name: "eslint-flat-config-utils") {
    issues(first: 5, states: OPEN, labels: ["bug"]) {
      nodes {
        title
        url
        labels(first: 5) {
          nodes {
            name
          }
        }
      }
    }
  }
}'

Length of output: 788


Script:

#!/bin/bash
# Get full package metadata and compare versions
curl -s https://registry.npmjs.org/eslint-flat-config-utils | jq '{
  repository: .repository,
  "1.0.0": .versions["1.0.0"].dependencies,
  "1.1.0": .versions["1.1.0"].dependencies,
  latest_version: .["dist-tags"].latest,
  maintainers: .maintainers[].name
}'

# Try to find the package in the repository to check for changelog
fd -t f "CHANGELOG.md|changelog.md" | xargs cat

Length of output: 16753


Script:

#!/bin/bash
# Get commit history between v1.0.0 and v1.1.0
curl -s "https://api.github.com/repos/antfu/eslint-flat-config-utils/compare/v1.0.0...v1.1.0" | jq '.commits[] | {message: .commit.message, date: .commit.author.date}'

# Check releases info
curl -s "https://api.github.com/repos/antfu/eslint-flat-config-utils/releases" | jq '.[] | select(.tag_name == "v1.1.0" or .tag_name == "v1.0.0") | {tag: .tag_name, body: .body}'

Length of output: 1116

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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>, 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.

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. (Beta)
  • @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.

@kodiakhq kodiakhq bot merged commit 8079695 into main Jan 22, 2025
10 checks passed
@kodiakhq kodiakhq bot deleted the editor-non-fixable branch January 22, 2025 08:27
kodiakhq bot pushed a commit that referenced this pull request Jan 22, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## @mheob/[email protected]

### Minor Changes

-   [#224](#224) ([@mheob](https://github.com/mheob)): change editor rules from disable to non-fixable




## Summary by CodeRabbit

- **Version Update**
  - Updated `@mheob/eslint-config` package to version 7.2.0
- **Editor Rules**
  - Modified editor rules from disabled to non-fixable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request eslint Belongs to ESLint config
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant