chore(eslint): integrate eslint-plugin-vuejs-accessibility#2648
chore(eslint): integrate eslint-plugin-vuejs-accessibility#2648martijndewit wants to merge 1 commit into
Conversation
- Adds eslint-plugin-vuejs-accessibility flat/recommended preset (20 rules) - scoped to packages/core/src/**/*.vue. Rules are registered at `warn` - severity so existing violations can be fixed incrementally without - breaking CI; flip to `error` once the codebase is clean. Refs unovue#2634
📝 WalkthroughWalkthroughThis PR adds Vue accessibility linting to the project by introducing ChangesVue Accessibility Linting
Possibly related issues
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
🧹 Nitpick comments (1)
eslint.config.mjs (1)
61-63: ⚡ Quick winAvoid hard-coding preset index when reading plugin rules.
Using
['flat/recommended'][1]assumes a stable internal array layout. The plugin's configuration structure is an internal implementation detail; indexing into a specific position is not documented as a stable or supported practice and will break if the plugin maintainers reshape the configuration in future releases.The suggested refactor using
flatMapto collect rules from all preset entries is the correct approach to make the configuration resilient to plugin changes.Suggested change
- rules: Object.fromEntries( - Object.keys(pluginVueA11y.configs['flat/recommended'][1].rules) - .map(rule => [rule, 'warn']), - ), + rules: Object.fromEntries( + pluginVueA11y.configs['flat/recommended'] + .flatMap(config => Object.keys(config.rules ?? {})) + .map(rule => [rule, 'warn']), + ),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@eslint.config.mjs` around lines 61 - 63, The current rule mapping hard-codes an index into pluginVueA11y.configs['flat/recommended'][1], which is fragile; change the logic that builds rules (the Object.fromEntries call that references pluginVueA11y.configs['flat/recommended']) to iterate over all entries/presets and collect their .rules objects (e.g., via flatMap over Object.values or Object.entries) and then map each rule name to 'warn', so the final Object.fromEntries consumes the flattened list of [ruleName, 'warn'] pairs instead of relying on a single index.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@eslint.config.mjs`:
- Around line 61-63: The current rule mapping hard-codes an index into
pluginVueA11y.configs['flat/recommended'][1], which is fragile; change the logic
that builds rules (the Object.fromEntries call that references
pluginVueA11y.configs['flat/recommended']) to iterate over all entries/presets
and collect their .rules objects (e.g., via flatMap over Object.values or
Object.entries) and then map each rule name to 'warn', so the final
Object.fromEntries consumes the flattened list of [ruleName, 'warn'] pairs
instead of relying on a single index.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: de83d0b9-0aab-4aad-85e1-951adb1fbe03
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
eslint.config.mjspackage.json
🔗 Linked issue
Refs #2634
❓ Type of change
🧹 Chore (updates to the build process or auxiliary tools and libraries)
📚 Description
warnerroronce the codebase is clean.📝 Checklist
Summary by CodeRabbit