Skip to content

Comments

Fix ESLint 10 compatibility in eslint-plugin-storybook rules#33884

Draft
Copilot wants to merge 2 commits intonextfrom
copilot/fix-eslint-10-support
Draft

Fix ESLint 10 compatibility in eslint-plugin-storybook rules#33884
Copilot wants to merge 2 commits intonextfrom
copilot/fix-eslint-10-support

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

ESLint 10 removed several deprecated context methods, causing runtime crashes (TypeError: context.getSourceCode is not a function) in multiple eslint-plugin-storybook rules.

Changes

Replaced removed context methods with their direct property equivalents across 5 rules:

Deprecated (removed in ESLint 10) Replacement (available since ESLint 8.25+)
context.getSourceCode() context.sourceCode
context.getFilename() context.filename

Affected rules:

  • meta-satisfies-type
  • no-title-property-in-meta
  • use-storybook-testing-library
  • default-exports
  • prefer-pascal-case

Both replacements were introduced in ESLint 8.25–8.40, so this is backward-compatible with ESLint 8, 9, and 10. The prefer-pascal-case rule already used context.sourceCode for scope handling — this change makes the rest of the codebase consistent.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: eslint 10 support</issue_title>
<issue_description>### Describe the bug

Summary

storybook/meta-satisfies-type crashes under ESLint 10.0.0.

Error

TypeError: context.getSourceCode is not a function

Expected behavior

Rule should execute without runtime errors on ESLint 10.

Environment

  • ESLint: 10.0.0
  • Flat config: yes

Workaround

Rule currently disabled.

Reproduction link

n/a

Reproduction steps

  1. Add eslint-plugin-storybook to your config
  2. update to eslint 10
  3. observe crash

System

│  System:
│  OS: Windows 11 10.0.22631
│  CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900KF
│  Binaries:
│  Node: 25.6.1 - C:\Program Files\nodejs\node.EXE
│  npm: 11.10.0 - C:\Program Files\nodejs\npm.CMD <----- active
│  pnpm: 10.29.3 - C:\Program Files\WinGet\Links\pnpm.EXE
│  Browsers:
│  Chrome: 145.0.7632.76
│  Edge: Spartan (?? PowerShell profile loaded in 3543ms), Chromium
│  (140.0.3485.54), ChromiumDev (? PowerShell profile loaded in 3543ms)
│  Firefox: 147.0.3 - C:\Program Files\Mozilla Firefox\firefox.exe
│  npmPackages:
│  @storybook/addon-a11y: ^10.2.8 => 10.2.8
│  @storybook/addon-coverage: ^3.0.0 => 3.0.0
│  @storybook/addon-designs: ^11.1.2 => 11.1.2
│  @storybook/addon-docs: ^10.2.8 => 10.2.8
│  @storybook/addon-links: ^10.2.8 => 10.2.8
│  @storybook/addon-themes: ^10.2.8 => 10.2.8
│  @storybook/addon-vitest: ^10.2.8 => 10.2.8
│  @storybook/builder-vite: ^10.2.8 => 10.2.8
│  @storybook/react: ^10.2.8 => 10.2.8
│  @storybook/react-vite: ^10.2.8 => 10.2.8
│  eslint-plugin-storybook: ^10.2.8 => 10.2.8
│  msw-storybook-addon: ^2.0.6 => 2.0.6
│  storybook: ^10.2.8 => 10.2.8
│  storybook-addon-jsx: ^7.3.14 => 7.3.14

Additional context

No response</issue_description>

<agent_instructions>Make sure to support Eslint 9 as well.

Here is the migration guide:
Migrate to v10.x
ESLint v10.0.0 is a major release of ESLint, and as such, has several breaking changes that you need to be aware of. This guide is intended to walk you through the breaking changes.

The lists below are ordered roughly by the number of users each change is expected to affect, where the first items are expected to affect the most users.

Table of Contents
Breaking changes for users
Node.js < v20.19, v21, v23 are no longer supported
eslint:recommended has been updated
New configuration file lookup algorithm
Old config format no longer supported
JSX references are now tracked
eslint-env comments are reported as errors
Jiti < v2.2.0 are no longer supported
POSIX character classes in glob patterns
stylish formatter now uses native styleText instead of chalk
Deprecated options of the radix rule
no-shadow-restricted-names now reports globalThis by default
func-names schema is stricter
allowConstructorFlags option of no-invalid-regexp now accepts only unique items
name property added to ESLint core configs
Breaking changes for plugin developers
Node.js < v20.19, v21, v23 are no longer supported
Old config format no longer supported
JSX references are now tracked
Removal of type property in errors of invalid RuleTester cases
Program AST node range spans entire source text
Fixer methods now require string text arguments
New requirements for ScopeManager implementations
Removal of deprecated context members
Removal of deprecated SourceCode methods
Prohibiting errors or output of valid RuleTester test cases
POSIX character classes in glob patterns
Breaking changes for integration developers
Node.js < v20.19, v21, v23 are no longer supported
New configuration file lookup algorithm
Old config format no longer supported
Removal of nodeType property in LintMessage objects
POSIX character classes in glob patterns
Node.js < v20.19, v21, v23 are no longer supported
ESLint is officially dropping support for these versions of Node.js starting with ESLint v10.0.0. ESLint now supports the following versions of Node.js:

Node.js v20.19.0 and above
Node.js v22.13.0 and above
Node.js v24 and above
To address: Make sure you upgrade to at least Node.js v20.19.0 when using ESLint v10.0.0. One important thing to double check is the Node.js version supported by your editor when using ESLint via editor integrations. If you are unable to upgrade, we recommend continuing to use ESLint v9 until you are able to upgrade Node.js.

Related issue(s): #19969

eslint:recommended has been updated
Three new rules have been enabled in eslint:recommended:

no-unassigned-vars
no-useless-assignment
preserve-caught-error
To address: Fix errors or disable these rules.

Related issue(s): #19966

New configuration file lookup algorithm
In ESLint v9, the alternate config lookup behavior could be enabled with the v10_config_lookup_from_file feature flag. This behavior made ESLint locate eslint.config.* by starting from the directory of each linted file and searching up towards the filesystem root. In ESLint v10.0.0, this behavior is now the...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…precated alternatives

Co-authored-by: valentinpalkovic <5889929+valentinpalkovic@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix crash under ESLint 10 support Fix ESLint 10 compatibility in eslint-plugin-storybook rules Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: eslint 10 support

2 participants