Skip to content

svelte-check error with nth-last-child selector #2024

@theodorejb

Description

@theodorejb

Describe the bug

In my Svelte component I have a style tag with the following rule:

tr:nth-last-child(1 of :not(.d-sm-none)) {
    border-bottom: 0;
}

The CSS works fine, but when I run svelte-check, it outputs the following errors:

Error: at-rule or selector expected (css)
        border-bottom: 0;
    }
</style>


c:\Users\Theodore\my-project\src\lib\MyComponent.svelte:75:44
Error: { expected (css)
<style>
    tr:nth-last-child(1 of :not(.d-sm-none)) {
        border-bottom: 0;


c:\Users\Theodore\my-project\src\lib\MyComponent.svelte:75:25
Error: ) expected (css)
<style>
    tr:nth-last-child(1 of :not(.d-sm-none)) {
        border-bottom: 0;


====================================
svelte-check found 3 errors and 0 warnings in 1 file

Reproduction

See above description.

Expected behaviour

Svelte-check should not output a syntax error for this valid CSS.

System Info

  • OS: Windows
  • IDE: VSCode

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

Strangely, there is no error with the following CSS:

tr:nth-last-child(odd of :not(.d-sm-none)) {
    border-bottom: 0;
}

So svelte-check seems to specifically fail to parse to the CSS when the first argument to nth-last-child is something other than odd or even.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions