Skip to content

Add options for granular positioning to warn and error functions #348

@davidtheclark

Description

@davidtheclark

Re: stylelint/stylelint#133

Right now the positions reported by errors or warnings rely on the node option; therefore, the position is approximate but not exact, since a node might contain any number of lines, and the warning/error might not relate to the first line.

To increase accuracy, a few things could be done:

  • Add an index option to the functions (alongside node), which would allow us to register an exact index for the item relative to the specified node. PostCSS would then calculate a line/column position based on the node's raw string value and this reported index.
  • Add line and column options, so that whoever is registering the warning/error can dictate exactly what position gets reported.

Any other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions