Latest Results
fix(linter): jsx-a11y/iframe-has-title recognizes member expressions (#16669)
## Fix jsx-a11y/iframe-has-title to recognize member expressions as valid title values
- [x] Investigate the issue - false positive when title is set to a member expression like `file.name`
- [x] Identify root cause - rule only handles simple identifiers, not member expressions
- [x] Add test cases for member expressions (static, nested, and computed)
- [x] Update rule to handle member expression variants (StaticMemberExpression, ComputedMemberExpression, PrivateFieldExpression)
- [x] Run tests to verify the fix - all 844 linter tests pass
- [x] Manual verification with oxlint CLI - confirmed fix works correctly
- [x] Code review completed - no issues found
- [x] Security scan completed - no vulnerabilities detected
- [x] Fix clippy warning - merge identical match arms
## Summary
Fixed a false positive in the `jsx-a11y/iframe-has-title` linter rule where it incorrectly reported an error when the title attribute was set to a member expression like `file.name`.
### Changes Made
- Added handling for three member expression variants: `StaticMemberExpression`, `ComputedMemberExpression`, and `PrivateFieldExpression`
- Combined CallExpression and member expression patterns into a single match arm to satisfy clippy's `match-same-arms` lint
- Added comprehensive test cases to verify the fix works for all member expression types
- All existing tests continue to pass
### Testing Verified
โ
`<iframe title={file.name} />` - now passes (static member expression)
โ
`<iframe title={obj.prop.name} />` - now passes (nested member expression)
โ
`<iframe title={obj['prop']} />` - now passes (computed member expression)
โ
`<iframe />` - still fails correctly (no title)
โ
`<iframe title="" />` - still fails correctly (empty title)
โ
`<iframe title={undefined} />` - still fails correctly (undefined)
โ
Clippy passes without warnings
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>linter: jsx-a11y/iframe-has-title fails to recognize title is set</issue_title>
> <issue_description>### What version of Oxlint are you using?
>
> 1.31.0
>
> ### What command did you run?
>
> oxlint --type-aware
>
> ### What does your `.oxlintrc.json` config file look like?
>
> ```jsonc
> {
> "$schema": "./node_modules/oxlint/configuration_schema.json",
> "plugins": ["unicorn", "typescript", "oxc", "react", "import", "jsx-a11y"],
> "categories": { "correctness": "error", "perf": "error" },
> "rules": {
> "curly": "error",
> "guard-for-in": "error",
> "no-array-constructor": "error",
> "no-duplicate-imports": "warn",
> "no-else-return": "warn",
> "no-fallthrough": "warn",
> "no-nested-ternary": "error",
> "no-return-assign": "error",
> "sort-imports": "off",
> "import/no-commonjs": "error",
> "import/no-self-import": "error",
> "react/jsx-filename-extension": [
> "error",
> { "extensions": [".jsx", ".tsx"] }
> ],
> "react/rules-of-hooks": "error",
> "typescript/consistent-generic-constructors": "warn",
> "typescript/consistent-indexed-object-style": "warn",
> "typescript/consistent-type-definitions": "warn",
> "typescript/consistent-type-imports": "warn",
> "typescript/no-explicit-any": "error",
> "typescript/no-import-type-side-effects": "warn",
> "typescript/no-require-imports": "error",
> "typescript/only-throw-error": "error",
> "typescript/prefer-for-of": "warn",
> "typescript/prefer-reduce-type-parameter": "error",
> "typescript/prefer-ts-expect-error": "error",
> "typescript/restrict-plus-operands": "error",
> "unicorn/no-array-for-each": "error",
> "unicorn/no-lonely-if": "warn",
> "unicorn/prefer-array-flat": "error",
> "unicorn/prefer-date-now": "warn",
> "unicorn/prefer-includes": "error",
> "unicorn/prefer-logical-operator-over-ternary": "warn",
> "unicorn/prefer-number-properties": "error",
> "unicorn/prefer-object-from-entries": "warn",
> "unicorn/prefer-optional-catch-binding": "error"
> },
> "settings": {
> "jsx-a11y": {
> "polymorphicPropName": null,
> "components": {}
> },
> "react": {
> "formComponents": [],
> "linkComponents": []
> },
> "jsdoc": {
> "ignorePrivate": false,
> "ignoreInternal": false,
> "ignoreReplacesDocs": true,
> "overrideReplacesDocs": true,
> "augmentsExtendsReplacesDocs": false,
> "implementsReplacesDocs": false,
> "exemptDestructuredRootsFromChecks": false,
> "tagNamePreference": {}
> }
> },
> "env": {
> "builtin": true,
> "browser": true,
> "es2020": true
> },
> "globals": {},
> "ignorePatterns": [".yarn/**", "public/**", "src/__generated__/**"]
> }
> ```
>
>
> ### What happened?
>
> See false report:
>
> ```
> ร eslint-plugin-jsx-a11y(iframe-has-title): Missing `title` attribute for the `iframe` element.
> โญโ[src/components/materials/FileViewer/OfficeViewer.tsx:31:11]
> 30 โ
> 31 โ return <iframe src={src} style={style} title={file.name} />;
> ยท โโโโโโ
> 32 โ }
> โฐโโโโ
> help: Provide `title` property for `iframe` element.
> ```</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes oxc-project/oxc#16665
<!-- START COPILOT CODING AGENT TIPS -->
---
โจ Let Copilot coding agent [set things up for you](https://github.com/oxc-project/oxc/issues/new?title=โจ+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) โ coding agent works faster and does higher quality work when set up for your repo. Active Branches
#166670%
#166680%
#166110%
ยฉ 2025 CodSpeed Technology