Repository: next.js
Issue: `next lint` command doesn't support overrides
Labels: bug,Linting

### Verify canary release

- [X] I verified that the issue exists in Next.js canary release

### Provide environment information

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP PREEMPT Wed Dec 29 18:08:07 UTC 2021
    Binaries:
      Node: 17.3.0
      npm: 8.3.0
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 12.1.1-canary.9
      react: 17.0.2
      react-dom: 17.0.2


### What browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_

### Describe the Bug

If you have an eslint config that uses the `overrides` key to define different settings for different files, the `next lint` doesn't notice it.

For example, if you have the following eslint config in your `package.json`:
```json
  "eslintConfig": {
    "overrides": [
      {
        "files": [
          "**/*.tsx"
        ],
        "extends": [
          "next/core-web-vitals"
        ]
      }
    ]
  },
```

You will receive the next warn:
```
warn  - The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
```


### Expected Behavior

Handles the `overrides` config or simply **warns about this limitation**.

**Why is this important?**
A lot of people are getting this warning and probably haven't noticed. Just search for `The Next.js plugin was not detected in your ESLint configuration` around the web (Google, Next.js issues, etc) for evidence of this.
The worst-case scenario of this is that there are probably many users who are creating applications believing that they are complying with Core Web Vital directives but they are not.

**Is this easy to fix?**
I think not, ​so I recommend documenting this in a better way.

I tried to read an `override` configuration and this is the hacky code I ended up with to make the `next lint` command work only for my single-use case (see my case in **To Reproduce** section):
```diff
# https://github.com/vercel/next.js/blob/fbb8536956beb766aa401d83acd2c8d358e2dd11/packages/next/lib/eslint/runLintCheck.ts:143
-      const completeConfig: Config = await eslint.calculateConfigForFile(
-        configFile
-      )
+      let completeConfig: Config
+      if (eslintOptions?.extensions) {
+        // ESLint doesn't expose its entire API publicly.
+        const { getESLintPrivateMembers } = await import(path.join(require.resolve('eslint'), '..', 'eslint', 'eslint'))
+        const { getCLIEngineInternalSlots } = await import(path.join(require.resolve('eslint'), '..', 'cli-engine', 'cli-engine'))
+        const { cliEngine } = getESLintPrivateMembers(eslint)
+        const { configArrayFactory } = getCLIEngineInternalSlots(cliEngine)
+        completeConfig = await configArrayFactory.getConfigArrayForFile(configFile).extractConfig(`${process.cwd()}/*${eslintOptions.extensions}`).toCompatibleObjectAsConfigFileContent()
+      } else {
+        completeConfig = await eslint.calculateConfigForFile(configFile)
+      }
```


### To Reproduce

1 - Config `package.json` with:
```json
  "eslintConfig": {
    "overrides": [
      {
        "files": [
          "**/*.tsx"
        ],
        "extends": [
          "next/core-web-vitals"
        ]
      }
    ]
  },
```

2 - Run `next lint .  --ext tsx`