Skip to content

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

Merged
valentinpalkovic merged 2 commits into
nextfrom
copilot/fix-eslint-10-support
Feb 25, 2026
Merged

Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules#33884
valentinpalkovic merged 2 commits into
nextfrom
copilot/fix-eslint-10-support

Conversation

Copy link
Copy Markdown
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.

Summary by CodeRabbit

  • Refactor
    • Updated internal API usage patterns in ESLint plugin rules for improved consistency and maintainability.

…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
@valentinpalkovic valentinpalkovic marked this pull request as ready for review February 25, 2026 11:06
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 25, 2026

Fails
🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.

Generated by 🚫 dangerJS against b196790

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 512098b and b196790.

📒 Files selected for processing (5)
  • code/lib/eslint-plugin/src/rules/default-exports.ts
  • code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts
  • code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts
  • code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts
  • code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts

📝 Walkthrough

Walkthrough

Updates five ESLint rule implementations to use modern property access patterns instead of deprecated methods: replacing context.getSourceCode() with context.sourceCode, context.getFilename() with context.filename, for API modernization.

Changes

Cohort / File(s) Summary
ESLint API modernization
code/lib/eslint-plugin/src/rules/default-exports.ts, code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts, code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts, code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts, code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts
Replaced deprecated ESLint context method calls with property access: getSourceCode()sourceCode, getFilename()filename.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Comment @coderabbitai help to get the list of available commands and usage tips.

@valentinpalkovic valentinpalkovic changed the title Fix ESLint 10 compatibility in eslint-plugin-storybook rules ESLINT: Fix ESLint 10 compatibility in eslint-plugin-storybook rules Feb 25, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Feb 25, 2026

View your CI Pipeline Execution ↗ for commit b196790

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 7m 31s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-25 14:05:34 UTC

@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: b196790, ran on 25 February 2026 at 13:28:00 UTC

The following packages have significant changes to their size or dependencies:

@storybook/nextjs

Before After Difference
Dependency count 535 535 0
Self size 648 KB 648 KB 🎉 -125 B 🎉
Dependency size 59.87 MB 59.91 MB 🚨 +36 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs-vite

Before After Difference
Dependency count 92 92 0
Self size 1.12 MB 1.12 MB 🎉 -41 B 🎉
Dependency size 22.46 MB 22.50 MB 🚨 +39 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-native-web-vite

Before After Difference
Dependency count 124 124 0
Self size 30 KB 30 KB 🚨 +37 B 🚨
Dependency size 23.75 MB 23.79 MB 🚨 +39 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-vite

Before After Difference
Dependency count 82 82 0
Self size 35 KB 35 KB 🚨 +14 B 🚨
Dependency size 20.25 MB 20.29 MB 🚨 +39 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 274 274 0
Self size 24 KB 24 KB 🎉 -5 B 🎉
Dependency size 44.54 MB 44.57 MB 🚨 +36 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react

Before After Difference
Dependency count 58 57 🎉 -1 🎉
Self size 1.19 MB 1.23 MB 🚨 +37 KB 🚨
Dependency size 13.20 MB 12.94 MB 🎉 -264 KB 🎉
Bundle Size Analyzer Link Link

@valentinpalkovic valentinpalkovic changed the title ESLINT: Fix ESLint 10 compatibility in eslint-plugin-storybook rules Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules Feb 25, 2026
@valentinpalkovic valentinpalkovic added eslint-plugin patch:yes Bugfix & documentation PR that need to be picked to main branch labels Feb 25, 2026
@valentinpalkovic valentinpalkovic merged commit 60996ad into next Feb 25, 2026
127 of 145 checks passed
@valentinpalkovic valentinpalkovic deleted the copilot/fix-eslint-10-support branch February 25, 2026 13:56
yannbf pushed a commit that referenced this pull request Feb 26, 2026
Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules
(cherry picked from commit 60996ad)
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Feb 26, 2026
@stof
Copy link
Copy Markdown
Contributor

stof commented Apr 14, 2026

the peer dependency says eslint >= 8, not eslint >= 8.25, so this implementation is not in sync with the advocated compat.
Btw, it would be nice to have an upper bound for the eslint peer dependency, as the existing code is definitely not guaranteed to be compatible with future major versions of ESLint.

Also, the compat table in the readme of the package does not mention ESLint 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal eslint-plugin patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: eslint 10 support

3 participants