Makes the diagnostic message more specific to the JSX attribute that flags an error.
MODIFY
packages/@romejs/compiler/lint/rules/jsx-a11y/noOnChange.ts
packages/@romejs/compiler/lint/rules/jsx-a11y/noOnChange.ts
import {descriptions} from "@romejs/diagnostics";
-import {hasJSXAttribute, isJSXElement} from "@romejs/js-ast-utils";
+import {
+ getJSXAttribute,
+ hasJSXAttribute,
+ isJSXElement,
+} from "@romejs/js-ast-utils";
import {Path, TransformExitResult} from "@romejs/compiler";
export default {
@@ -19,7 +23,10 @@ export default {
return node;
}
- context.addNodeDiagnostic(node, descriptions.LINT.JSX_A11Y_NO_ON_CHANGE);
+ context.addNodeDiagnostic(
+ getJSXAttribute(node, "onChange"),
+ descriptions.LINT.JSX_A11Y_NO_ON_CHANGE,
+ );
return node;
},

MODIFY
packages/@romejs/compiler/lint/rules/react/noStringRefs.ts
packages/@romejs/compiler/lint/rules/react/noStringRefs.ts
@@ -54,7 +54,7 @@ export default {
if (containsStringLiteral(ref) || containsStringContainer(ref)) {
context.addNodeDiagnostic(
- node,
+ ref,
descriptions.LINT.REACT_NO_STRING_REFS(
"string literals in ref attributes",
),

Makes the diagnostic message more specific to the JSX attribute that flags an error. (#504)

Co-authored-by: Mark Holmes <Mark@mark-holmes-mbp.lan>