use orJoin function
MODIFY
packages/@romejs/diagnostics/descriptions.ts
packages/@romejs/diagnostics/descriptions.ts
@@ -42,7 +42,8 @@ function join(conjunction: string, items: Array<string>): string {
} else if (items.length === 1) {
return items[0];
} else {
- return [...items, `${conjunction} ${items.pop()!}`].join(', ');
+ const popped = items.pop()!;
+ return [...items, `${conjunction} ${popped}`].join(', ');
}
}
@@ -358,9 +359,14 @@ export const descriptions = createMessages({
category: 'lint/preferWhile',
message: 'A while loop should be used over a for loop',
},
- REACT_JSX_VOID_DOM_ELEMENTS_NO_CHILDREN: (element, properties) => ({
+ REACT_JSX_VOID_DOM_ELEMENTS_NO_CHILDREN: (
+ element: string,
+ properties: Array<string>,
+ ) => ({
category: 'lint/voidDomElementsNoChildren',
- message: markup`<emphasis>${element}</emphasis> is a void element tag and must not have <emphasis>${properties}</emphasis>.`,
+ message: markup`<emphasis>${element}</emphasis> is a void element tag and must not have <emphasis>${orJoin(
+ properties,
+ )}</emphasis>.`,
}),
REACT_JSX_NO_COMMENT_TEXT: {
category: 'lint/jsxNoCommentText',

MODIFY
packages/@romejs/js-compiler/lint/rules/react/voidDomElementsNoChildren.ts
packages/@romejs/js-compiler/lint/rules/react/voidDomElementsNoChildren.ts
@@ -41,7 +41,7 @@ export default {
) {
const element = node.name.name;
- let properties = new Set();
+ let properties: Set<string> = new Set();
if (node.children.length !== 0) {
properties.add('children');
@@ -74,7 +74,7 @@ export default {
},
descriptions.LINT.REACT_JSX_VOID_DOM_ELEMENTS_NO_CHILDREN(
element,
- Array.from(properties).join(' or '),
+ Array.from(properties),
),
);
}

use orJoin function