Skip to content

Don't rely on rule.position existing #6

@cw-peter

Description

@cw-peter

In this code:

      rule.media = rule.media.replace(EXTENSION_RE, function(_, name) {
        var replacement = map[name];
        var column = rule.position.start.column;
        var line = rule.position.start.line;
        var source = rule.position.source;

you rely on position being defined, however some plugins mutate the AST and don't add the position property (@rework-pure-grids I'm looking at you...).

This breaks the plugin.

As the line and column are only used in an error message, it should be possible to check for their existence before using them.

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