Skip to content

Bug: Update rules to handle all newline types #276

@sethamus

Description

@sethamus

Environment

ESLint version: 9.36.0
@eslint/css version: 0.11.1
Node version:
npm version:
Operating System:

Which language are you using?

stylesheet

What did you do?

@import "a.css"
@import "a.css"\f

What did you expect to happen?

Duplicate @import rules should be removed entirely, including the newline after them, regardless of newline type.

What actually happened?

Fixers removed the intended node or text but left orphaned blank lines when the newline was CR or FF.

Link to Minimal Reproducible Example

n/a

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

According to the CSS Syntax Module Level 3, CSS defines newline as one of:

  • Line Feed (\n)
  • Carriage Return + Line Feed (\r\n)
  • Carriage Return (\r)
  • Form Feed (\f)

Some CSS rules with autofix functionality, such as no-duplicate-imports and no-important, assume that newlines are \n when computing ranges for fixes. This causes incorrect behavior when CSS files contain \r or \f newlines.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionbugSomething isn't working

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions