0

I use Styled Components with Emotion and issue a "Unused Constant" alert, even though I actually use the constants defined above when I use them right below.

This is not a warning from ESLint, but a warning issued directly by JetBrains IDE. The Styled Components plug-in is already in use, and if disabled, only the color of the CSS part will be lost. If you use files separately, it is recognized as using a constant. also I've tried to erase the cache and restart it several times.

I want to solve this problem.

"use client"
import styled from "@emotion/styled"

const Container = styled.div`
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100dvh;
  width: 100%;
`

export default function Home() {
  return (
    <Container>
      <h1>Hello World</h1>
    </Container>
  )
}

What IDE looks like:

What IDE looks like

If you separate the file:

If you separate the file

1 Answer 1

0

This looks like it is this bug: https://youtrack.jetbrains.com/issue/WEB-66795

Please vote for it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.