feat(linter): adds jsx-a11y/no-static-element-interactions rule
          #14922
        
          
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
What's New
jsx-a11y/no-static-element-interactions- ☂️ eslint-plugin-jsx-a11y #1141tasks/a11y_dataoxc/oxc_aria_queryData Needs
This rule relies on data from
aria-queryandaxobject-querynpm packages. These data are not available in any well-maintained Rust crates from my search.There's a comment in
oxc_linter/src/utils/react.rsthat suggests aoxc-project/aria-queryrepo is a W.I.P. but that repo is labeled as "under construction" and now appears to be archived.I found no source for
axobject-querydata in Rust.I followed the lead of
tasks/compat_dataandcrates/oxc_compatwhich is similarly converting data from an npm package into Rust code.I opted to grab the minimum set of data required for this rule, but even this set should be enough to help with other unimplemented
jsx-a11yplugin rules, likeinteractive-supports-focus, that rely on the same data.Known Differences from ESLint Implementation
I found two main issues with the ESLint implementation of this rule.
allowExpressionValuesrule were ternaries where both sides were string literals. I looked at the GH issue that led to the no-op code being added and I believe the no-op code was added due to some miscommunication. I suspect the issue reporter was using a version of thejsx-a11yplugin that didn't have theallowExpressionValuesoption at all. A year and a half later the ticket was picked up and that option would've existed onmainand I believe the contributor assumed that the user was on the latest code so they added some new code to handle that case which the latest code already permitted. Unsurprisingly their new test case passed as the "violation" had already been permitted by the latest code.roleattributes. Sometimes they use the entireroleattribute value to classify roles and other times they separate the string on whitespace and use the first valid role. This difference in behavior didn't seem intentional so I've made this more consistent by creating afirst_valid_role()function inreact.rsthat uses the latter strategy.