Skip to content

Cannnot detect all unused-class-name codes #1259

Closed
@tbashiyy

Description

@tbashiyy

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?

9.29.0

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

3.10.0

What did you do?

Configuration
import js from "@eslint/js";
import sveltePlugin from "eslint-plugin-svelte";
import svelteParser from "svelte-eslint-parser";
import tseslint from "typescript-eslint";
export default tseslint.config(
  js.configs.recommended,
  ...tseslint.configs.recommended,
  ...sveltePlugin.configs["flat/recommended"],
  {
    files: ["**/*.svelte", "*.svelte"],
    languageOptions: {
      parser: svelteParser,
      parserOptions: {
        parser: {
          ts: "@typescript-eslint/parser",
        },
        extraFileExtensions: [".svelte"],
      },
    }
  },
  {
    files: ["**/*.svelte.ts", "*.svelte.ts"],
    languageOptions: {
      parser: svelteParser,
      parserOptions: {
        parser: tseslint.parser,
      },
    }
  },
  {
    files: ["**/*.svelte.js", "*.svelte.js"],
    languageOptions: {
      parser: svelteParser,
    }
  },
  {
    rules: {
      'svelte/no-unused-class-name': ['error']
    }
  }
);
<div class="unused-class">Hello!</div> <- Error No Detected

<div class="unused-class">World!</div> <- Error Detected

What did you expect to happen?

no-unused-class-name rule detect all codes which is should be detected.

What actually happened?

no-unused-class-name rule detect only last code which is should be detected.

Link to GitHub Repo with Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNq1VMlu2zAQ/RWWF7eGJaFXJw0KdEEvRXvrocxBkEYGXWookJThIPC/d7ho8ZIFCXKRxJn3ZnnizD23pip+3n3RbacR0OV2B8oBX/PrWu5YpUprPwke3tlHwW9+gFL63XVB3huBAh+A/dFG1SOMrzhYJSl8pbGRm3xrKYOknMaxrWWN0S0T/HMEFVsr+JXA5I8V/Vb9RuKAjMCsC8YsIi5wSmPBDJxoywZq8M05zkbXgHd3HdjKyM4lTgDDPoBraMpeTaTU2HuBjBpKJ5sbqHTbAtZQr7wrz/MTxkXMvOUB91fwRpWumMEFvw2Me/9grJEK7JoRcLkslimI4CvqZTpFBmOqxE1fbuBX56RGoqUgjEVl1kcaJtLgPCdNtJmJkTxr/1/PpCwG+cfAjB1m37B3pvxO/XzbO0Abk1FjZ21MtIN/xcNjepD+x5IEw5urMv71aHhx9X40jqr3hldVf57Z9CHzSF5EVoE667G3UGdxzrFsYUEVLsAYbRa383gCP1zR1Hdl9Y8Koio10sSHkHGyBPc3o9U1JUvXQPAadl+h83cbKwnU2VjF8XLwVJoFsDSTqY1hJzzqPF0YF6HPcJ4ukYvQ6dI/CRgXzByXdDzww3+U490d

Additional comments

No response

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