Skip to content

no-unused-css-selector returns no errors or warnings when SCSS is used #399

@skilar

Description

@skilar

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.57.0

What version of eslint-plugin-astro are you using?

1.2.2

What did you do?

Configuration
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import eslintPluginAstro from 'eslint-plugin-astro'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
    js.configs.recommended,
    ...tseslint.configs.recommended,
    ...eslintPluginAstro.configs.recommended,
    eslintConfigPrettier,
    {
        rules: {
            'astro/no-unused-css-selector': 'warn',
        },
    },
]

const { name } = Astro.props
---

<div class="hello">
    <p>Hello, {name}!</p>
</div>

<style lang="scss">
    @use '../styles/_mixins.scss' as mixins;

    .ok {
        color: red;

        @include mixins.breakpoint('small') {
            display: none;
        }
    }
</style>

What did you expect to happen?

A warning should be thrown for the unused .ok selector.

What actually happened?

No error was logged.

Link to Minimal Reproducible Example

https://github.com/skilar/astro-debug

Additional comments

Everything works if the styles are modified to this:

<style lang="scss">
    .ok {
        color: red;
    }
</style>

So it seems to be the SCSS-specific code that's causing the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions