Skip to content

Get "Cannot read property 'first' of null" error with :root selector #647

Open
@maliyshock

Description

@maliyshock

I tried to use 4.2.0 version of CSS comb, and I got this error

"comb": "node node_modules/csscomb/src/cli.js -c .csscomb.json src/scss",

csscomb/lib/options/sort-order.js:163
let property = node.first('property').first();
                                    ^
TypeError: Cannot read property 'first' of null

I believe the problem occurs when you are trying to use :root selector.

The same thing happens here https://gitmemory.com/issue/csscomb/csscomb.js/625/820750672
The workaround is to use

"devDependencies": {
    "csscomb": "csscomb/csscomb.js#1f27f9e4e0f6a9f0849b6fc6e8325baf9371aeaf"
}

and

"scripts": {
    "comb": "node node_modules/csscomb/src/cli.js -c .csscomb.json src/scss",
}

I would be happy to use CSS comb without that kind of patches. Thanks!

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