save the lint file for altText rule
MODIFY
packages/@romejs/js-compiler/lint/rules/react/jsxA11yAltText.ts
packages/@romejs/js-compiler/lint/rules/react/jsxA11yAltText.ts
@@ -11,7 +11,7 @@ import {descriptions} from "@romejs/diagnostics";
import {
getJSXAttribute,
hasJSXAttribute,
- isJSXElement
+ isJSXElement,
} from "@romejs/js-ast-utils";
function hasImgAltText(node: JSXElement): boolean {
@@ -20,11 +20,9 @@ function hasImgAltText(node: JSXElement): boolean {
return false;
}
return (
- !!(
- attr.value &&
+ !!(attr.value &&
attr.value.type === "StringLiteral" &&
- attr.value.value === ""
- ) || hasJSXAttribute(node, "alt")
+ attr.value.value === "") || hasJSXAttribute(node, "alt")
);
}
@@ -60,11 +58,9 @@ function hasTypeImage(node: JSXElement): boolean {
if (attr === undefined) {
return false;
}
- return !!(
- attr.value &&
+ return !!(attr.value &&
attr.value.type === "StringLiteral" &&
- attr.value.value === "image"
- );
+ attr.value.value === "image");
}
export default {
@@ -87,10 +83,10 @@ export default {
) {
path.context.addNodeDiagnostic(
node,
- descriptions.LINT.JSX_A11Y_ALT_TEXT
+ descriptions.LINT.JSX_A11Y_ALT_TEXT,
);
}
}
return node;
- }
+ },
};

save the lint file for altText rule