Skip to content

Commit

Permalink
[patch] no-autofocus: don't report error if autoFocus is set to false
Browse files Browse the repository at this point in the history
This change adjusts the error condition for `no-autofocus` to allow for manually disabling `autoFocus`.  Now, any usage of `autoFocus="false"` or `autoFocus={false}` will not report.
  • Loading branch information
michaelfaith committed Dec 25, 2024
1 parent a878036 commit 31b2212
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rules/no-autofocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default {

// Fail if autoFocus is used and the value is anything other than false (either via an expression or string literal).
if (propName(attribute) === 'autoFocus' && getPropValue(attribute) !== 'false') {
// eslint-disable-next-line no-console
console.log(`attribute: ${attribute}`);
// eslint-disable-next-line no-console
console.log(`attribute value: ${getPropValue(attribute)}`);
context.report({
node: attribute,
message: errorMessage,
Expand Down

0 comments on commit 31b2212

Please sign in to comment.