grafana / grafana/plugin-tools

Bug: eslint.config.mjs scaffold still imports removed @grafana/eslint-config/flat.js subpath (breaks on eslint-config v10)

Open Beginner friendly
#2,871 0 comments 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
TypeScript
Stars
89
Forks
57
Avg merge
3d 17h
Merged PRs (30d)
37

Description

### Which package(s) does this bug affect?

- [x] Create Plugin
- [x] ESLint Config

### Package versions

```
@grafana/create-plugin (scaffold): 7.10.0 (.config/.cprc.json) -- confirmed the same issue exists in the latest published @grafana/create-plugin@7.10.1 template as well
@grafana/eslint-config: 9.0.0 -> 10.0.0
eslint: 9.39.5
```

### What happened?

`@grafana/eslint-config@10.0.0` removed the `./flat.js` subpath export entirely -- the flat config array is now the plain default export (`import grafanaConfig from '@grafana/eslint-config'`), not `@grafana/eslint-config/flat.js`. The scaffolded `.config/eslint.config.mjs` file (which is marked "DO NOT EDIT THIS FILE DIRECTLY" and is meant to be managed by `create-plugin`) still imports the old subpath:

```js
import grafanaConfig from '@grafana/eslint-config/flat.js';
```

Running `eslint` after bumping `@grafana/eslint-config` to `10.0.0` crashes immediately with:

```
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './flat.js' is not defined by "exports" in
node_modules/@grafana/eslint-config/package.json imported from .config/eslint.config.mjs
```

I checked whether running `npx @grafana/create-plugin@latest update` would fix this by extracting the package template directly (`@grafana/create-plugin@7.10.1`, the latest published version at the time of filing): it still hardcodes `import grafanaConfig from '@grafana/eslint-config/flat.js';` in `templates/common/.config/eslint.config.mjs`, and its own `templates/common/_package.json` still pins `"@grafana/eslint-config": "^9.0.0"`. So there's currently no way to update to `@grafana/eslint-config@10` without either hand-editing the scaffolded file (against its own warning) or forking the Grafana config import out of `.config/` entirely into the plugin's own root `eslint.config.mjs`.

Two other Grafana-maintained plugins have already worked around this in-repo:
- [grafana/clock-panel](https://github.com/grafana/clock-panel/blob/main/eslint.config.mjs) moved the `@grafana/eslint-config` import out of `.config/` entirely, into its own root config (no `.config/eslint.config.mjs` exists in that repo at all).
- [grafana/metrics-drilldown](https://github.com/grafana/metrics-drilldown/blob/main/.config/eslint.config.mjs) hand-edited the scaffolded file directly to drop `/flat.js`.

Separately (not part of this report, but worth noting for anyone attempting the same upgrade): once `.config/eslint.config.mjs` is fixed, `eslint-plugin-react@7.37.5` (peer-required by `@grafana/eslint-config`) crashes at runtime under `eslint@10.x` (confirmed against `10.0.0` through `10.10.0`) with `TypeError: contextOrFilename.getFilename is not a function`, from `eslint-plugin-react`'s `detectReactVersion()`/`resolveBasedir()` internals, triggered because `@grafana/eslint-config`'s bundled settings use `react: { version: "detect" }`. Pinning an explicit `react.version` in a consuming config avoids that specific crash, but it's a separate compatibility gap in `eslint-plugin-react`, not something `create-plugin` can fix directly.

### What you expected to happen

Bumping `@grafana/eslint-config` to `10.x` should work with a scaffold generated (or updated via `create-plugin update`) at the time `eslint-config@10` is current, without needing to hand-edit or bypass the "DO NOT EDIT" `.config/eslint.config.mjs` file.

### How to reproduce it (as minimally and precisely as possible)

1. Scaffold (or use an existing) app plugin with `@grafana/create-plugin@7.10.1` (or run `npx @grafana/create-plugin@latest update` on an existing one).
2. `pnpm add -D @grafana/eslint-config@10.0.0 @stylistic/eslint-plugin@5.10.0` and remove the now-unused `@stylistic/eslint-plugin-ts` (a peer requirement of `@grafana/eslint-config@10`).
3. Run `pnpm exec eslint .` (or `pnpm lint`).
4. See `ERR_PACKAGE_PATH_NOT_EXPORTED` for `@grafana/eslint-config/flat.js`, thrown from the scaffolded `.config/eslint.config.mjs`.

### Environment

```
node: v24.11.0
pnpm: 11.11.0
OS: Darwin 25.6.0 arm64 (macOS)
```

### Additional context

Found while trying to pick up the two open Renovate PRs updating `eslint` and `@grafana/eslint-config` to v10 in [grafana/logs-drilldown](https://github.com/grafana/logs-drilldown). Happy to open a PR against the `create-plugin` eslint template if that's the preferred fix direction once maintainers weigh in on whether the template should import the package root directly (dropping `/flat.js`) going forward.

Contributor guide

Open the contributing guide

Research direction

Start with templates/common/.config/eslint.config.mjs and templates/common/_package.json, then reproduce the failure with the documented dependency upgrade and `pnpm exec eslint .`. Check the generated and updated scaffold against @grafana/eslint-config v10; done means the template no longer uses the removed subpath and linting works without hand-editing the protected config file.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, node.js, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.