Skip to content

fix: report property name location in prefer-logical-properties - #612

Open
Pixel998 wants to merge 1 commit into
mainfrom
fix/prefer-logical-properties-property-loc
Open

Pixel998 wants to merge 1 commit into
mainfrom
fix/prefer-logical-properties-property-loc

Conversation

@Pixel998

@Pixel998 Pixel998 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

Check all that apply.

  • I did not use AI to generate this PR.
  • I used AI to write or edit the description of this PR (including translation).
  • I used AI to understand the codebase.
  • I used AI to write or edit the files in this PR and I reviewed the files.

What did you do?

/* eslint css/prefer-logical-properties: "error" */

a {
	margin-left: 10px;
}

What did you expect to happen?

An error on margin-left only, the part that the message names and the suggestion replaces.

What actually happened?

The error covered the whole declaration.

What is the purpose of this pull request?

This PR makes prefer-logical-properties report physical properties at the property name instead of across the whole declaration.

What changes did you make? (Give an overview)

Ended the property report's location at the property name instead of using the Declaration node's location.

Related Issues

Is there anything you'd like reviewers to focus on?

Summary by CodeRabbit

  • Bug Fixes
    • Diagnostics for non-logical CSS properties now highlight only the property name, making the reported location more precise.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Nov 1, 2026
@eslint-github-bot eslint-github-bot Bot added the bug Something isn't working label Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b2ee69e-da0f-4c63-b2af-1419c52802e8
Commits

Reviewing files that changed from the base of the PR and between 79e7d51 and 4daef2a.

Files selected for processing: 2
  • src/rules/prefer-logical-properties.js
  • tests/rules/prefer-logical-properties.test.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Walkthrough

The prefer-logical-properties rule now reports non-logical properties on the property name only. Tests update expected end columns to match the shorter diagnostic range.

Changes: Logical Property Diagnostic

Layer / File(s) Summary
Property-name diagnostic range
src/rules/prefer-logical-properties.js, tests/rules/prefer-logical-properties.test.js
The diagnostic range now covers only the property name. Tests update expected end columns for margin-top, MARGIN-TOP, and padding-top.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested labels: bug

Suggested reviewers: azat-io

Merge Risk: Minimal · up to 4daef

The change highlights the property name rather than the whole declaration, with matching test expectations. No actionable merge-blocking risk was identified; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: reporting the property name location in the prefer-logical-properties rule.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Pixel998 Pixel998 moved this from Needs Triage to Implementing in Triage Nov 1, 2026

@DMartens DMartens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes LGTM, thanks. Leaving open for others to review.

@DMartens DMartens moved this from Implementing to Merge Candidates in Triage Nov 1, 2026
@Pixel998 Pixel998 added the accepted There is consensus among the team that this change meets the criteria for inclusion label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working

Projects

Status: Merge Candidates

Development

Successfully merging this pull request may close these issues.

2 participants