feat: add jsx-a11y accessibility lint rules (content/attribute cluster) - #1500
feat: add jsx-a11y accessibility lint rules (content/attribute cluster)#1500bartlomieju wants to merge 1 commit into
Conversation
Ports four accessibility rules from oxlint/eslint-plugin-jsx-a11y, in Rust: - jsx-a11y-anchor-has-content: <a> must have accessible content - jsx-a11y-heading-has-content: <h1>-<h6> must have content - jsx-a11y-html-has-lang: <html> must have a non-empty lang attribute - jsx-a11y-iframe-has-title: <iframe> must have a non-empty title Adds a new `a11y` tag. These rules are opt-in (tagged a11y/jsx/react/fresh, not recommended). The configurable `components` option and autofixers from the reference implementations are intentionally deferred.
|
Verdict: LGTM on the code — needs maintainer sign-off (new rule cluster) + a structural cleanup suggestion. Not auto-merging (new rules). Clean port of 4 jsx-a11y rules using the standard Correctness — verified
Structural — worth doing now, before the track grows
Minor
Perf: fine — per- Housekeeping: new No behavioral changes requested; recommend extracting the shared helpers before landing so the rest of the a11y track builds on a common util. |
First cluster of accessibility rules ported from oxlint / eslint-plugin-jsx-a11y, implemented in Rust against
deno_ast::viewusing the existingHandler/Traversepattern.Four rules are added:
jsx-a11y-anchor-has-content— an<a>anchor must have content accessible to screen readers (text, a non-hidden child, ordangerouslySetInnerHTML/title/aria-label).jsx-a11y-heading-has-content— heading elements<h1>–<h6>must have content.jsx-a11y-html-has-lang— the<html>element must have a non-emptylangattribute.jsx-a11y-iframe-has-title—<iframe>must have a non-emptytitleattribute.A new
a11ytag is introduced. These rules are opt-in: they are taggeda11y,jsx,react,freshbut intentionally notrecommended, so they only run when a user enables them. Individual rules can be promoted torecommendedlater.The configurable
componentsoption (custom-component name mapping) and the autofixers from the reference implementations are intentionally deferred for now; only built-in DOM element names are handled. Test fixtures are ported from the oxlint reference (pass cases →assert_lint_ok!, fail cases →assert_lint_err!).This is the start of the jsx-a11y porting track (35 rules total); see the project notes for the full plan.