How can I get Phpstorm to recognize NextJS pages as being used?

Viewed 349

Here's my fresh NextJS app:

function MyApp({ Component, pageProps }: AppProps) {
  return (
    <Layout>
      <Component {...pageProps} />
    </Layout>
  )
}

export default MyApp

The problem is, I'm getting this warning from PHPStorm:

Unused default export

I know I can ignore it like this:

// noinspection JSUnusedGlobalSymbols
export default MyApp

And I can ignore at the program level, but it defeats the purpose.

I'm wondering if its possible to create an IDE helper file, or if there's common knowlegde amongst NextJS programmers on how to handle this that I'm not aware of.

I imagine the code that connects these pages exists outside of my project in the compiling business logic, which then makes be believe more that this is a univeral issue for NextJS devs. How Can I get PHPStorm to recognize that these functions are being used?

1 Answers

Create a scope for the pages folder (include recursively)

Step 1

And disable the rule for only the pages scope

Step 2

Related