Skip to content

Global Tailwind CSS styles: Selector ... is declared but it's never used (React TS CSS) #176

@karlhorky

Description

@karlhorky

Describe the bug

In our app/global.css file (global Tailwind CSS styles), we define some reusable classes for multiple files, which are identified as being unused by the subtle ... decoration beneath the first .compactList in the screenshot:

app/global.css

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  /* 💥 Selector 'compactList' is declared but it's never used (React TS CSS) */
  .compactList li > ol,
  .compactList li > ul {
    @apply mb-0 mt-1;
  }
}

Screenshot 2024-10-07 at 12 58 44

To Reproduce

Steps to reproduce the behavior:

  1. Add the CSS above in a file such as app/global.css
  2. Observe the error above

My config, for completeness:

  "reactTsScss.autoComplete": true,
  "reactTsScss.baseDir": "src",
  "reactTsScss.cleanUpDefs": [
    "node_modules/vite/client.d.ts",
    "node_modules/next/types/global.d.ts",
    "node_modules/react-scripts/lib/react-app.d.ts"
  ],
  "reactTsScss.codelens": false,
  "reactTsScss.cssAutoComplete": true,
  "reactTsScss.cssDefinitions": true,
  "reactTsScss.cssSyntaxColor": true,
  "reactTsScss.definition": true,
  "reactTsScss.diagnostics": true,
  "reactTsScss.peekProperties": true,
  "reactTsScss.references": true,
  "reactTsScss.tsCleanUpDefs": true,

Expected behavior

The React CSS modules VS Code extension should not report problems with global classes, especially not in CSS files which do not have .module. in the file extension.

Screenshots

Already included above

Desktop (please complete the following information):

  • OS: macOS
  • Version Sequoia 15.0.1 (24A348)

Additional context

--

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions