Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
skilar opened this issue Jun 19, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@skilar
Copy link

skilar commented Jun 19, 2024

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.

@ota-meshi ota-meshi added the bug Something isn't working label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants