ESLint-plugin: Disallow extra properties in eslint plugin rule options#32056
Conversation
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
📝 WalkthroughWalkthroughAdded a schema constraint ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts (1)
48-64: Schema tightening withadditionalProperties: falsematches the rule’s intent; consider tests/docs + version checkThis change does exactly what the PR describes: it ensures the options object for
no-uninstalled-addonsonly acceptspackageJsonLocationandignore, and will now surface invalid or misspelled keys as config errors instead of silently ignoring them. That’s a good defensive hardening and is consistent with the existingdefaultOptionsshape.Two follow‑ups to consider:
- Add/extend rule tests to cover:
- A config using a misspelled key (e.g.
packgeJsonLocation) and asserting ESLint reports an invalid option.- A config with an extra unknown key to ensure it is rejected.
- Update the rule docs to explicitly state that only
packageJsonLocationandignoreare allowed keys and that unknown keys will be rejected, so users understand the stricter behavior and any resulting configuration failures.Also, please double‑check that this usage of
additionalProperties: falseis compatible with the minimum ESLint version that Storybook’s eslint‑plugin targets (older ESLint versions already supported it, but it’s worth confirming against the repo’s supported matrix).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use ESLint and Prettier configurations that are enforced in the codebase
Files:
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable TypeScript strict mode
Files:
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts
code/**/*.{ts,tsx,js,jsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{ts,tsx,js,jsx,mjs}: Use server-side logger from 'storybook/internal/node-logger' for Node.js code
Use client-side logger from 'storybook/internal/client-logger' for browser code
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts
code/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Export functions that need to be tested from their modules
Files:
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts
code/**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{js,jsx,json,html,ts,tsx,mjs}: Run Prettier with --write flag to format code before committing
Run ESLint with yarn lint:js:cmd to check for linting issues and fix errors before committing
Files:
code/lib/eslint-plugin/src/rules/no-uninstalled-addons.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Tabs/Tabs.stories.tsx:222-227
Timestamp: 2025-11-05T09:36:55.944Z
Learning: Repo: storybookjs/storybook PR: 32458 — In code/core/src/components/components/Button/Button.tsx (React/TypeScript), ButtonProps includes ariaLabel?: string | false and the component maps it to the DOM aria-label. Convention: ariaLabel is mandatory on all Button usages — provide a descriptive string for icon-only buttons; set ariaLabel=false when the button’s children already serve as the accessible name. Do not suggest using a raw aria-label prop on Button call sites.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: normal
What I did
no-uninstalled-addons eslint-plugin-storybook rule currently allows extra properties to be passed in options object, which should not be allowed. This makes it easier for typos in rule options to go unnoticed.
This PR simply disallows extra properties in this rule's schema.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
N/A
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
This PR adds
additionalProperties: falseto the schema configuration of theno-uninstalled-addonsESLint rule. This is a defensive programming practice that will help catch configuration errors early by preventing users from accidentally using invalid property names in their rule configuration.The change affects how the rule validates its configuration options, now strictly enforcing that only
packageJsonLocationandignoreare valid properties. Previously, if a user made a typo in their configuration (e.g.,packgeJsonLocationinstead ofpackageJsonLocation), the incorrect property would be silently ignored, potentially leading to confusing behavior.Confidence score: 5/5
1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.